diff options
author | Kaibo Ma <ent3rm4n@gmail.com> | 2025-09-15 22:12:56 -0400 |
---|---|---|
committer | Shuah Khan <skhan@linuxfoundation.org> | 2025-09-16 08:26:56 -0600 |
commit | c652dc44192d96820d73a7ecd89d275ca7e4355d (patch) | |
tree | 2d657c7ed5780633c67eccbcc43f0578d8ba0d79 /rust/kernel/time.rs | |
parent | f20e264262f1e6a6e5302249e37da355d844b52b (diff) |
rust: kunit: allow `cfg` on `test`s
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>
Diffstat (limited to 'rust/kernel/time.rs')
0 files changed, 0 insertions, 0 deletions