Open musamaanjum opened 1 month ago
I've found an effort by Kees Cook where he has been converting such self-tests into kunit tests. This seems like the general direction for all kselftest test modules. I'll start a discussion thread.
Started discussion upstream: https://lore.kernel.org/all/327831fb-47ab-4555-8f0b-19a8dbcaacd7@collabora.com
Kees and David Gow agree that several of test modules are more suitable to run as kunit. Jhon Hubbard also jumped in and mentioned more such modules.
I'm pausing work on this ticket. I convert lib suite into kunit and so on. Once we convert several such test modules into kunit, we can come back to this ticket of improving the output of remaining modules.
We discussed that all kernel testing modules should use a standard way to report results. The log messages should be informative at the same time. Initially, we need to see which kind of logs are being outputted by the current models. Based on this, better improvements should be suggested.
Non-exhaustive list of test suites using test modules:
The kselftest only loads and unloads the module. It doesn't check the status of executed tests to decide if test passed or failed.
These tests can be divided into 2 categories of their dependence:
tools/testing/selftests/kselftest_module.h
andtools/testing/selftests/kselftest/module.sh
provide a standard way to write a test module which can be loaded from kselftest. These modules are found in thelib/
. One such example islib
test suite. It 5 tests. Each test just loads the test module and exits successfully. It doesn't check the status of the modules if the module test got passed or failed. Every test module has a separate config option to turn on and off.lkdtm
suite is one example. Its module is found in thedrivers/lkdtm
.