path: root/lib/kunit/executor.c
Commit message (Collapse)AuthorAgeFilesLines
* kunit: add kunit.filter_glob cmdline option to filter suitesDaniel Latypov2021-02-081-9/+84
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | E.g. specifying this would run suites with "list" in their name. kunit.filter_glob=list* Note: the executor prints out a TAP header that includes the number of suites we intend to run. So unless we want to report empty results for filtered-out suites, we need to do the filtering here in the executor. It's also probably better in the executor since we most likely don't want any filtering to apply to tests built as modules. This code does add a CONFIG_GLOB=y dependency for CONFIG_KUNIT=y. But the code seems light enough that it shouldn't be an issue. For now, we only filter on suite names so we don't have to create copies of the suites themselves, just the array (of arrays) holding them. The name is rather generic since in the future, we could consider extending it to a syntax like: kunit.filter_glob=<suite_glob>.<test_glob> E.g. to run all the del list tests kunit.filter_glob=list-kunit-test.*del* But at the moment, it's far easier to manually comment out test cases in test files as opposed to messing with sets of Kconfig entries to select specific suites. So even just doing this makes using kunit far less annoying. Signed-off-by: Daniel Latypov <> Reviewed-by: Brendan Higgins <> Signed-off-by: Shuah Khan <>
* kunit: test: add test plan to KUnit TAP formatBrendan Higgins2020-10-091-0/+17
| | | | | | | | | | | | | TAP 14 allows an optional test plan to be emitted before the start of the start of testing[1]; this is valuable because it makes it possible for a test harness to detect whether the number of tests run matches the number of tests expected to be run, ensuring that no tests silently failed. Link[1]: Signed-off-by: Brendan Higgins <> Reviewed-by: Stephen Boyd <> Signed-off-by: Shuah Khan <>
* init: main: add KUnit to kernel initBrendan Higgins2020-10-091-3/+1
| | | | | | | | | | | | | | | | Although we have not seen any actual examples where KUnit doesn't work because it runs in the late init phase of the kernel, it has been a concern for some time that this could potentially be an issue in the future. So, remove KUnit from init calls entirely, instead call directly from kernel_init() so that KUnit runs after late init. Co-developed-by: Alan Maguire <> Signed-off-by: Alan Maguire <> Signed-off-by: Brendan Higgins <> Reviewed-by: Stephen Boyd <> Reviewed-by: Kees Cook <> Reviewed-by: Luis Chamberlain <> Signed-off-by: Shuah Khan <>
* kunit: test: create a single centralized executor for all testsAlan Maguire2020-10-091-0/+28
Add a centralized executor to dispatch tests rather than relying on late_initcall to schedule each test suite separately. Centralized execution is for built-in tests only; modules will execute tests when loaded. Signed-off-by: Alan Maguire <> Co-developed-by: Iurii Zaikin <> Signed-off-by: Iurii Zaikin <> Co-developed-by: Brendan Higgins <> Signed-off-by: Brendan Higgins <> Reviewed-by: Stephen Boyd <> Reviewed-by: Kees Cook <> Signed-off-by: Shuah Khan <>