Files
linux/rust/kernel
Kaibo Ma 9f1229c8f1 rust: kunit: allow cfg on tests
[ Upstream commit c652dc4419 ]

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/r/20250916021259.115578-1-ent3rm4n@gmail.com
Link: https://lore.kernel.org/rust-for-linux/CANiq72==48=69hYiDo1321pCzgn_n1_jg=ez5UYXX91c+g5JVQ@mail.gmail.com/ [1]
Closes: https://github.com/Rust-for-Linux/linux/issues/1185
Suggested-by: Miguel Ojeda <ojeda@kernel.org>
Suggested-by: David Gow <davidgow@google.com>
Signed-off-by: Kaibo Ma <ent3rm4n@gmail.com>
Reviewed-by: David Gow <davidgow@google.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2025-11-13 15:36:51 -05:00
..
2025-10-12 13:01:55 +02:00
2025-10-12 13:01:55 +02:00
2025-06-22 23:09:32 +02:00
2025-08-27 22:45:41 -07:00
2025-07-23 02:05:58 +02:00
2025-07-23 02:05:58 +02:00
2025-10-23 16:24:38 +02:00
2025-08-13 17:40:28 +02:00
2025-07-21 01:16:35 +02:00
2025-11-13 15:36:51 -05:00
2025-07-19 23:18:18 +02:00
2024-10-08 15:44:36 +02:00
2025-07-21 01:16:35 +02:00
2024-11-04 16:21:44 -05:00