lib/kunit/Kconfig | 24 ++++++++++++++++++++++++ rust/macros/kunit.rs | 21 +++++++++++++++++++++ 2 files changed, 45 insertions(+)
Add configs that enable extra assertions to be emitted to KUnit test
cases. This makes a subset of concurrency related warnings fail unit test
cases, and not stay as silent warnings.
Signed-off-by: Malte Wechter <maltewechter@gmail.com>
---
Malte Wechter (2):
rust: kunit: add config to fail kunit tests if a lockdep warning is triggered
rust: kunit: add config to fail kunit if TAINT_WARN is set
lib/kunit/Kconfig | 24 ++++++++++++++++++++++++
rust/macros/kunit.rs | 21 +++++++++++++++++++++
2 files changed, 45 insertions(+)
---
base-commit: 8cdeaa50eae8dad34885515f62559ee83e7e8dda
change-id: 20260812-lockdep-kunit-9628f4bcad90
Best regards,
--
Malte Wechter <maltewechter@gmail.com>
Le 18/08/2026 à 23:20, Malte Wechter a écrit : > Add configs that enable extra assertions to be emitted to KUnit test > cases. This makes a subset of concurrency related warnings fail unit test > cases, and not stay as silent warnings. > > Signed-off-by: Malte Wechter <maltewechter@gmail.com> > --- Hi Malte, Thanks for sending these in: I think they're worthwhile additions to KUnit. My preference, however, would be to have these features added to the core KUnit implementation (in C), rather than specifically to the Rust bindings. This way, tests written in both languages will be able to benefit from them, rather than just tests written in Rust. The other option, which may be better, is to have the warning and/or lockdep code fail the current test. This would have some slightly different tradeoffs (for example, it would only trigger if the test thread caused the issue), but would make it easier to integrate with warning suppression[1], which allows tests to deliberately trigger and expect warnings: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=85347718ab0dd7ede9c3e1dcff2d604c7073df05 In that case, you'd want to look into the kunit_fail_current_test() macro. KASAN also has a similar integration, so that KASAN failures will fail tests: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=c8c7016f50c85688d71feea2dba1bd955d5f5358 Cheers, -- David > Malte Wechter (2): > rust: kunit: add config to fail kunit tests if a lockdep warning is triggered > rust: kunit: add config to fail kunit if TAINT_WARN is set > > lib/kunit/Kconfig | 24 ++++++++++++++++++++++++ > rust/macros/kunit.rs | 21 +++++++++++++++++++++ > 2 files changed, 45 insertions(+) > --- > base-commit: 8cdeaa50eae8dad34885515f62559ee83e7e8dda > change-id: 20260812-lockdep-kunit-9628f4bcad90 > > Best regards, > -- > Malte Wechter <maltewechter@gmail.com> >
On Fri, Aug 21, 2026 at 11:01 AM David Gow <david@davidgow.net> wrote: > > My preference, however, would be to have these features added to the > core KUnit implementation (in C), rather than specifically to the Rust > bindings. This way, tests written in both languages will be able to > benefit from them, rather than just tests written in Rust. Agreed, I was about to reply with that, i.e. if this is a feature that is worth having, then it sounded to me like it should be in core KUnit. Cheers, Miguel
Den fre. 21. aug. 2026 kl. 11.04 skrev Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>: > > On Fri, Aug 21, 2026 at 11:01 AM David Gow <david@davidgow.net> wrote: > > > > My preference, however, would be to have these features added to the > > core KUnit implementation (in C), rather than specifically to the Rust > > bindings. This way, tests written in both languages will be able to > > benefit from them, rather than just tests written in Rust. > > Agreed, I was about to reply with that, i.e. if this is a feature that > is worth having, then it sounded to me like it should be in core > KUnit. > > Cheers, > Miguel Sounds good, i will look at implementing this in core KUnit instead. Best regards
© 2016 - 2026 Red Hat, Inc.