Skip to contentSkip to conversation

tests: provide a word-at-a-time test implementation

PATCH In review Sven Schnelle 2 participants 2 messages Oct 9, 2023 Library code

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tests: provide a word-at-a-time test implementation

Add some basic tests to test the correctness of has_zero() and find_zero().

---
 lib/Kconfig.debug         | 11 +++++++
 lib/Makefile              |  1 +
 lib/test_word-at-a-time.c | 62 +++++++++++++++++++++++++++++++++++++++
 3 files changed, 74 insertions(+)
 create mode 100644 lib/test_word-at-a-time.c
lib/Kconfig.debug +11 -0
index fa307f93fa2e..f7a4df3054ac 100644
@@ -2791,6 +2791,17 @@ config SIPHASH_KUNIT_TEST
 	  This is intended to help people writing architecture-specific
 	  optimized versions.  If unsure, say N.
 
+config WORDATATIME_KUNIT_TEST
+	tristate "KUnit test word-at-a-time implementation at runtime" if !KUNIT_ALL_TESTS
+	depends on KUNIT
+	default KUNIT_ALL_TESTS
+	help
+	  Enable this option to test the kernel's word-at-a-time (<asm/word-at-a-time.h>)
+	  functions on boot (or module load).
+
+	  This is intended to help people writing architecture-specific
+	  optimized versions.  If unsure, say N.
+
 config TEST_UDELAY
 	tristate "udelay test driver"
 	help
lib/Makefile +1 -0
index 740109b6e2c8..b3bc6a698896 100644
@@ -402,6 +402,7 @@ obj-$(CONFIG_FORTIFY_KUNIT_TEST) += fortify_kunit.o
 obj-$(CONFIG_STRCAT_KUNIT_TEST) += strcat_kunit.o
 obj-$(CONFIG_STRSCPY_KUNIT_TEST) += strscpy_kunit.o
 obj-$(CONFIG_SIPHASH_KUNIT_TEST) += siphash_kunit.o
+obj-$(CONFIG_WORDATATIME_KUNIT_TEST) += test_word-at-a-time.o
 
 obj-$(CONFIG_GENERIC_LIB_DEVMEM_IS_ALLOWED) += devmem_is_allowed.o
 
lib/test_word-at-a-time.c new file +62 -0

62 lines not on this page · raw message

Signature · 1 line
2.39.2