siphash: Convert selftest to KUnit
PATCH 1/1 siphash: Convert selftest to KUnit
Convert the siphash self-test to KUnit so it will be included in "all KUnit tests" coverage, and can be run individually still:
$ ./tools/testing/kunit/kunit.py run siphash ... [02:58:45] Starting KUnit Kernel (1/1)... [02:58:45] ============================================================ [02:58:45] =================== siphash (1 subtest) ==================== [02:58:45] [PASSED] siphash_test [02:58:45] ===================== [PASSED] siphash ===================== [02:58:45] ============================================================ [02:58:45] Testing complete. Ran 1 tests: passed: 1 [02:58:45] Elapsed time: 21.421s total, 4.306s configuring, 16.947s building, 0.148s running
---
MAINTAINERS | 2 +-
lib/Kconfig.debug | 20 +--
lib/Makefile | 2 +-
lib/{test_siphash.c => siphash_kunit.c} | 165 ++++++++++--------------
4 files changed, 83 insertions(+), 106 deletions(-)
rename lib/{test_siphash.c => siphash_kunit.c} (60%)MAINTAINERS +1 -1
@@ -18862,7 +18862,7 @@ M: Jason A. Donenfeld <[email protected]> S: Maintained F: include/linux/siphash.h F: lib/siphash.c -F: lib/test_siphash.c +F: lib/siphash_kunit.c SIS 190 ETHERNET DRIVER M: Francois Romieu <[email protected]>
lib/Kconfig.debug +11 -9
@@ -2247,15 +2247,6 @@ config TEST_RHASHTABLE If unsure, say N. -config TEST_SIPHASH - tristate "Perform selftest on siphash functions" - help - Enable this option to test the kernel's siphash (<linux/siphash.h>) hash - functions on boot (or module load). - - This is intended to help people writing architecture-specific - optimized versions. If unsure, say N. - config TEST_IDA tristate "Perform selftest on IDA functions"
@@ -2583,6 +2574,17 @@ config HW_BREAKPOINT_KUNIT_TEST If unsure, say N. +config SIPHASH_KUNIT_TEST + tristate "Perform selftest on siphash functions" if !KUNIT_ALL_TESTS + depends on KUNIT + default KUNIT_ALL_TESTS + help + Enable this option to test the kernel's siphash (<linux/siphash.h>) hash + 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 -1
@@ -62,7 +62,6 @@ 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 obj-$(CONFIG_TEST_IDA) += test_ida.o obj-$(CONFIG_TEST_UBSAN) += test_ubsan.o
@@ -380,6 +379,7 @@ obj-$(CONFIG_OVERFLOW_KUNIT_TEST) += overflow_kunit.o CFLAGS_stackinit_kunit.o += $(call cc-disable-warning, switch-unreachable) obj-$(CONFIG_STACKINIT_KUNIT_TEST) += stackinit_kunit.o obj-$(CONFIG_FORTIFY_KUNIT_TEST) += fortify_kunit.o +obj-$(CONFIG_SIPHASH_KUNIT_TEST) += siphash_kunit.o obj-$(CONFIG_GENERIC_LIB_DEVMEM_IS_ALLOWED) += devmem_is_allowed.o
lib/siphash_kunit.c renamed from lib/test_siphash.c +70 -95
190 lines not on this page · raw message
Signature · 1 line
2.34.1
Quoted 14 lines · Kees Cook
Convert the siphash self-test to KUnit so it will be included in "all KUnit tests" coverage, and can be run individually still:
$ ./tools/testing/kunit/kunit.py run siphash ... [02:58:45] Starting KUnit Kernel (1/1)... [02:58:45] ============================================================ [02:58:45] =================== siphash (1 subtest) ==================== [02:58:45] [PASSED] siphash_test [02:58:45] ===================== [PASSED] siphash ===================== [02:58:45] ============================================================ [02:58:45] Testing complete. Ran 1 tests: passed: 1 [02:58:45] Elapsed time: 21.421s total, 4.306s configuring, 16.947s building, 0.148s running
Quoted 3 lines
Cc "Jason A. Donenfeld" <[email protected]>Cc David Gow <[email protected]>Signed-off-by Kees Cook <[email protected]>
I'll queue this up. Thanks for the conversion. Appears to work well.
Jason
Quoted 15 lines · Jason A. Donenfeld
Quoted 14 lines · Kees Cook
Convert the siphash self-test to KUnit so it will be included in "all KUnit tests" coverage, and can be run individually still:
$ ./tools/testing/kunit/kunit.py run siphash ... [02:58:45] Starting KUnit Kernel (1/1)... [02:58:45] ============================================================ [02:58:45] =================== siphash (1 subtest) ==================== [02:58:45] [PASSED] siphash_test [02:58:45] ===================== [PASSED] siphash ===================== [02:58:45] ============================================================ [02:58:45] Testing complete. Ran 1 tests: passed: 1 [02:58:45] Elapsed time: 21.421s total, 4.306s configuring, 16.947s building, 0.148s running
Quoted 5 lines
Quoted 3 lines
Cc "Jason A. Donenfeld" <[email protected]>Cc David Gow <[email protected]>Signed-off-by Kees Cook <[email protected]>I'll queue this up. Thanks for the conversion. Appears to work well.
Cool! Thanks for looking it over. If we want to avoid some tree collisions, I could carry it in my tree? I've got some other conversions in progress. Though maybe this begs the question of "how should kunit tests be ordered in the Kconfig and Makefile?" so that collisions are obvious about how to order...
Signature · 1 line
Kees Cook
Jason A. Donenfeld
Acked-byQuoted 21 lines · Kees Cook
Quoted 19 lines · Jason A. Donenfeld
Quoted 17 lines · Kees Cook
Convert the siphash self-test to KUnit so it will be included in "all KUnit tests" coverage, and can be run individually still:
$ ./tools/testing/kunit/kunit.py run siphash ... [02:58:45] Starting KUnit Kernel (1/1)... [02:58:45] ============================================================ [02:58:45] =================== siphash (1 subtest) ==================== [02:58:45] [PASSED] siphash_test [02:58:45] ===================== [PASSED] siphash ===================== [02:58:45] ============================================================ [02:58:45] Testing complete. Ran 1 tests: passed: 1 [02:58:45] Elapsed time: 21.421s total, 4.306s configuring, 16.947s building, 0.148s runningCc "Jason A. Donenfeld" <[email protected]>Cc David Gow <[email protected]>Signed-off-by Kees Cook <[email protected]>
Quoted 7 lines
Quoted 1 line
I'll queue this up. Thanks for the conversion. Appears to work well.
Cool! Thanks for looking it over. If we want to avoid some tree collisions, I could carry it in my tree? I've got some other conversions in progress. Though maybe this begs the question of "how should kunit tests be ordered in the
KconfigandMakefile?" so that collisions are obvious about how to order...
No problem:
Please use a lowercase "convert" in the commit subject, like the other siphash commits.
Jason
Quoted 15 lines · Kees Cook
Convert the siphash self-test to KUnit so it will be included in "all KUnit tests" coverage, and can be run individually still:
$ ./tools/testing/kunit/kunit.py run siphash ... [02:58:45] Starting KUnit Kernel (1/1)... [02:58:45] ============================================================ [02:58:45] =================== siphash (1 subtest) ==================== [02:58:45] [PASSED] siphash_test [02:58:45] ===================== [PASSED] siphash ===================== [02:58:45] ============================================================ [02:58:45] Testing complete. Ran 1 tests: passed: 1 [02:58:45] Elapsed time: 21.421s total, 4.306s configuring, 16.947s building, 0.148s running
Quoted 4 lines
Cc "Jason A. Donenfeld" <[email protected]>Cc David Gow <[email protected]>Signed-off-by Kees Cook <[email protected]>---
Works fine here, and looks good from a KUnit point-of-view.
Cheers,
-- David