public inbox for driver-core@lists.linux.dev
 help / color / mirror / Atom feed
From: Yury Norov <ynorov@nvidia.com>
To: Alice Ryhl <aliceryhl@google.com>
Cc: "Alexandre Courbot" <acourbot@nvidia.com>,
	"Joel Fernandes" <joelagnelf@nvidia.com>,
	"Yury Norov" <yury.norov@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>,
	"Trevor Gross" <tmgross@umich.edu>,
	"Danilo Krummrich" <dakr@kernel.org>,
	"Daniel Almeida" <daniel.almeida@collabora.com>,
	"David Airlie" <airlied@gmail.com>,
	"Simona Vetter" <simona@ffwll.ch>,
	"John Hubbard" <jhubbard@nvidia.com>,
	"Alistair Popple" <apopple@nvidia.com>,
	"Timur Tabi" <ttabi@nvidia.com>, "Zhi Wang" <zhiw@nvidia.com>,
	"Eliot Courtney" <ecourtney@nvidia.com>,
	linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org,
	driver-core@lists.linux.dev, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v2 2/3] rust: bitfield: Add KUNIT tests for bitfield
Date: Thu, 16 Apr 2026 08:48:41 -0400	[thread overview]
Message-ID: <aeDaqc5q9ki1KBXP@yury> (raw)
In-Reply-To: <aeCI4giN1TEL_uJn@google.com>

On Thu, Apr 16, 2026 at 06:59:46AM +0000, Alice Ryhl wrote:
> On Wed, Apr 15, 2026 at 10:44:01PM -0400, Yury Norov wrote:
> > On Thu, Apr 09, 2026 at 11:58:48PM +0900, Alexandre Courbot wrote:
> > > From: Joel Fernandes <joelagnelf@nvidia.com>
> > > 
> > > Add KUNIT tests to make sure the macro is working correctly.
> > > 
> > > Signed-off-by: Joel Fernandes <joelagnelf@nvidia.com>
> > > [acourbot: update code to latest bitfield! macro.]
> > > Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
> > > ---
> > >  rust/kernel/bitfield.rs | 318 ++++++++++++++++++++++++++++++++++++++++++++++++
> > >  1 file changed, 318 insertions(+)
> > > 
> > > diff --git a/rust/kernel/bitfield.rs b/rust/kernel/bitfield.rs
> > > index f5948eec8a76..9ab8dafff36c 100644
> > > --- a/rust/kernel/bitfield.rs
> > > +++ b/rust/kernel/bitfield.rs
> > > @@ -489,3 +489,321 @@ fn fmt(&self, f: &mut ::kernel::fmt::Formatter<'_>) -> ::kernel::fmt::Result {
> > >          }
> > >      };
> > >  }
> > > +
> > > +#[::kernel::macros::kunit_tests(kernel_bitfield)]
> > 
> > Reading the Documentation/rust/testing.rst, and can't understand how
> > should one configure it to _not_ build the tests? This should be the
> > default behavior.
> > 
> > There's half a dozen already existing unit tests, and I didn't find
> > a mechanism to individually control them.
> 
> If you want this set of kunit tests to have its own config option, then
> you can declare a Kconfig option for it and do this:
> 
> #[cfg(CONFIG_MY_RUST_KCONFIG_OPTION)]
> #[kunit_tests(kernel_bitfield)]
> mod tests {
>     ...
> }

Thanks, Alce!

I suspected that, but you never know all the rust tricks. :)

Joel, can you do as suggested here, and I can send a patch for the
existing tests, if no objections?

Thanks,
Yury

  reply	other threads:[~2026-04-16 12:48 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-09 14:58 [PATCH v2 0/3] rust: add `bitfield!` macro Alexandre Courbot
2026-04-09 14:58 ` [PATCH v2 1/3] rust: extract `bitfield!` macro from `register!` Alexandre Courbot
2026-04-13  2:29   ` Eliot Courtney
2026-04-15 23:18     ` John Hubbard
2026-04-16  1:35   ` Yury Norov
2026-04-09 14:58 ` [PATCH v2 2/3] rust: bitfield: Add KUNIT tests for bitfield Alexandre Courbot
2026-04-13  2:28   ` Eliot Courtney
2026-04-16  2:44   ` Yury Norov
2026-04-16  6:59     ` Alice Ryhl
2026-04-16 12:48       ` Yury Norov [this message]
2026-04-09 14:58 ` [PATCH v2 3/3] gpu: nova-core: switch to kernel bitfield macro Alexandre Courbot
2026-04-13  2:01   ` Eliot Courtney
2026-04-15 23:20   ` John Hubbard
2026-04-15 23:22 ` [PATCH v2 0/3] rust: add `bitfield!` macro John Hubbard
2026-04-16  1:08   ` Eliot Courtney
2026-04-16 22:18   ` Danilo Krummrich
2026-04-16 22:43     ` John Hubbard
2026-04-17  1:33     ` Alexandre Courbot
2026-04-17  3:11       ` Alexandre Courbot
2026-04-17  3:19         ` John Hubbard
2026-04-17  3:57           ` Alexandre Courbot
2026-04-17  4:15             ` John Hubbard
2026-04-17  5:55     ` Miguel Ojeda
2026-04-17 10:59       ` Mark Brown
2026-04-17 12:30         ` Danilo Krummrich
2026-04-17 12:00       ` Danilo Krummrich
2026-04-17 12:21         ` Miguel Ojeda
2026-04-17 14:59           ` Danilo Krummrich

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=aeDaqc5q9ki1KBXP@yury \
    --to=ynorov@nvidia.com \
    --cc=a.hindborg@kernel.org \
    --cc=acourbot@nvidia.com \
    --cc=airlied@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=apopple@nvidia.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun@kernel.org \
    --cc=dakr@kernel.org \
    --cc=daniel.almeida@collabora.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=driver-core@lists.linux.dev \
    --cc=ecourtney@nvidia.com \
    --cc=gary@garyguo.net \
    --cc=jhubbard@nvidia.com \
    --cc=joelagnelf@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lossin@kernel.org \
    --cc=ojeda@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=simona@ffwll.ch \
    --cc=tmgross@umich.edu \
    --cc=ttabi@nvidia.com \
    --cc=yury.norov@gmail.com \
    --cc=zhiw@nvidia.com \
    /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