kunit: Add support for skipping entire test suites
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v4 Latest2 patches 0 repliesNew
- v33 patches 3 repliesSuperseded
- v22 patches 0 repliesSuperseded
Earlier versions · 1
| Version | Posted | Patches | Replies | Status |
|---|---|---|---|---|
| v1 | 2 patches | 4 replies | Superseded |
Changelog from the cover letter
==========
Previous version:
https://lore.kernel.org/all/[email protected]
* Merged the KUnit rust binding updates to Patch-1
Patches in v4 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/2 | kunit,rust: Add ability to skip entire test suitesinclude/ lib/ lib/ +1 more | +39 | 0 replies | |
| 2/2 | kunit: Add example of test suite that can be skipped at runtimelib/ | +29 | 0 replies |
Reviews trailers per patch
All 2 patches have a Reviewed-by or Acked-by.
| Patch | David Gow |
|---|---|
| 1/2 | R-b |
| 2/2 | R-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH v4 0/2] kunit: Add support for skipping entire test suites
Changelog:
==========
Previous version:
https://lore.kernel.org/all/[email protected]
* Merged the KUnit rust binding updates to Patch-1
Summary of changes
==================
This patch series introduces the ability to skip entire 'kunit_suite' based on runtime conditions, addressing a limitation where test suites could only skip individual test cases or fail when prerequisites were not met.
The motivation for this feature comes from test suites that depend on specific hardware features, kernel capabilities, or runtime conditions. Currently, such suites must either:
* Fail when prerequisites are missing
* Skip each test case individually with redundant checks
* Implement workarounds to avoid running tests
An example of such a requirement came from [1] where the patch author wanted to skip the entire 'kunit_suite' but then had to resort marking all struct 'kunit_case' as skipped by accessing 'kunit_case.status' private struct member. This usecase being addressed in the patch[1] can be better implemented with the changes proposed in this patch series.
Structure of the patch series
=============================
PATCH 1:
* Add a 'status' field to struct kunit_suite that allows 'suite_init' callbacks to mark the entire suite as KUNIT_SKIPPED.
* Modify the KUnit core to check this newly introduced 'status' field and bypass all test cases when a suite is marked as skipped.
* Update debugfs_print_results() to emmit correct logs for skipped 'kunit-suite'
* Init 'kunit_suite.status' to KUNIT_SUCCESS so that kunit_suite can be re-run from debugfs
* Update KUnit Rust binding macro-rule 'kunit_unsafe_test_suite' to include and initialize the newly introduced 'kunit_suite.status'
Patch 3:
* Providing an example in kunit-example-test.c demonstrating the usage pattern.
The implementation is minimal and non-intrusive, adding only a status field to kunit_suite and checks in two key functions. Test suites that don't use this proposed feature should be unaffected.
References
==========
[1]
https://lore.kernel.org/all/[email protected]
Vaibhav Jain (2):
kunit,rust: Add ability to skip entire test suites
kunit: Add example of test suite that can be skipped at runtime
include/kunit/test.h | 1 + lib/kunit/debugfs.c | 30 +++++++++++++++++++++--------- lib/kunit/kunit-example-test.c | 29 +++++++++++++++++++++++++++++ lib/kunit/test.c | 17 ++++++++++++++++- rust/kernel/kunit.rs | 1 + 5 files changed, 68 insertions(+), 10 deletions(-)
Signature · 1 line
2.54.0