lib: kunit: add list_sort test conversion to KUnit
Subsystems (2)
PATCH 1/1 lib: kunit: add list_sort test conversion to KUnit
This adds the conversion of the runtime tests of test_list_sort, from lib/test_list_sort.c to KUnit tests.
Please apply this commit first (linux-kselftest/kunit-fixes):3f37d14b8a3152441f36b6bc74000996679f0998 kunit: kunit_config: Fix parsing of CONFIG options with space
Code Style Documentation: [0]
---
lib/Kconfig.debug | 29 +++++---
lib/Makefile | 2 +-
lib/{test_list_sort.c => list_sort_kunit.c} | 73 +++++++++++----------
3 files changed, 58 insertions(+), 46 deletions(-)
rename lib/{test_list_sort.c => list_sort_kunit.c} (62%)lib/Kconfig.debug +19 -10
@@ -1854,16 +1854,6 @@ config LKDTM Documentation on how to use the module can be found in Documentation/fault-injection/provoke-crashes.rst -config TEST_LIST_SORT - tristate "Linked list sorting test" - depends on DEBUG_KERNEL || m - help - Enable this to turn on 'list_sort()' function test. This test is - executed only once during system boot (so affects only boot time), - or at module load time. - - If unsure, say N. - config TEST_MIN_HEAP tristate "Min heap test" depends on DEBUG_KERNEL || m
@@ -2173,6 +2163,25 @@ config LIST_KUNIT_TEST If unsure, say N. +config LIST_SORT_KUNIT + tristate "KUnit Linked list sorting test" + depends on KUNIT + depends on DEBUG_KERNEL || m + help + Enable this to turn on 'list_sort()' function test. This test is + executed only once during system boot (so affects only boot time), + or at module load time. + + KUnit tests run during boot and output the results to the debug log + in TAP format (http://testanything.org/). Only useful for kernel devs + running the KUnit test harness, and not intended for inclusion into a + production build. + + 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 LINEAR_RANGES_TEST tristate "KUnit test for linear_ranges" depends on KUNIT
lib/Makefile +1 -1
@@ -71,7 +71,6 @@ obj-$(CONFIG_TEST_UBSAN) += test_ubsan.o CFLAGS_test_ubsan.o += $(call cc-disable-warning, vla) UBSAN_SANITIZE_test_ubsan.o := y obj-$(CONFIG_TEST_KSTRTOX) += test-kstrtox.o -obj-$(CONFIG_TEST_LIST_SORT) += test_list_sort.o obj-$(CONFIG_TEST_MIN_HEAP) += test_min_heap.o obj-$(CONFIG_TEST_LKM) += test_module.o obj-$(CONFIG_TEST_VMALLOC) += test_vmalloc.o
@@ -317,4 +316,5 @@ obj-$(CONFIG_OBJAGG) += objagg.o # KUnit tests obj-$(CONFIG_LIST_KUNIT_TEST) += list-test.o +obj-$(CONFIG_LIST_SORT_KUNIT) += list_sort_kunit.o obj-$(CONFIG_LINEAR_RANGES_TEST) += test_linear_ranges.o
lib/list_sort_kunit.c renamed from lib/test_list_sort.c +38 -35
161 lines not on this page · raw message
base-commit: d43c7fb05765152d4d4a39a8ef957c4ea14d8847
Signature · 1 line
2.26.2
Quoted 11 lines · Vitor Massaru Iha
This adds the conversion of the runtime tests of
test_list_sort, fromlib/test_list_sort.cto KUnit tests.Please apply this commit first (linux-kselftest/kunit-fixes):
3f37d14b8a3152441f36b6bc74000996679f0998kunit:kunit_config: Fix parsing of CONFIG options with spaceCode Style Documentation: [0]
It would still be good to get some of the original authors/reviewers to review this.
Quoted 39 lines · Vitor Massaru Iha
This adds the conversion of the runtime tests of
test_list_sort, fromlib/test_list_sort.cto KUnit tests.Please apply this commit first (linux-kselftest/kunit-fixes):
3f37d14b8a3152441f36b6bc74000996679f0998kunit:kunit_config: Fix parsing of CONFIG options with spaceCode Style Documentation: [0]
Signed-off-by Vitor Massaru Iha <[email protected]>--- lib/Kconfig.debug | 29 +++++--- lib/Makefile | 2 +- lib/{test_list_sort.c => list_sort_kunit.c} | 73 +++++++++++---------- 3 files changed, 58 insertions(+), 46 deletions(-) rename lib/{test_list_sort.c => list_sort_kunit.c} (62%)lib/Kconfig.debug +0
-10@@ -1854,16 +1854,6 @@ config LKDTM Documentation on how to use the module can be found in Documentation/fault-injection/provoke-crashes.rst -config TEST_LIST_SORT - tristate "Linked list sorting test" - depends on DEBUG_KERNEL || m - help - Enable this to turn on 'list_sort()' function test. This test is - executed only once during system boot (so affects only boot time), - or at module load time. - - If unsure, say N. - config TEST_MIN_HEAP tristate "Min heap test" depends on DEBUG_KERNEL || m
lib/Kconfig.debug config LIST_KUNIT_TEST · line 2169
Quoted 7 lines
lib/Kconfig.debug +4
-0@@ -2173,6 +2163,25 @@ config LIST_KUNIT_TEST If unsure, say N. +config LIST_SORT_KUNIT + tristate "KUnit Linked list sorting test" + depends on KUNIT + depends on DEBUG_KERNEL || m
I think the style [0] you linked suggests '*_KUNIT_TEST' for config variables.
Only noticed this because I was doing a
git grep 'config.*TEST'
to find tests in the kernel + new tests floating on the LKML.
Apologies for picking this patch to comment on, but if it's still changeable it might be worth adjusting.
lib/Kconfig.debug config LIST_KUNIT_TEST · line 2178
Quoted 9 lines
lib/Kconfig.debug +9
-0+ help + Enable this to turn on 'list_sort()' function test. This test is + executed only once during system boot (so affects only boot time), + or at module load time. + + KUnit tests run during boot and output the results to the debug log + in TAP format (http://testanything.org/). Only useful for kernel devs + running the KUnit test harness, and not intended for inclusion into a + production build.
Not a big deal, but I'm not sure if summarizing KUnit here is useful. You already link to the documentation below.
lib/Kconfig.debug config LIST_KUNIT_TEST · line 2181
Quoted 2 lines
lib/Kconfig.debug +2
-0+ For more information on KUnit and unit tests in general please refer + to the KUnit documentation in Documentation/dev-tools/kunit/.
...
Thanks,
-- Marco
_______________________________________________
Linux-kernel-mentees mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees
Quoted 52 lines · Marco Elver
Quoted 39 lines · Vitor Massaru Iha
This adds the conversion of the runtime tests of
test_list_sort, fromlib/test_list_sort.cto KUnit tests.Please apply this commit first (linux-kselftest/kunit-fixes):
3f37d14b8a3152441f36b6bc74000996679f0998kunit:kunit_config: Fix parsing of CONFIG options with spaceCode Style Documentation: [0]
Signed-off-by Vitor Massaru Iha <[email protected]>--- lib/Kconfig.debug | 29 +++++--- lib/Makefile | 2 +- lib/{test_list_sort.c => list_sort_kunit.c} | 73 +++++++++++---------- 3 files changed, 58 insertions(+), 46 deletions(-) rename lib/{test_list_sort.c => list_sort_kunit.c} (62%)lib/Kconfig.debug +0
-10@@ -1854,16 +1854,6 @@ config LKDTM Documentation on how to use the module can be found in Documentation/fault-injection/provoke-crashes.rst -config TEST_LIST_SORT - tristate "Linked list sorting test" - depends on DEBUG_KERNEL || m - help - Enable this to turn on 'list_sort()' function test. This test is - executed only once during system boot (so affects only boot time), - or at module load time. - - If unsure, say N. - config TEST_MIN_HEAP tristate "Min heap test" depends on DEBUG_KERNEL || mlib/Kconfig.debug config LIST_KUNIT_TEST · line 2169
Quoted 7 lines
lib/Kconfig.debug +4
-0@@ -2173,6 +2163,25 @@ config LIST_KUNIT_TEST If unsure, say N. +config LIST_SORT_KUNIT + tristate "KUnit Linked list sorting test" + depends on KUNIT + depends on DEBUG_KERNEL || mI think the style [0] you linked suggests '
*_KUNIT_TEST' for config variables.
Quoted 5 lines
Only noticed this because I was doing a
git grep 'config.*TEST'
to find tests in the kernel + new tests floating on the LKML.
Thanks, I'll fix it.
Quoted 3 lines
Apologies for picking this patch to comment on, but if it's still changeable it might be worth adjusting.
No problem.
Quoted 10 lines
lib/Kconfig.debug config LIST_KUNIT_TEST · line 2178
Quoted 9 lines
lib/Kconfig.debug +9
-0+ help + Enable this to turn on 'list_sort()' function test. This test is + executed only once during system boot (so affects only boot time), + or at module load time. + + KUnit tests run during boot and output the results to the debug log + in TAP format (http://testanything.org/). Only useful for kernel devs + running the KUnit test harness, and not intended for inclusion into a + production build.
Quoted 2 lines
Not a big deal, but I'm not sure if summarizing KUnit here is useful. You already link to the documentation below.
Sure, I'll remove this.
Quoted 6 lines
lib/Kconfig.debug config LIST_KUNIT_TEST · line 2181
Quoted 2 lines
lib/Kconfig.debug +2
-0+ For more information on KUnit and unit tests in general please refer + to the KUnit documentation in Documentation/dev-tools/kunit/....
Thanks,
-- Marco
Thanks for the review.
_______________________________________________
Linux-kernel-mentees mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees