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/kernel
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
..
alloc rust: make pin-init its own crate 2025-03-16 21:59:19 +01:00
block rust: make pin-init its own crate 2025-03-16 21:59:19 +01:00
fs rust: improve lifetimes markup 2025-03-08 23:04:38 +01:00
list rust: use derive(CoercePointee) on rustc >= 1.84.0 2025-01-13 23:45:30 +01:00
net rust: module: introduce authors key 2025-03-10 15:12:17 +01:00
sync rust: make pin-init its own crate 2025-03-16 21:59:19 +01:00
.gitignore rust: jump_label: skip formatting generated file 2024-11-20 13:32:42 -05:00
alloc.rs rust: use derive(CoercePointee) on rustc >= 1.84.0 2025-01-13 23:45:30 +01:00
block.rs rust: block: introduce kernel::block::mq module 2024-06-14 07:45:04 -06:00
build_assert.rs rust: add build_error! to the prelude 2025-01-10 00:19:09 +01:00
cred.rs rust: file: add Kuid wrapper 2024-09-30 13:02:29 +02:00
device_id.rs rust: implement IdArray, IdTable and RawDeviceId 2024-12-20 17:19:25 +01:00
device.rs Driver core and debugfs updates 2025-01-28 12:25:12 -08:00
devres.rs rust: devres: remove action in Devres::drop 2025-01-10 15:49:06 +01:00
driver.rs rust: make pin-init its own crate 2025-03-16 21:59:19 +01:00
error.rs rust: error: extend the Result documentation 2025-03-16 20:54:08 +01:00
faux.rs rust/kernel: Add faux device bindings 2025-02-13 16:58:58 +01:00
firmware.rs rust: map long to isize and char to u8 2024-12-16 21:49:33 +01:00
fs.rs rust: file: add Rust abstraction for struct file 2024-09-30 13:02:28 +02:00
generated_arch_static_branch_asm.rs.S rust: jump_label: skip formatting generated file 2024-11-20 13:32:42 -05:00
init.rs rust: make pin-init its own crate 2025-03-16 21:59:19 +01:00
io.rs rust: add io::{Io, IoRaw} base types 2024-12-20 17:19:26 +01:00
ioctl.rs rust: start using the #[expect(...)] attribute 2024-10-07 21:39:57 +02:00
jump_label.rs rust: jump_label: skip formatting generated file 2024-11-20 13:32:42 -05:00
kunit.rs rust: macros: add macro to easily run KUnit tests 2025-03-20 12:26:54 +01:00
lib.rs rust: make pin-init its own crate 2025-03-16 21:59:19 +01:00
list.rs rust: make pin-init its own crate 2025-03-16 21:59:19 +01:00
miscdevice.rs Driver core and debugfs updates 2025-01-28 12:25:12 -08:00
net.rs rust: core abstractions for network PHY drivers 2023-12-15 09:35:50 +00:00
of.rs rust: of: add of::DeviceId abstraction 2024-12-20 17:21:04 +01:00
page.rs rust: page: remove unnecessary helper function from doctest 2025-01-13 23:44:55 +01:00
pci.rs rust: module: introduce authors key 2025-03-10 15:12:17 +01:00
pid_namespace.rs rust: add PidNamespace 2024-10-08 15:44:36 +02:00
platform.rs rust: module: introduce authors key 2025-03-10 15:12:17 +01:00
prelude.rs rust: make pin-init its own crate 2025-03-16 21:59:19 +01:00
print.rs print: use new #[export] macro for rust_fmt_argument 2025-03-09 20:52:46 +01:00
rbtree.rs rust: improve lifetimes markup 2025-03-08 23:04:38 +01:00
revocable.rs rust: add Revocable type 2024-12-20 17:19:26 +01:00
security.rs rust: finish using custom FFI integer types 2024-12-16 21:48:45 +01:00
seq_file.rs rust: improve lifetimes markup 2025-03-08 23:04:38 +01:00
sizes.rs rust: sizes: add commonly used constants 2024-08-30 10:27:34 +01:00
static_assert.rs rust: static_assert: add static_assert! macro 2022-12-04 01:59:16 +01:00
std_vendor.rs rust: std_vendor: update dbg macro from Rust upstream 2024-10-10 00:33:42 +02:00
str.rs rust: str: replace unwraps with question mark operators 2025-01-13 23:45:05 +01:00
sync.rs Driver core and debugfs updates 2025-01-28 12:25:12 -08:00
task.rs rust: task: make Pid type alias public 2025-03-06 20:59:45 +01:00
time.rs rust: use custom FFI integer types 2024-11-10 23:58:00 +01:00
tracepoint.rs rust: add tracepoint support 2024-11-04 16:21:44 -05:00
transmute.rs rust: kernel: move FromBytes and AsBytes traits to a new transmute module 2024-10-10 00:33:42 +02:00
types.rs rust: make pin-init its own crate 2025-03-16 21:59:19 +01:00
uaccess.rs rust: uaccess: generalize userSliceReader to support any Vec 2025-01-13 23:46:23 +01:00
workqueue.rs Rust changes for v6.14 2025-01-21 17:48:03 -08:00