Rust for Linux List
 help / color / mirror / Atom feed
From: David Gow <david@davidgow.net>
To: "Malte Wechter" <maltewechter@gmail.com>,
	"Brendan Higgins" <brendan.higgins@linux.dev>,
	"Rae Moar" <raemoar63@gmail.com>,
	"Miguel Ojeda" <ojeda@kernel.org>,
	"Boqun Feng" <boqun@kernel.org>, "Gary Guo" <gary@garyguo.net>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Benno Lossin" <lossin@kernel.org>,
	"Andreas Hindborg" <a.hindborg@kernel.org>,
	"Alice Ryhl" <aliceryhl@google.com>,
	"Trevor Gross" <tmgross@umich.edu>,
	"Danilo Krummrich" <dakr@kernel.org>,
	"Daniel Almeida" <daniel.almeida@collabora.com>,
	"Tamir Duberstein" <tamird@kernel.org>,
	"Alexandre Courbot" <acourbot@nvidia.com>,
	"Onur Özkan" <work@onurozkan.dev>
Cc: linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com,
	linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org
Subject: Re: [PATCH 0/2] rust: kunit: add optional assertions to catch taint and lockdep warnings
Date: Fri, 21 Aug 2026 17:01:47 +0800	[thread overview]
Message-ID: <09b0ce81-0071-4df3-9f0e-a54269d04c97@davidgow.net> (raw)
In-Reply-To: <20260818-lockdep-kunit-v1-0-66ceb1a272e3@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>
> 


  parent reply	other threads:[~2026-08-21  9:02 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-18 15:20 [PATCH 0/2] rust: kunit: add optional assertions to catch taint and lockdep warnings Malte Wechter
2026-08-18 15:20 ` [PATCH 1/2] rust: kunit: add config to fail kunit tests if a lockdep warning is triggered Malte Wechter
2026-08-21  8:40   ` Andreas Hindborg
2026-08-18 15:20 ` [PATCH 2/2] rust: kunit: add config to fail kunit if TAINT_WARN is set Malte Wechter
2026-08-21  9:01 ` David Gow [this message]
2026-08-21  9:03   ` [PATCH 0/2] rust: kunit: add optional assertions to catch taint and lockdep warnings Miguel Ojeda
2026-08-21 10:18     ` Malte Wechter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=09b0ce81-0071-4df3-9f0e-a54269d04c97@davidgow.net \
    --to=david@davidgow.net \
    --cc=a.hindborg@kernel.org \
    --cc=acourbot@nvidia.com \
    --cc=aliceryhl@google.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun@kernel.org \
    --cc=brendan.higgins@linux.dev \
    --cc=dakr@kernel.org \
    --cc=daniel.almeida@collabora.com \
    --cc=gary@garyguo.net \
    --cc=kunit-dev@googlegroups.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=lossin@kernel.org \
    --cc=maltewechter@gmail.com \
    --cc=ojeda@kernel.org \
    --cc=raemoar63@gmail.com \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=tamird@kernel.org \
    --cc=tmgross@umich.edu \
    --cc=work@onurozkan.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox