Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

rust: add `kunit_tests` to the prelude

It is convenient to have certain things in the `kernel` prelude, and
means kernel developers will find it even easier to start writing tests.

And, anyway, nobody should need to use this identifier for anything else.

Thus add it to the prelude.

Reviewed-by: David Gow <davidgow@google.com>
Acked-by: Danilo Krummrich <dakr@kernel.org>
Link: https://lore.kernel.org/r/20250502215133.1923676-4-ojeda@kernel.org
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>

+3 -4
+1 -2
rust/kernel/kunit.rs
··· 6 6 //! 7 7 //! Reference: <https://docs.kernel.org/dev-tools/kunit/index.html> 8 8 9 + use crate::prelude::*; 9 10 use core::{ffi::c_void, fmt}; 10 11 11 12 /// Prints a KUnit error-level message. ··· 40 39 ); 41 40 } 42 41 } 43 - 44 - use macros::kunit_tests; 45 42 46 43 /// Asserts that a boolean expression is `true` at runtime. 47 44 ///
+1 -1
rust/kernel/prelude.rs
··· 22 22 pub use crate::alloc::{flags::*, Box, KBox, KVBox, KVVec, KVec, VBox, VVec, Vec}; 23 23 24 24 #[doc(no_inline)] 25 - pub use macros::{export, module, vtable}; 25 + pub use macros::{export, kunit_tests, module, vtable}; 26 26 27 27 pub use pin_init::{init, pin_data, pin_init, pinned_drop, InPlaceWrite, Init, PinInit, Zeroable}; 28 28
+1 -1
rust/macros/lib.rs
··· 407 407 /// # Examples 408 408 /// 409 409 /// ```ignore 410 - /// # use macros::kunit_tests; 410 + /// # use kernel::prelude::*; 411 411 /// #[kunit_tests(kunit_test_suit_name)] 412 412 /// mod tests { 413 413 /// #[test]