From 1d1e5e24da9c77295f7fce01d68e5818eb78d09b Mon Sep 17 00:00:00 2001 From: Jiahao XU Date: Sat, 22 Jul 2023 22:17:52 +1000 Subject: [PATCH] Replace use of `tokio_wasm` in tests with `target_family = "wasm"` Signed-off-by: Jiahao XU --- tokio/tests/_require_full.rs | 2 +- tokio/tests/sync_broadcast.rs | 6 +++--- tokio/tests/sync_mpsc.rs | 10 +++++----- tokio/tests/sync_oneshot.rs | 2 +- tokio/tests/sync_semaphore.rs | 8 ++++---- tokio/tests/sync_semaphore_owned.rs | 2 +- tokio/tests/sync_watch.rs | 2 +- 7 files changed, 16 insertions(+), 16 deletions(-) diff --git a/tokio/tests/_require_full.rs b/tokio/tests/_require_full.rs index 4b9698afedd..d33943a960d 100644 --- a/tokio/tests/_require_full.rs +++ b/tokio/tests/_require_full.rs @@ -1,4 +1,4 @@ -#[cfg(not(any(feature = "full", tokio_wasm)))] +#[cfg(not(any(feature = "full", target_family = "wasm")))] compile_error!("run main Tokio tests with `--features full`"); // CI sets `--cfg tokio_no_parking_lot` when trying to run tests with diff --git a/tokio/tests/sync_broadcast.rs b/tokio/tests/sync_broadcast.rs index feed03148af..59190a9603d 100644 --- a/tokio/tests/sync_broadcast.rs +++ b/tokio/tests/sync_broadcast.rs @@ -276,14 +276,14 @@ fn send_no_rx() { #[test] #[should_panic] -#[cfg(not(tokio_wasm))] // wasm currently doesn't support unwinding +#[cfg(not(target_family = "wasm"))] // wasm currently doesn't support unwinding fn zero_capacity() { broadcast::channel::<()>(0); } #[test] #[should_panic] -#[cfg(not(tokio_wasm))] // wasm currently doesn't support unwinding +#[cfg(not(target_family = "wasm"))] // wasm currently doesn't support unwinding fn capacity_too_big() { use std::usize; @@ -292,7 +292,7 @@ fn capacity_too_big() { #[test] #[cfg(panic = "unwind")] -#[cfg(not(tokio_wasm))] // wasm currently doesn't support unwinding +#[cfg(not(target_family = "wasm"))] // wasm currently doesn't support unwinding fn panic_in_clone() { use std::panic::{self, AssertUnwindSafe}; diff --git a/tokio/tests/sync_mpsc.rs b/tokio/tests/sync_mpsc.rs index 6e870964113..84211a7c272 100644 --- a/tokio/tests/sync_mpsc.rs +++ b/tokio/tests/sync_mpsc.rs @@ -15,7 +15,7 @@ use tokio::sync::mpsc::error::{TryRecvError, TrySendError}; use tokio::test as maybe_tokio_test; use tokio_test::*; -#[cfg(not(tokio_wasm))] +#[cfg(not(target_family = "wasm"))] mod support { pub(crate) mod mpsc_stream; } @@ -154,7 +154,7 @@ async fn start_send_past_cap() { #[test] #[should_panic] -#[cfg(not(tokio_wasm))] // wasm currently doesn't support unwinding +#[cfg(not(target_family = "wasm"))] // wasm currently doesn't support unwinding fn buffer_gteq_one() { mpsc::channel::(0); } @@ -470,7 +470,7 @@ fn blocking_recv() { #[tokio::test] #[should_panic] -#[cfg(not(tokio_wasm))] // wasm currently doesn't support unwinding +#[cfg(not(target_family = "wasm"))] // wasm currently doesn't support unwinding async fn blocking_recv_async() { let (_tx, mut rx) = mpsc::channel::<()>(1); let _ = rx.blocking_recv(); @@ -495,7 +495,7 @@ fn blocking_send() { #[tokio::test] #[should_panic] -#[cfg(not(tokio_wasm))] // wasm currently doesn't support unwinding +#[cfg(not(target_family = "wasm"))] // wasm currently doesn't support unwinding async fn blocking_send_async() { let (tx, _rx) = mpsc::channel::<()>(1); let _ = tx.blocking_send(()); @@ -648,7 +648,7 @@ async fn recv_timeout() { #[test] #[should_panic = "there is no reactor running, must be called from the context of a Tokio 1.x runtime"] -#[cfg(not(tokio_wasm))] // wasm currently doesn't support unwinding +#[cfg(not(target_family = "wasm"))] // wasm currently doesn't support unwinding fn recv_timeout_panic() { use futures::future::FutureExt; use tokio::time::Duration; diff --git a/tokio/tests/sync_oneshot.rs b/tokio/tests/sync_oneshot.rs index 15b6923701f..f11b1071cd0 100644 --- a/tokio/tests/sync_oneshot.rs +++ b/tokio/tests/sync_oneshot.rs @@ -179,7 +179,7 @@ fn explicit_close_try_recv() { #[test] #[should_panic] -#[cfg(not(tokio_wasm))] // wasm currently doesn't support unwinding +#[cfg(not(target_family = "wasm"))] // wasm currently doesn't support unwinding fn close_try_recv_poll() { let (_tx, rx) = oneshot::channel::(); let mut rx = task::spawn(rx); diff --git a/tokio/tests/sync_semaphore.rs b/tokio/tests/sync_semaphore.rs index 3d47ed0ed73..52c65fdb1f7 100644 --- a/tokio/tests/sync_semaphore.rs +++ b/tokio/tests/sync_semaphore.rs @@ -78,7 +78,7 @@ fn merge() { } #[test] -#[cfg(not(tokio_wasm))] // No stack unwinding on wasm targets +#[cfg(not(target_family = "wasm"))] // No stack unwinding on wasm targets #[should_panic] fn merge_unrelated_permits() { let sem1 = Arc::new(Semaphore::new(3)); @@ -118,7 +118,7 @@ fn add_max_amount_permits() { assert_eq!(s.available_permits(), tokio::sync::Semaphore::MAX_PERMITS); } -#[cfg(not(tokio_wasm))] // wasm currently doesn't support unwinding +#[cfg(not(target_family = "wasm"))] // wasm currently doesn't support unwinding #[test] #[should_panic] fn add_more_than_max_amount_permits1() { @@ -126,7 +126,7 @@ fn add_more_than_max_amount_permits1() { s.add_permits(tokio::sync::Semaphore::MAX_PERMITS); } -#[cfg(not(tokio_wasm))] // wasm currently doesn't support unwinding +#[cfg(not(target_family = "wasm"))] // wasm currently doesn't support unwinding #[test] #[should_panic] fn add_more_than_max_amount_permits2() { @@ -135,7 +135,7 @@ fn add_more_than_max_amount_permits2() { s.add_permits(1); } -#[cfg(not(tokio_wasm))] // wasm currently doesn't support unwinding +#[cfg(not(target_family = "wasm"))] // wasm currently doesn't support unwinding #[test] #[should_panic] fn panic_when_exceeds_maxpermits() { diff --git a/tokio/tests/sync_semaphore_owned.rs b/tokio/tests/sync_semaphore_owned.rs index f6945764786..6f66d6adc98 100644 --- a/tokio/tests/sync_semaphore_owned.rs +++ b/tokio/tests/sync_semaphore_owned.rs @@ -104,7 +104,7 @@ fn merge() { } #[test] -#[cfg(not(tokio_wasm))] // No stack unwinding on wasm targets +#[cfg(not(target_family = "wasm"))] // No stack unwinding on wasm targets #[should_panic] fn merge_unrelated_permits() { let sem1 = Arc::new(Semaphore::new(3)); diff --git a/tokio/tests/sync_watch.rs b/tokio/tests/sync_watch.rs index d4f8ce87d95..9d169641d23 100644 --- a/tokio/tests/sync_watch.rs +++ b/tokio/tests/sync_watch.rs @@ -214,7 +214,7 @@ fn reopened_after_subscribe() { #[test] #[cfg(panic = "unwind")] -#[cfg(not(tokio_wasm))] // wasm currently doesn't support unwinding +#[cfg(not(target_family = "wasm"))] // wasm currently doesn't support unwinding fn send_modify_panic() { let (tx, mut rx) = watch::channel("one");