On Tue, 16 Sept 2025 at 10:13, Kaibo Ma <[email protected]> wrote:
>
> The `kunit_test` proc macro only checks for the `test` attribute
> immediately preceding a `fn`. If the function is disabled via a `cfg`,
> the generated code would result in a compile error referencing a
> non-existent function [1].
>
> This collects attributes and specifically cherry-picks `cfg` attributes
> to be duplicated inside KUnit wrapper functions such that a test function
> disabled via `cfg` compiles and is marked as skipped in KUnit correctly.
>
> Link: 
> https://lore.kernel.org/rust-for-linux/CANiq72==48=69hYiDo1321pCzgn_n1_jg=ez5uyxx91c+g5...@mail.gmail.com/
>  [1]
> Closes: https://github.com/Rust-for-Linux/linux/issues/1185
> Suggested-by: Miguel Ojeda <[email protected]>
> Suggested-by: David Gow <[email protected]>
> Signed-off-by: Kaibo Ma <[email protected]>
> ---
> v1 -> v2: applied suggestion such that cfg'd out tests show as skipped on 
> KUnit
>

Thanks: this looks good to me now. I'd still love for there to be a
way to totally remove tests which are disabled, but I suspect it's
best to avoid adding the complexity involved in handling that until we
actually need it. (Maybe never!)

So this is:
Reviewed-by: David Gow <[email protected]>

Thanks,
-- David

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to