mirror of
git://git.yoctoproject.org/linux-yocto.git
synced 2025-10-22 15:03:53 +02:00
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>
This commit is contained in:
parent
950b306c29
commit
897d1df653
|
@ -6,6 +6,7 @@
|
|||
//!
|
||||
//! Reference: <https://docs.kernel.org/dev-tools/kunit/index.html>
|
||||
|
||||
use crate::prelude::*;
|
||||
use core::{ffi::c_void, fmt};
|
||||
|
||||
/// Prints a KUnit error-level message.
|
||||
|
@ -40,8 +41,6 @@ pub fn info(args: fmt::Arguments<'_>) {
|
|||
}
|
||||
}
|
||||
|
||||
use macros::kunit_tests;
|
||||
|
||||
/// Asserts that a boolean expression is `true` at runtime.
|
||||
///
|
||||
/// Public but hidden since it should only be used from generated tests.
|
||||
|
|
|
@ -22,7 +22,7 @@ pub use ::ffi::{
|
|||
pub use crate::alloc::{flags::*, Box, KBox, KVBox, KVVec, KVec, VBox, VVec, Vec};
|
||||
|
||||
#[doc(no_inline)]
|
||||
pub use macros::{export, module, vtable};
|
||||
pub use macros::{export, kunit_tests, module, vtable};
|
||||
|
||||
pub use pin_init::{init, pin_data, pin_init, pinned_drop, InPlaceWrite, Init, PinInit, Zeroable};
|
||||
|
||||
|
|
|
@ -407,7 +407,7 @@ pub fn paste(input: TokenStream) -> TokenStream {
|
|||
/// # Examples
|
||||
///
|
||||
/// ```ignore
|
||||
/// # use macros::kunit_tests;
|
||||
/// # use kernel::prelude::*;
|
||||
/// #[kunit_tests(kunit_test_suit_name)]
|
||||
/// mod tests {
|
||||
/// #[test]
|
||||
|
|
Loading…
Reference in New Issue
Block a user