lib/list-test: add a test for the 'list' doubly linked list
Subsystems (2)
PATCH v7 1/1 lib/list-test: add a test for the 'list' doubly linked list
Add a KUnit test for the kernel doubly linked list implementation in include/linux/list.h
Each test case (list_test_x) is focused on testing the behaviour of the list function/macro 'x'. None of the tests pass invalid lists to these macros, and so should behave identically with DEBUG_LIST enabled and disabled.
Note that, at present, it only tests the list_ types (not the singly-linked hlist_), and does not yet test all of the list_for_each_entry* macros (and some related things like list_prepare_entry).
---
This revision, v7, renames tests with 'for_each' in their name to have 'for__each' instead. This works around the checkpatch.pl bug Shuah mentioned, as checkpatch.pl believes that function definitions with 'for_each' in the name are actually loops, and wants the '{' on the previous line.
With this change, checkpatch is perfectly happy.
Earlier versions of this patchset can be found:
v6:
https://lore.kernel.org/linux-kselftest/[email protected]/
v5:
https://lore.kernel.org/linux-kselftest/[email protected]/
v4:
https://lore.kernel.org/linux-kselftest/[email protected]/
v3:
https://lore.kernel.org/linux-kselftest/[email protected]/
v2:
https://lore.kernel.org/linux-kselftest/[email protected]/
v1:
https://lore.kernel.org/linux-kselftest/[email protected]/
Thanks,
-- David
MAINTAINERS | 7 + lib/Kconfig.debug | 18 ++ lib/Makefile | 3 + lib/list-test.c | 746 ++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 774 insertions(+) create mode 100644 lib/list-test.c
MAINTAINERS +7 -0
@@ -9504,6 +9504,13 @@ F: Documentation/misc-devices/lis3lv02d.rst F: drivers/misc/lis3lv02d/ F: drivers/platform/x86/hp_accel.c +LIST KUNIT TEST +M: David Gow <[email protected]> +L: [email protected] +L: [email protected] +S: Maintained +F: lib/list-test.c + LIVE PATCHING M: Josh Poimboeuf <[email protected]> M: Jiri Kosina <[email protected]>
lib/Kconfig.debug +18 -0
@@ -1961,6 +1961,24 @@ config SYSCTL_KUNIT_TEST If unsure, say N. +config LIST_KUNIT_TEST + bool "KUnit Test for Kernel Linked-list structures" + depends on KUNIT + help + This builds the linked list KUnit test suite. + It tests that the API and basic functionality of the list_head type + and associated macros. + + 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 TEST_UDELAY tristate "udelay test driver" help
lib/Makefile +3 -0
@@ -292,3 +292,6 @@ obj-$(CONFIG_GENERIC_LIB_MULDI3) += muldi3.o obj-$(CONFIG_GENERIC_LIB_CMPDI2) += cmpdi2.o obj-$(CONFIG_GENERIC_LIB_UCMPDI2) += ucmpdi2.o obj-$(CONFIG_OBJAGG) += objagg.o + +# KUnit tests +obj-$(CONFIG_LIST_KUNIT_TEST) += list-test.o
lib/list-test.c new file +746 -0
746 lines not on this page · raw message
Signature · 1 line
2.24.0.rc0.303.g954a862665-goog