2022-08-09 18:42:48

by Sander Vanheule

[permalink] [raw]
Subject: [PATCH v1 3/5] lib/test_cpumask: follow KUnit style guidelines

The cpumask test suite doesn't follow the KUnit style guidelines, as
laid out in Documentation/dev-tools/kunit/style.rst. The file is
renamed to lib/cpumask_kunit.c to clearly distinguish it from other,
non-KUnit, tests.

Link: https://lore.kernel.org/lkml/[email protected]/
Suggested-by: Maíra Canal <[email protected]>
Signed-off-by: Sander Vanheule <[email protected]>
---
lib/Kconfig.debug | 7 +++++--
lib/Makefile | 2 +-
lib/{test_cpumask.c => cpumask_kunit.c} | 0
3 files changed, 6 insertions(+), 3 deletions(-)
rename lib/{test_cpumask.c => cpumask_kunit.c} (100%)

diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index 072e4b289c13..bcbe60d6c80c 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -2029,13 +2029,16 @@ config LKDTM
Documentation on how to use the module can be found in
Documentation/fault-injection/provoke-crashes.rst

-config TEST_CPUMASK
- tristate "cpumask tests" if !KUNIT_ALL_TESTS
+config CPUMASK_KUNIT_TEST
+ tristate "KUnit test for cpumask" if !KUNIT_ALL_TESTS
depends on KUNIT
default KUNIT_ALL_TESTS
help
Enable to turn on cpumask tests, running at boot or module load time.

+ For more information on KUnit and unit tests in general, please refer
+ to the KUnit documentation in Documentation/dev-tools/kunit/.
+
If unsure, say N.

config TEST_LIST_SORT
diff --git a/lib/Makefile b/lib/Makefile
index c95212141928..22eafcd39b51 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -59,6 +59,7 @@ obj-$(CONFIG_TEST_BPF) += test_bpf.o
obj-$(CONFIG_TEST_FIRMWARE) += test_firmware.o
obj-$(CONFIG_TEST_BITOPS) += test_bitops.o
CFLAGS_test_bitops.o += -Werror
+obj-$(CONFIG_CPUMASK_KUNIT_TEST) += cpumask_kunit.o
obj-$(CONFIG_TEST_SYSCTL) += test_sysctl.o
obj-$(CONFIG_TEST_SIPHASH) += test_siphash.o
obj-$(CONFIG_HASH_KUNIT_TEST) += test_hash.o
@@ -99,7 +100,6 @@ obj-$(CONFIG_TEST_HMM) += test_hmm.o
obj-$(CONFIG_TEST_FREE_PAGES) += test_free_pages.o
obj-$(CONFIG_KPROBES_SANITY_TEST) += test_kprobes.o
obj-$(CONFIG_TEST_REF_TRACKER) += test_ref_tracker.o
-obj-$(CONFIG_TEST_CPUMASK) += test_cpumask.o
CFLAGS_test_fprobe.o += $(CC_FLAGS_FTRACE)
obj-$(CONFIG_FPROBE_SANITY_TEST) += test_fprobe.o
#
diff --git a/lib/test_cpumask.c b/lib/cpumask_kunit.c
similarity index 100%
rename from lib/test_cpumask.c
rename to lib/cpumask_kunit.c
--
2.37.1


2022-08-09 22:37:53

by Maira Canal

[permalink] [raw]
Subject: Re: [PATCH v1 3/5] lib/test_cpumask: follow KUnit style guidelines



On 8/9/22 15:08, Sander Vanheule wrote:
> The cpumask test suite doesn't follow the KUnit style guidelines, as
> laid out in Documentation/dev-tools/kunit/style.rst. The file is
> renamed to lib/cpumask_kunit.c to clearly distinguish it from other,
> non-KUnit, tests.
>
> Link: https://lore.kernel.org/lkml/[email protected]/
> Suggested-by: Maíra Canal <[email protected]>
> Signed-off-by: Sander Vanheule <[email protected]>

Reviewed-by: Maíra Canal <[email protected]>

