OSDN Git Service

Fix linked-list KUnit test when run multiple times
authorDavid Gow <davidgow@google.com>
Fri, 24 Jan 2020 19:45:08 +0000 (11:45 -0800)
committerShuah Khan <skhan@linuxfoundation.org>
Wed, 25 Mar 2020 22:38:39 +0000 (16:38 -0600)
commitcb88577bb6b27f8f5b3d61b1006c1ff7709916be
treee96d7f2b9760f37a8f6de6579888d36c3d0d791a
parent97752c39bdaeea990260d3111250f6c861519808
Fix linked-list KUnit test when run multiple times

A few of the lists used in the linked-list KUnit tests (the
for_each_entry{,_reverse} tests) are declared 'static', and so are
not-reinitialised if the test runs multiple times. This was not a
problem when KUnit tests were run once on startup, but when tests are
able to be run manually (e.g. from debugfs[1]), this is no longer the
case.

Making these lists no longer 'static' causes the lists to be
reinitialised, and the test passes each time it is run. While there may
be some value in testing that initialising static lists works, the
for_each_entry_* tests are unlikely to be the right place for it.

Signed-off-by: David Gow <davidgow@google.com>
Reviewed-by: Brendan Higgins <brendanhiggins@google.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
lib/list-test.c