2
0
mirror of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git synced 2025-09-04 20:19:47 +08:00
linux/rust/macros
José Expósito c001045289 rust: macros: add macro to easily run KUnit tests
Add a new procedural macro (`#[kunit_tests(kunit_test_suit_name)]`) to
run KUnit tests using a user-space like syntax.

The macro, that should be used on modules, transforms every `#[test]`
in a `kunit_case!` and adds a `kunit_unsafe_test_suite!` registering
all of them.

The only difference with user-space tests is that instead of using
`#[cfg(test)]`, `#[kunit_tests(kunit_test_suit_name)]` is used.

Note that `#[cfg(CONFIG_KUNIT)]` is added so the test module is not
compiled when `CONFIG_KUNIT` is set to `n`.

Reviewed-by: David Gow <davidgow@google.com>
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Co-developed-by: Boqun Feng <boqun.feng@gmail.com>
Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
Co-developed-by: Miguel Ojeda <ojeda@kernel.org>
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
Reviewed-by: Tamir Duberstein <tamird@gmail.com>
Signed-off-by: David Gow <davidgow@google.com>
Link: https://lore.kernel.org/r/20250307090103.918788-3-davidgow@google.com
[ Removed spurious (in rendered form) newline in docs. - Miguel ]
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2025-03-20 12:26:54 +01:00
..
concat_idents.rs rust: macros: add concat_idents! proc macro 2022-12-04 01:59:04 +01:00
export.rs rust: add #[export] macro 2025-03-09 20:52:46 +01:00
helpers.rs rust: make pin-init its own crate 2025-03-16 21:59:19 +01:00
kunit.rs rust: macros: add macro to easily run KUnit tests 2025-03-20 12:26:54 +01:00
lib.rs rust: macros: add macro to easily run KUnit tests 2025-03-20 12:26:54 +01:00
module.rs rust: make pin-init its own crate 2025-03-16 21:59:19 +01:00
paste.rs rust: macros: enable paste! use from macro_rules! 2024-11-01 22:02:53 +01:00
quote.rs rust: make pin-init its own crate 2025-03-16 21:59:19 +01:00
vtable.rs rust: macros: vtable: fix HAS_* redefinition (gen_const_name) 2023-08-09 21:15:07 +02:00