From ea2dd7c0875ed31955cda7b1b20612c8337192e5 Mon Sep 17 00:00:00 2001 From: David Gow Date: Thu, 24 Oct 2019 15:46:31 -0700 Subject: 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). Ignoring checkpatch.pl spurious errors related to its handling of for_each and other list macros. checkpatch.pl expects anything with for_each in its name to be a loop and expects that the open brace is placed on the same line as for a for loop. In this case, test case naming scheme includes name of the macro it is testing, which results in the spurious errors. Commit message updated by Shuah Khan Signed-off-by: David Gow Reviewed-by: Brendan Higgins Tested-by: Brendan Higgins Signed-off-by: Shuah Khan --- lib/Makefile | 3 +++ 1 file changed, 3 insertions(+) (limited to 'lib/Makefile') diff --git a/lib/Makefile b/lib/Makefile index bba1fd5485f7..890e581d00c4 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -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 -- cgit v1.2.3