Re: [PATCH 1/7] HID: uclogic: KUnit best practices and naming conventions

From: Daniel Latypov
Date: Mon Jul 11 2022 - 10:42:30 EST


On Sun, Jul 10, 2022 at 10:51 AM José Expósito
<jose.exposito89@xxxxxxxxx> wrote:
>
> The KUnit documentation [1] suggests allowing build tests as a module.
>
> In addition, it is recommended [2] to use snake case names for
> kunit_suite and test cases.

Test parameters don't fall under "test cases", though I see how that
can be construed as such.
I don't think anyone has stated any preference to standardize the naming there.

We currently have parameterized tests using spaces and punctuation, e.g.
ok 7 - binfmt_elf
# Subtest: ext4_inode_test
1..1
# Subtest: inode_test_xtimestamp_decoding
ok 1 - 1901-12-13 Lower bound of 32bit < 0 timestamp, no extra bits
ok 2 - 1969-12-31 Upper bound of 32bit < 0 timestamp, no extra bits
...
ok 1 - mctp_test_fragment
# Subtest: mctp_test_rx_input
ok 1 - {1,a,8,0}
ok 2 - {1,a,9,0}
ok 3 - {2,a,8,0}

So I think the old names were more conventional.

>
> Change the Kconfig entry from bool to tristate and stick to the naming
> conventions to avoid style issues with future tests.
>
> Link: https://docs.kernel.org/dev-tools/kunit/style.html#test-kconfig-entries [1]
> Link: https://www.kernel.org/doc/html/latest/dev-tools/kunit/style.html [2]
> Signed-off-by: José Expósito <jose.exposito89@xxxxxxxxx>

Everything else (renaming the suite and switching to tristate) sounds
good to me though.

Acked-by: Daniel Latypov <dlatypov@xxxxxxxxxx>