]> git.ipfire.org Git - thirdparty/linux.git/commit
kunit: add ability to run tests after boot using debugfs
authorRae Moar <rmoar@google.com>
Wed, 13 Dec 2023 19:44:20 +0000 (19:44 +0000)
committerShuah Khan <skhan@linuxfoundation.org>
Mon, 18 Dec 2023 20:25:49 +0000 (13:25 -0700)
commitc72a870926c2de694942aaac2b49e59ce789bb74
treeff305514a572da68cf480082dfe0167dc4bd1e40
parent6c4ea2f48de9860217ddfedee081d485dbeea7e8
kunit: add ability to run tests after boot using debugfs

Add functionality to run built-in tests after boot by writing to a
debugfs file.

Add a new debugfs file labeled "run" for each test suite to use for
this purpose.

As an example, write to the file using the following:

echo "any string" > /sys/kernel/debugfs/kunit/<testsuite>/run

This will trigger the test suite to run and will print results to the
kernel log.

To guard against running tests concurrently with this feature, add a
mutex lock around running kunit. This supports the current practice of
not allowing tests to be run concurrently on the same kernel.

This new functionality could be used to design a parameter
injection feature in the future.

Fixed up merge conflict duing rebase to Linux 6.7-rc6
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Reviewed-by: David Gow <davidgow@google.com>
Signed-off-by: Rae Moar <rmoar@google.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
lib/kunit/debugfs.c
lib/kunit/test.c