Re: [PATCH 2/3] bitmap: Rename module

From: John Hubbard
Date: Fri Jul 26 2024 - 14:46:30 EST


On 7/26/24 4:06 AM, Muhammad Usama Anjum wrote:
Rename module to bitmap_kunit and rename the configuration option
compliant with kunit framework.

Cc: kees@xxxxxxxxxx
Signed-off-by: Muhammad Usama Anjum <usama.anjum@xxxxxxxxxxxxx>
---
MAINTAINERS | 2 +-
lib/Kconfig.debug | 15 ++++++++-------
lib/Makefile | 2 +-
lib/{test_bitmap.c => bitmap_kunit.c} | 0
4 files changed, 10 insertions(+), 9 deletions(-)
rename lib/{test_bitmap.c => bitmap_kunit.c} (100%)

diff --git a/MAINTAINERS b/MAINTAINERS
index 12b870712da4a..289b727344d64 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -3814,13 +3814,13 @@ F: include/linux/find.h
F: include/linux/nodemask.h
F: include/linux/nodemask_types.h
F: include/vdso/bits.h
+F: lib/bitmap_kunit.c
F: lib/bitmap-str.c
F: lib/bitmap.c
F: lib/cpumask.c
F: lib/cpumask_kunit.c
F: lib/find_bit.c
F: lib/find_bit_benchmark.c
-F: lib/test_bitmap.c

This changes the situation from "works for Linus' tab completion
case", to "causes a tab completion problem"! :)

I think a tests/ subdir is how we eventually decided to do this [1],
right?

So:

lib/tests/bitmap_kunit.c


[1] https://lore.kernel.org/20240724201354.make.730-kees@xxxxxxxxxx

thanks,
--
John Hubbard
NVIDIA


F: tools/include/linux/bitfield.h
F: tools/include/linux/bitmap.h
F: tools/include/linux/bits.h
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index a30c03a661726..6bb02990a73e7 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -2420,13 +2420,6 @@ config TEST_PRINTF
config TEST_SCANF
tristate "Test scanf() family of functions at runtime"
-config TEST_BITMAP
- tristate "Test bitmap_*() family of functions at runtime"
- help
- Enable this option to test the bitmap functions at boot.
-
- If unsure, say N.
-
config TEST_UUID
tristate "Test functions located in the uuid module at runtime"
@@ -2813,6 +2806,14 @@ config USERCOPY_KUNIT_TEST
on the copy_to/from_user infrastructure, making sure basic
user/kernel boundary testing is working.
+config BITMAP_KUNIT_TEST
+ tristate "KUnit Test for bitmap_*() family of functions"
+ depends on KUNIT
+ default KUNIT_ALL_TESTS
+ help
+ This builds the "bitmap_kunit" module that runs tests for
+ bitmaps int the kernel making sure that there isn't any bug.
+
config TEST_UDELAY
tristate "udelay test driver"
help
diff --git a/lib/Makefile b/lib/Makefile
index 322bb127b4dc6..37e7359a7065e 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -84,7 +84,6 @@ obj-$(CONFIG_TEST_DYNAMIC_DEBUG) += test_dynamic_debug.o
obj-$(CONFIG_TEST_PRINTF) += test_printf.o
obj-$(CONFIG_TEST_SCANF) += test_scanf.o
-obj-$(CONFIG_TEST_BITMAP) += test_bitmap.o
ifeq ($(CONFIG_CC_IS_CLANG)$(CONFIG_KASAN),yy)
# FIXME: Clang breaks test_bitmap_const_eval when KASAN and GCOV are enabled
GCOV_PROFILE_test_bitmap.o := n
@@ -388,6 +387,7 @@ CFLAGS_fortify_kunit.o += $(DISABLE_STRUCTLEAK_PLUGIN)
obj-$(CONFIG_FORTIFY_KUNIT_TEST) += fortify_kunit.o
obj-$(CONFIG_SIPHASH_KUNIT_TEST) += siphash_kunit.o
obj-$(CONFIG_USERCOPY_KUNIT_TEST) += usercopy_kunit.o
+obj-$(CONFIG_BITMAP_KUNIT_TEST) += bitmap_kunit.o
obj-$(CONFIG_GENERIC_LIB_DEVMEM_IS_ALLOWED) += devmem_is_allowed.o
diff --git a/lib/test_bitmap.c b/lib/bitmap_kunit.c
similarity index 100%
rename from lib/test_bitmap.c
rename to lib/bitmap_kunit.c

thanks,
--
John Hubbard
NVIDIA