> ---
> lib/Kconfig.debug | 7 +++++--
> lib/Makefile | 2 +-
> lib/{test_cpumask.c => cpumask_kunit.c} | 0
> 3 files changed, 6 insertions(+), 3 deletions(-)
> rename lib/{test_cpumask.c => cpumask_kunit.c} (100%)
>
> diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
> index 072e4b289c13..bcbe60d6c80c 100644
> --- a/lib/Kconfig.debug
> +++ b/lib/Kconfig.debug
> @@ -2029,13 +2029,16 @@ config LKDTM
> Documentation on how to use the module can be found in
> Documentation/fault-injection/provoke-crashes.rst
>
> -config TEST_CPUMASK
> - tristate "cpumask tests" if !KUNIT_ALL_TESTS
> +config CPUMASK_KUNIT_TEST
> + tristate "KUnit test for cpumask" if !KUNIT_ALL_TESTS
> depends on KUNIT
> default KUNIT_ALL_TESTS
> help
> Enable to turn on cpumask tests, running at boot or module load time.
>
> + For more information on KUnit and unit tests in general, please refer
> + to the KUnit documentation in Documentation/dev-tools/kunit/.
> +
> If unsure, say N.
>
> config TEST_LIST_SORT
> diff --git a/lib/Makefile b/lib/Makefile
> index c95212141928..22eafcd39b51 100644
> --- a/lib/Makefile
> +++ b/lib/Makefile
> @@ -59,6 +59,7 @@ obj-$(CONFIG_TEST_BPF) += test_bpf.o
> obj-$(CONFIG_TEST_FIRMWARE) += test_firmware.o
> obj-$(CONFIG_TEST_BITOPS) += test_bitops.o
> CFLAGS_test_bitops.o += -Werror
> +obj-$(CONFIG_CPUMASK_KUNIT_TEST) += cpumask_kunit.o
> obj-$(CONFIG_TEST_SYSCTL) += test_sysctl.o
> obj-$(CONFIG_TEST_SIPHASH) += test_siphash.o
> obj-$(CONFIG_HASH_KUNIT_TEST) += test_hash.o
> @@ -99,7 +100,6 @@ obj-$(CONFIG_TEST_HMM) += test_hmm.o
> obj-$(CONFIG_TEST_FREE_PAGES) += test_free_pages.o
> obj-$(CONFIG_KPROBES_SANITY_TEST) += test_kprobes.o
> obj-$(CONFIG_TEST_REF_TRACKER) += test_ref_tracker.o
> -obj-$(CONFIG_TEST_CPUMASK) += test_cpumask.o
> CFLAGS_test_fprobe.o += $(CC_FLAGS_FTRACE)
> obj-$(CONFIG_FPROBE_SANITY_TEST) += test_fprobe.o
> #
> diff --git a/lib/test_cpumask.c b/lib/cpumask_kunit.c
> similarity index 100%
> rename from lib/test_cpumask.c
> rename to lib/cpumask_kunit.c

2022-08-10 04:22:15

by David Gow

[permalink] [raw]
Subject: Re: [PATCH v1 3/5] lib/test_cpumask: follow KUnit style guidelines

On Wed, Aug 10, 2022 at 2:09 AM Sander Vanheule <[email protected]> wrote:
>
> The cpumask test suite doesn't follow the KUnit style guidelines, as
> laid out in Documentation/dev-tools/kunit/style.rst. The file is
> renamed to lib/cpumask_kunit.c to clearly distinguish it from other,
> non-KUnit, tests.
>
> Link: https://lore.kernel.org/lkml/[email protected]/
> Suggested-by: Maíra Canal <[email protected]>
> Signed-off-by: Sander Vanheule <[email protected]>
> ---

Thanks: it's definitely nicer to have this match the KUnit style.

If renaming causes problems, we could live without it, but I'd prefer
this to go through as-is.

Reviewed-by: David Gow <[email protected]>


> lib/Kconfig.debug | 7 +++++--
> lib/Makefile | 2 +-
> lib/{test_cpumask.c => cpumask_kunit.c} | 0
> 3 files changed, 6 insertions(+), 3 deletions(-)
> rename lib/{test_cpumask.c => cpumask_kunit.c} (100%)
>
> diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
> index 072e4b289c13..bcbe60d6c80c 100644
> --- a/lib/Kconfig.debug
> +++ b/lib/Kconfig.debug
> @@ -2029,13 +2029,16 @@ config LKDTM
> Documentation on how to use the module can be found in
> Documentation/fault-injection/provoke-crashes.rst
>
> -config TEST_CPUMASK
> - tristate "cpumask tests" if !KUNIT_ALL_TESTS
> +config CPUMASK_KUNIT_TEST
> + tristate "KUnit test for cpumask" if !KUNIT_ALL_TESTS
> depends on KUNIT
> default KUNIT_ALL_TESTS
> help
> Enable to turn on cpumask tests, running at boot or module load time.
>
> + For more information on KUnit and unit tests in general, please refer
> + to the KUnit documentation in Documentation/dev-tools/kunit/.
> +
> If unsure, say N.
>
> config TEST_LIST_SORT
> diff --git a/lib/Makefile b/lib/Makefile
> index c95212141928..22eafcd39b51 100644
> --- a/lib/Makefile
> +++ b/lib/Makefile
> @@ -59,6 +59,7 @@ obj-$(CONFIG_TEST_BPF) += test_bpf.o
> obj-$(CONFIG_TEST_FIRMWARE) += test_firmware.o
> obj-$(CONFIG_TEST_BITOPS) += test_bitops.o
> CFLAGS_test_bitops.o += -Werror
> +obj-$(CONFIG_CPUMASK_KUNIT_TEST) += cpumask_kunit.o
> obj-$(CONFIG_TEST_SYSCTL) += test_sysctl.o
> obj-$(CONFIG_TEST_SIPHASH) += test_siphash.o
> obj-$(CONFIG_HASH_KUNIT_TEST) += test_hash.o
> @@ -99,7 +100,6 @@ obj-$(CONFIG_TEST_HMM) += test_hmm.o
> obj-$(CONFIG_TEST_FREE_PAGES) += test_free_pages.o
> obj-$(CONFIG_KPROBES_SANITY_TEST) += test_kprobes.o
> obj-$(CONFIG_TEST_REF_TRACKER) += test_ref_tracker.o
> -obj-$(CONFIG_TEST_CPUMASK) += test_cpumask.o
> CFLAGS_test_fprobe.o += $(CC_FLAGS_FTRACE)
> obj-$(CONFIG_FPROBE_SANITY_TEST) += test_fprobe.o
> #
> diff --git a/lib/test_cpumask.c b/lib/cpumask_kunit.c
> similarity index 100%
> rename from lib/test_cpumask.c
> rename to lib/cpumask_kunit.c
> --
> 2.37.1
>