[PATCH v2 4/6] kunit: lib: adhear to KUNIT formatting standard

From: Nico Pache
Date: Wed Apr 14 2021 - 05:01:18 EST


Change config names inorder to adhear to the KUNIT *KUNIT_TEST config
name format.

Add 'if !KUNIT_ALL_TESTS' to the KUNIT config tristates inorder to
adhear to the KUNIT standard.

add 'default KUNIT_ALL_TESTS' to the KUNIT config options inorder
to adhear to the KUNIT standard.

Fixes: 6d511020e13d (lib/test_bits.c: add tests of GENMASK)
Fixes: d2585f5164c2 (lib: kunit: add bitfield test conversion to KUnit)
Fixes: 33d599f05299 (lib/test_linear_ranges: add a test for the 'linear_ranges')
Signed-off-by: Nico Pache <npache@xxxxxxxxxx>
---
lib/Kconfig.debug | 21 +++++++++++++--------
lib/Makefile | 6 +++---
2 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index 417c3d3e521b..e7a5f4cc6de1 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -2279,9 +2279,10 @@ config TEST_SYSCTL

If unsure, say N.

-config BITFIELD_KUNIT
- tristate "KUnit test bitfield functions at runtime"
+config BITFIELD_KUNIT_TEST
+ tristate "KUnit test bitfield functions at runtime" if !KUNIT_ALL_TESTS
depends on KUNIT
+ default KUNIT_ALL_TESTS
help
Enable this option to test the bitfield functions at boot.

@@ -2296,8 +2297,9 @@ config BITFIELD_KUNIT
If unsure, say N.

config RESOURCE_KUNIT_TEST
- tristate "KUnit test for resource API"
+ tristate "KUnit test for resource API" if !KUNIT_ALL_TESTS
depends on KUNIT
+ default KUNIT_ALL_TESTS
help
This builds the resource API unit test.
Tests the logic of API provided by resource.c and ioport.h.
@@ -2337,9 +2339,10 @@ config LIST_KUNIT_TEST

If unsure, say N.

-config LINEAR_RANGES_TEST
- tristate "KUnit test for linear_ranges"
+config LINEAR_RANGES_KUNIT_TEST
+ tristate "KUnit test for linear_ranges" if !KUNIT_ALL_TESTS
depends on KUNIT
+ default KUNIT_ALL_TESTS
select LINEAR_RANGES
help
This builds the linear_ranges unit test, which runs on boot.
@@ -2350,8 +2353,9 @@ config LINEAR_RANGES_TEST
If unsure, say N.

config CMDLINE_KUNIT_TEST
- tristate "KUnit test for cmdline API"
+ tristate "KUnit test for cmdline API" if !KUNIT_ALL_TESTS
depends on KUNIT
+ default KUNIT_ALL_TESTS
help
This builds the cmdline API unit test.
Tests the logic of API provided by cmdline.c.
@@ -2360,9 +2364,10 @@ config CMDLINE_KUNIT_TEST

If unsure, say N.

-config BITS_TEST
- tristate "KUnit test for bits.h"
+config BITS_KUNIT_TEST
+ tristate "KUnit test for bits.h" if !KUNIT_ALL_TESTS
depends on KUNIT
+ default KUNIT_ALL_TESTS
help
This builds the bits unit test.
Tests the logic of macros defined in bits.h.
diff --git a/lib/Makefile b/lib/Makefile
index b5307d3eec1a..ffa749c3b6e4 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -347,10 +347,10 @@ obj-$(CONFIG_OBJAGG) += objagg.o
obj-$(CONFIG_PLDMFW) += pldmfw/

# KUnit tests
-obj-$(CONFIG_BITFIELD_KUNIT) += bitfield_kunit.o
+obj-$(CONFIG_BITFIELD_KUNIT_TEST) += bitfield_kunit.o
obj-$(CONFIG_LIST_KUNIT_TEST) += list-test.o
-obj-$(CONFIG_LINEAR_RANGES_TEST) += test_linear_ranges.o
-obj-$(CONFIG_BITS_TEST) += test_bits.o
+obj-$(CONFIG_LINEAR_RANGES_KUNIT_TEST) += test_linear_ranges.o
+obj-$(CONFIG_BITS_KUNIT_TEST) += test_bits.o
obj-$(CONFIG_CMDLINE_KUNIT_TEST) += cmdline_kunit.o

obj-$(CONFIG_GENERIC_LIB_DEVMEM_IS_ALLOWED) += devmem_is_allowed.o
--
2.30.2