lib/list-test: add a test for the 'list' doubly linked list

Add a KUnit test for the kernel doubly linked list implementation in

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

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

Ignoring spurious errors related to its handling of for_each
and other list macros. 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 <>
4 files changed