aboutsummaryrefslogtreecommitdiffstats
path: root/rust/pin-init/examples/pthread_mutex.rs
diff options
context:
space:
mode:
authorBenno Lossin <[email protected]>2025-06-05 15:52:54 +0000
committerBenno Lossin <[email protected]>2025-06-11 19:13:57 +0000
commitfc3870dc5cadb701b4122e4a8daa85f9fa2f57b9 (patch)
tree68826d300e855630fa4dc4fcc5b212ae7160401b /rust/pin-init/examples/pthread_mutex.rs
parentrust: init: remove doctest's `Error::from_errno` workaround (diff)
downloadkernel-fc3870dc5cadb701b4122e4a8daa85f9fa2f57b9.tar.gz
kernel-fc3870dc5cadb701b4122e4a8daa85f9fa2f57b9.zip
rust: pin-init: examples, tests: use `ignore` instead of conditionally compiling tests
Change `#[cfg(cond)]` to `#[cfg_attr(not(cond), ignore)]` on tests. Ignoring tests instead of disabling them still makes them appear in the test list, but with `ignored`. It also still compiles the code in those cases. Some tests still need to be ignore, because they use types that are not present when the condition is false. For example the condition is `feature = std` and then it uses `std::thread::Thread`. Suggested-by: Alice Ryhl <[email protected]> Link: https://lore.kernel.org/all/[email protected] Link: https://github.com/Rust-for-Linux/pin-init/pull/58/commits/b004dd8e64d4cbe219a4eff0d25f0a5f5bc750ca Reviewed-by: Christian Schrefl <[email protected]> Link: https://lore.kernel.org/all/[email protected] Signed-off-by: Benno Lossin <[email protected]>
Diffstat (limited to 'rust/pin-init/examples/pthread_mutex.rs')
-rw-r--r--rust/pin-init/examples/pthread_mutex.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/rust/pin-init/examples/pthread_mutex.rs b/rust/pin-init/examples/pthread_mutex.rs
index 6c4d18238956..49b004c8c137 100644
--- a/rust/pin-init/examples/pthread_mutex.rs
+++ b/rust/pin-init/examples/pthread_mutex.rs
@@ -139,7 +139,8 @@ mod pthread_mtx {
}
}
-#[cfg_attr(all(test, not(miri)), test)]
+#[cfg_attr(test, test)]
+#[cfg_attr(all(test, miri), ignore)]
fn main() {
#[cfg(all(any(feature = "std", feature = "alloc"), not(windows)))]
{