linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] rust: pin-init: examples, tests: use `ignore` instead of conditionally compiling tests
@ 2025-06-05 15:52 Benno Lossin
  2025-06-05 17:09 ` Christian Schrefl
  2025-06-09 19:55 ` Benno Lossin
  0 siblings, 2 replies; 3+ messages in thread
From: Benno Lossin @ 2025-06-05 15:52 UTC (permalink / raw)
  To: Benno Lossin, Miguel Ojeda, Alex Gaynor, Boqun Feng, Gary Guo,
	Björn Roy Baron, Andreas Hindborg, Alice Ryhl, Trevor Gross,
	Danilo Krummrich, Fiona Behrens
  Cc: rust-for-linux, linux-kernel

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 <aliceryhl@google.com>
Link: https://lore.kernel.org/all/aDC9y829vZZBzZ2p@google.com
Link: https://github.com/Rust-for-Linux/pin-init/pull/58/commits/b004dd8e64d4cbe219a4eff0d25f0a5f5bc750ca
Signed-off-by: Benno Lossin <lossin@kernel.org>
---

Depends on https://lore.kernel.org/all/20250523125424.192843-3-lossin@kernel.org

---
 rust/pin-init/examples/pthread_mutex.rs | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

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 @@ fn deref_mut(&mut self) -> &mut Self::Target {
     }
 }
 
-#[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)))]
     {

base-commit: ae8b3a83fb9de394f609035041cd7a668fda2ab3
prerequisite-patch-id: 8d7ade67c2e5189bf8a2c91253d925e25744cba5
prerequisite-patch-id: 0ebbd4a86bebeff23257870db92a1b0fe017c481
prerequisite-patch-id: 1437fc7adeff6e13abd433594da923272b9388bf
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] rust: pin-init: examples, tests: use `ignore` instead of conditionally compiling tests
  2025-06-05 15:52 [PATCH] rust: pin-init: examples, tests: use `ignore` instead of conditionally compiling tests Benno Lossin
@ 2025-06-05 17:09 ` Christian Schrefl
  2025-06-09 19:55 ` Benno Lossin
  1 sibling, 0 replies; 3+ messages in thread
From: Christian Schrefl @ 2025-06-05 17:09 UTC (permalink / raw)
  To: Benno Lossin, Miguel Ojeda, Alex Gaynor, Boqun Feng, Gary Guo,
	Björn Roy Baron, Andreas Hindborg, Alice Ryhl, Trevor Gross,
	Danilo Krummrich, Fiona Behrens
  Cc: rust-for-linux, linux-kernel

On 05.06.25 5:52 PM, Benno Lossin wrote:
> 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 <aliceryhl@google.com>
> Link: https://lore.kernel.org/all/aDC9y829vZZBzZ2p@google.com
> Link: https://github.com/Rust-for-Linux/pin-init/pull/58/commits/b004dd8e64d4cbe219a4eff0d25f0a5f5bc750ca
> Signed-off-by: Benno Lossin <lossin@kernel.org>
> ---

Reviewed-by: Christian Schrefl <chrisi.schrefl@gmail.com>

> 
> Depends on https://lore.kernel.org/all/20250523125424.192843-3-lossin@kernel.org
> 
> ---
>  rust/pin-init/examples/pthread_mutex.rs | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> 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 @@ fn deref_mut(&mut self) -> &mut Self::Target {
>      }
>  }
>  
> -#[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)))]
>      {
> 
> base-commit: ae8b3a83fb9de394f609035041cd7a668fda2ab3
> prerequisite-patch-id: 8d7ade67c2e5189bf8a2c91253d925e25744cba5
> prerequisite-patch-id: 0ebbd4a86bebeff23257870db92a1b0fe017c481
> prerequisite-patch-id: 1437fc7adeff6e13abd433594da923272b9388bf


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] rust: pin-init: examples, tests: use `ignore` instead of conditionally compiling tests
  2025-06-05 15:52 [PATCH] rust: pin-init: examples, tests: use `ignore` instead of conditionally compiling tests Benno Lossin
  2025-06-05 17:09 ` Christian Schrefl
@ 2025-06-09 19:55 ` Benno Lossin
  1 sibling, 0 replies; 3+ messages in thread
From: Benno Lossin @ 2025-06-09 19:55 UTC (permalink / raw)
  To: Benno Lossin, Miguel Ojeda, Alex Gaynor, Boqun Feng, Gary Guo,
	Björn Roy Baron, Andreas Hindborg, Alice Ryhl, Trevor Gross,
	Danilo Krummrich, Fiona Behrens
  Cc: rust-for-linux, linux-kernel

On Thu Jun 5, 2025 at 5:52 PM CEST, Benno Lossin wrote:
> 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 <aliceryhl@google.com>
> Link: https://lore.kernel.org/all/aDC9y829vZZBzZ2p@google.com
> Link: https://github.com/Rust-for-Linux/pin-init/pull/58/commits/b004dd8e64d4cbe219a4eff0d25f0a5f5bc750ca
> Signed-off-by: Benno Lossin <lossin@kernel.org>
> ---
>
> Depends on https://lore.kernel.org/all/20250523125424.192843-3-lossin@kernel.org
>
> ---
>  rust/pin-init/examples/pthread_mutex.rs | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

Applied to pin-init-next -- thanks everyone!

---
Cheers,
Benno

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-06-09 19:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-05 15:52 [PATCH] rust: pin-init: examples, tests: use `ignore` instead of conditionally compiling tests Benno Lossin
2025-06-05 17:09 ` Christian Schrefl
2025-06-09 19:55 ` Benno Lossin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).