From: "Gary Guo" <gary@garyguo.net>
To: "David Gow" <david@davidgow.net>,
"Nicolás Antinori" <nico.antinori.7@gmail.com>,
"Alice Ryhl" <aliceryhl@google.com>,
"Burak Emir" <burak.emir@gmail.com>,
"Brendan Higgins" <brendan.higgins@linux.dev>,
"Miguel Ojeda" <ojeda@kernel.org>
Cc: "Alexandre Courbot" <acourbot@nvidia.com>,
"Andreas Hindborg" <a.hindborg@kernel.org>,
"Benno Lossin" <lossin@kernel.org>,
"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
"Boqun Feng" <boqun@kernel.org>,
"Brigham Campbell" <me@brighamcampbell.com>,
"Daniel Almeida" <daniel.almeida@collabora.com>,
"Danilo Krummrich" <dakr@kernel.org>,
"Gary Guo" <gary@garyguo.net>,
"Jori Koolstra" <jkoolstra@xs4all.nl>,
"Onur Özkan" <work@onurozkan.dev>,
"Rae Moar" <raemoar63@gmail.com>,
"Shuah Khan" <skhan@linuxfoundation.org>,
"Tamir Duberstein" <tamird@kernel.org>,
"Trevor Gross" <tmgross@umich.edu>,
"Yury Norov" <yury.norov@gmail.com>,
linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org,
linux-kernel-mentees@lists.linux.dev
Subject: Re: [PATCH RFC 0/3] rust: kunit: #[should_panic] and same test name with different #[cfg(...)] support
Date: Tue, 22 Sep 2026 14:35:33 +0100 [thread overview]
Message-ID: <DLLVV64UIC5E.10C9AB66BOEXV@garyguo.net> (raw)
In-Reply-To: <d20cc2b2-afeb-432c-924b-55ad00d980fe@davidgow.net>
On Tue Sep 22, 2026 at 8:56 AM BST, David Gow wrote:
> Le 16/09/2026 à 03:33, Nicolás Antinori a écrit :
>> - Is it ok to 'stringify' the configuration so it can be distinguished
>> in the report? Would you prefer something like `_case_1` `_case_2` ..
>> instead?
I also don't like the stringifcation of cfgs.
>
> I don't _like_ this: my preference would be for us to keep the same
> name, and just not emit a test_case for anything which should be
> compiled out with cfg. Unfortunately, implementing that is a bit harder
> than would be ideal: we need a way of evaluating the cfg() arguments in
> a proc macro, I think. (Ultimately, because otherwise there's no way of
> statically determining the length of the TEST_CASES array?)
This is possible with a trick. In pin-init we have a similar need, so what I do
is for
#[macro]
struct Foo {
#[cfg(a)]
bar: u32,
}
to be expanded to
#[cfg(a)]
#[macro]
struct Foo {
bar: u32
}
#[cfg(not(a))]
#[macro]
struct Foo {
}
However, for kunit I don't think that's needed. Deduplicating the names
should be sufficient?
Best,
Gary
>
> Unless you've got a good idea how to fix this, though, I'm happy to put
> up with adding the configs to the name for now. Though if there's a nice
> way to make the names shorter
> (rust_test_kunit_parse_cfg_in_kunit_test_cfg_config_rust_kunit_selftest_equals_n
> is definitely too long a test name, for instance), that'd be best.
next prev parent reply other threads:[~2026-09-22 13:35 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-15 19:33 Nicolás Antinori
2026-09-15 19:33 ` [PATCH RFC 1/3] rust: kunit: add #[should_panic] support Nicolás Antinori
2026-09-15 19:33 ` [PATCH RFC 2/3] rust: kunit: allow same test name with different #[cfg(...)] Nicolás Antinori
2026-09-15 19:33 ` [PATCH RFC 3/3] rust: bitmap: kunit: uncomment owned_bitmap_out_of_bounds panic case Nicolás Antinori
2026-09-22 7:56 ` [PATCH RFC 0/3] rust: kunit: #[should_panic] and same test name with different #[cfg(...)] support David Gow
2026-09-22 13:35 ` Gary Guo [this message]
2026-09-22 15:27 ` David Gow
2026-09-22 15:37 ` Gary Guo
2026-09-22 15:53 ` David Gow
2026-09-23 15:04 ` Nicolás Antinori
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=DLLVV64UIC5E.10C9AB66BOEXV@garyguo.net \
--to=gary@garyguo.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=burak.emir@gmail.com \
--cc=dakr@kernel.org \
--cc=daniel.almeida@collabora.com \
--cc=david@davidgow.net \
--cc=jkoolstra@xs4all.nl \
--cc=linux-kernel-mentees@lists.linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=lossin@kernel.org \
--cc=me@brighamcampbell.com \
--cc=nico.antinori.7@gmail.com \
--cc=ojeda@kernel.org \
--cc=raemoar63@gmail.com \
--cc=rust-for-linux@vger.kernel.org \
--cc=skhan@linuxfoundation.org \
--cc=tamird@kernel.org \
--cc=tmgross@umich.edu \
--cc=work@onurozkan.dev \
--cc=yury.norov@gmail.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
all inboxes | Powered by JetHome®