Skip to content

Commit

Permalink
chore: use target_family wasm instead of wasm32
Browse files Browse the repository at this point in the history
  • Loading branch information
Darksonn committed Jul 26, 2022
1 parent 28ce4ee commit 6c858e7
Show file tree
Hide file tree
Showing 27 changed files with 62 additions and 62 deletions.
8 changes: 4 additions & 4 deletions tokio/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ mio = { version = "0.8.4", optional = true }
num_cpus = { version = "1.8.0", optional = true }
parking_lot = { version = "0.12.0", optional = true }

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
[target.'cfg(not(target_arch = "wasm"))'.dependencies]
socket2 = { version = "0.4.4", features = [ "all" ] }

# Currently unstable. The API exposed by these features may be broken at any time.
Expand Down Expand Up @@ -150,14 +150,14 @@ mockall = "0.11.1"
tempfile = "3.1.0"
async-stream = "0.3"

[target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies]
[target.'cfg(not(target_arch = "wasm"))'.dev-dependencies]
proptest = "1"
socket2 = "0.4"

[target.'cfg(not(all(target_arch = "wasm32", target_os = "unknown")))'.dev-dependencies]
[target.'cfg(not(all(target_arch = "wasm", target_os = "unknown")))'.dev-dependencies]
rand = "0.8.0"

[target.'cfg(all(target_arch = "wasm32", not(target_os = "wasi")))'.dev-dependencies]
[target.'cfg(all(target_arch = "wasm", not(target_os = "wasi")))'.dev-dependencies]
wasm-bindgen-test = "0.3.0"

[target.'cfg(target_os = "freebsd")'.dev-dependencies]
Expand Down
2 changes: 1 addition & 1 deletion tokio/src/coop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ cfg_coop! {
mod test {
use super::*;

#[cfg(all(target_arch = "wasm32", not(target_os = "wasi")))]
#[cfg(all(target_arch = "wasm", not(target_os = "wasi")))]
use wasm_bindgen_test::wasm_bindgen_test as test;

fn get() -> Budget {
Expand Down
2 changes: 1 addition & 1 deletion tokio/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ compile_error! {

#[cfg(all(
not(tokio_unstable),
target_arch = "wasm32",
target_arch = "wasm",
any(
feature = "fs",
feature = "io-std",
Expand Down
6 changes: 3 additions & 3 deletions tokio/src/macros/cfg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ macro_rules! cfg_has_atomic_u64 {
target_arch = "mips",
target_arch = "powerpc",
target_arch = "riscv32",
target_arch = "wasm32"
target_arch = "wasm"
)))]
$item
)*
Expand All @@ -474,7 +474,7 @@ macro_rules! cfg_not_has_atomic_u64 {
target_arch = "mips",
target_arch = "powerpc",
target_arch = "riscv32",
target_arch = "wasm32"
target_arch = "wasm"
))]
$item
)*
Expand All @@ -493,7 +493,7 @@ macro_rules! cfg_not_wasi {
macro_rules! cfg_is_wasm_not_wasi {
($($item:item)*) => {
$(
#[cfg(all(target_arch = "wasm32", not(target_os = "wasi")))]
#[cfg(all(target_arch = "wasm", not(target_os = "wasi")))]
$item
)*
}
Expand Down
2 changes: 1 addition & 1 deletion tokio/src/runtime/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@

// At the top due to macros
#[cfg(test)]
#[cfg(not(target_arch = "wasm32"))]
#[cfg(not(target_arch = "wasm"))]
#[macro_use]
mod tests;

Expand Down
2 changes: 1 addition & 1 deletion tokio/src/runtime/task/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ impl<S: Schedule> LocalNotified<S> {
impl<S: Schedule> UnownedTask<S> {
// Used in test of the inject queue.
#[cfg(test)]
#[cfg_attr(target_arch = "wasm32", allow(dead_code))]
#[cfg_attr(target_arch = "wasm", allow(dead_code))]
pub(super) fn into_notified(self) -> Notified<S> {
Notified(self.into_task())
}
Expand Down
4 changes: 2 additions & 2 deletions tokio/src/sync/tests/atomic_waker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ impl AssertSync for AtomicWaker {}
impl AssertSend for Waker {}
impl AssertSync for Waker {}

#[cfg(all(target_arch = "wasm32", not(target_os = "wasi")))]
#[cfg(all(target_arch = "wasm", not(target_os = "wasi")))]
use wasm_bindgen_test::wasm_bindgen_test as test;

#[test]
Expand All @@ -37,7 +37,7 @@ fn wake_without_register() {
}

#[test]
#[cfg(not(target_arch = "wasm32"))] // wasm currently doesn't support unwinding
#[cfg(not(target_arch = "wasm"))] // wasm currently doesn't support unwinding
fn atomic_waker_panic_safe() {
use std::panic;
use std::ptr;
Expand Down
4 changes: 2 additions & 2 deletions tokio/src/sync/tests/notify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use std::mem::ManuallyDrop;
use std::sync::Arc;
use std::task::{Context, RawWaker, RawWakerVTable, Waker};

#[cfg(all(target_arch = "wasm32", not(target_os = "wasi")))]
#[cfg(all(target_arch = "wasm", not(target_os = "wasi")))]
use wasm_bindgen_test::wasm_bindgen_test as test;

#[test]
Expand Down Expand Up @@ -63,7 +63,7 @@ fn notify_simple() {
}

#[test]
#[cfg(not(target_arch = "wasm32"))]
#[cfg(not(target_arch = "wasm"))]
fn watch_test() {
let rt = crate::runtime::Builder::new_current_thread()
.build()
Expand Down
4 changes: 2 additions & 2 deletions tokio/src/sync/tests/semaphore_batch.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::sync::batch_semaphore::Semaphore;
use tokio_test::*;

#[cfg(all(target_arch = "wasm32", not(target_os = "wasi")))]
#[cfg(all(target_arch = "wasm", not(target_os = "wasi")))]
use wasm_bindgen_test::wasm_bindgen_test as test;

#[test]
Expand Down Expand Up @@ -170,7 +170,7 @@ fn poll_acquire_one_zero_permits() {

#[test]
#[should_panic]
#[cfg(not(target_arch = "wasm32"))] // wasm currently doesn't support unwinding
#[cfg(not(target_arch = "wasm"))] // wasm currently doesn't support unwinding
fn validates_max_permits() {
use std::usize;
Semaphore::new((usize::MAX >> 2) + 1);
Expand Down
4 changes: 2 additions & 2 deletions tokio/src/util/linked_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -623,15 +623,15 @@ mod tests {
}
}

#[cfg(not(target_arch = "wasm32"))]
#[cfg(not(target_arch = "wasm"))]
proptest::proptest! {
#[test]
fn fuzz_linked_list(ops: Vec<usize>) {
run_fuzz(ops);
}
}

#[cfg(not(target_arch = "wasm32"))]
#[cfg(not(target_arch = "wasm"))]
fn run_fuzz(ops: Vec<usize>) {
use std::collections::VecDeque;

Expand Down
2 changes: 1 addition & 1 deletion tokio/tests/_require_full.rs
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#![cfg(not(any(feature = "full", target_arch = "wasm32")))]
#![cfg(not(any(feature = "full", target_arch = "wasm")))]
compile_error!("run main Tokio tests with `--features full`");
6 changes: 3 additions & 3 deletions tokio/tests/macros_join.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
#![allow(clippy::blacklisted_name)]
use std::sync::Arc;

#[cfg(all(target_arch = "wasm32", not(target_os = "wasi")))]
#[cfg(all(target_arch = "wasm", not(target_os = "wasi")))]
use wasm_bindgen_test::wasm_bindgen_test as test;
#[cfg(all(target_arch = "wasm32", not(target_os = "wasi")))]
#[cfg(all(target_arch = "wasm", not(target_os = "wasi")))]
use wasm_bindgen_test::wasm_bindgen_test as maybe_tokio_test;

#[cfg(not(all(target_arch = "wasm32", not(target_os = "wasi"))))]
#[cfg(not(all(target_arch = "wasm", not(target_os = "wasi"))))]
use tokio::test as maybe_tokio_test;

use tokio::sync::{oneshot, Semaphore};
Expand Down
4 changes: 2 additions & 2 deletions tokio/tests/macros_pin.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#![cfg(feature = "macros")]

#[cfg(all(target_arch = "wasm32", not(target_os = "wasi")))]
#[cfg(all(target_arch = "wasm", not(target_os = "wasi")))]
use wasm_bindgen_test::wasm_bindgen_test as maybe_tokio_test;

#[cfg(not(all(target_arch = "wasm32", not(target_os = "wasi"))))]
#[cfg(not(all(target_arch = "wasm", not(target_os = "wasi"))))]
use tokio::test as maybe_tokio_test;

async fn one() {}
Expand Down
4 changes: 2 additions & 2 deletions tokio/tests/macros_select.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#![cfg(feature = "macros")]
#![allow(clippy::blacklisted_name)]

#[cfg(all(target_arch = "wasm32", not(target_os = "wasi")))]
#[cfg(all(target_arch = "wasm", not(target_os = "wasi")))]
use wasm_bindgen_test::wasm_bindgen_test as maybe_tokio_test;

#[cfg(not(all(target_arch = "wasm32", not(target_os = "wasi"))))]
#[cfg(not(all(target_arch = "wasm", not(target_os = "wasi"))))]
use tokio::test as maybe_tokio_test;

use tokio::sync::oneshot;
Expand Down
4 changes: 2 additions & 2 deletions tokio/tests/macros_try_join.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ use std::sync::Arc;
use tokio::sync::{oneshot, Semaphore};
use tokio_test::{assert_pending, assert_ready, task};

#[cfg(all(target_arch = "wasm32", not(target_os = "wasi")))]
#[cfg(all(target_arch = "wasm", not(target_os = "wasi")))]
use wasm_bindgen_test::wasm_bindgen_test as maybe_tokio_test;

#[cfg(not(all(target_arch = "wasm32", not(target_os = "wasi"))))]
#[cfg(not(all(target_arch = "wasm", not(target_os = "wasi"))))]
use tokio::test as maybe_tokio_test;

#[maybe_tokio_test]
Expand Down
2 changes: 1 addition & 1 deletion tokio/tests/sync_barrier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#![warn(rust_2018_idioms)]
#![cfg(feature = "sync")]

#[cfg(all(target_arch = "wasm32", not(target_os = "wasi")))]
#[cfg(all(target_arch = "wasm", not(target_os = "wasi")))]
use wasm_bindgen_test::wasm_bindgen_test as test;

use tokio::sync::Barrier;
Expand Down
8 changes: 4 additions & 4 deletions tokio/tests/sync_broadcast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#![warn(rust_2018_idioms)]
#![cfg(feature = "sync")]

#[cfg(all(target_arch = "wasm32", not(target_os = "wasi")))]
#[cfg(all(target_arch = "wasm", not(target_os = "wasi")))]
use wasm_bindgen_test::wasm_bindgen_test as test;

use tokio::sync::broadcast;
Expand Down Expand Up @@ -276,22 +276,22 @@ fn send_no_rx() {

#[test]
#[should_panic]
#[cfg(not(target_arch = "wasm32"))] // wasm currently doesn't support unwinding
#[cfg(not(target_arch = "wasm"))] // wasm currently doesn't support unwinding
fn zero_capacity() {
broadcast::channel::<()>(0);
}

#[test]
#[should_panic]
#[cfg(not(target_arch = "wasm32"))] // wasm currently doesn't support unwinding
#[cfg(not(target_arch = "wasm"))] // wasm currently doesn't support unwinding
fn capacity_too_big() {
use std::usize;

broadcast::channel::<()>(1 + (usize::MAX >> 1));
}

#[test]
#[cfg(not(target_arch = "wasm32"))] // wasm currently doesn't support unwinding
#[cfg(not(target_arch = "wasm"))] // wasm currently doesn't support unwinding
fn panic_in_clone() {
use std::panic::{self, AssertUnwindSafe};

Expand Down
2 changes: 1 addition & 1 deletion tokio/tests/sync_errors.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#![warn(rust_2018_idioms)]
#![cfg(feature = "sync")]

#[cfg(all(target_arch = "wasm32", not(target_os = "wasi")))]
#[cfg(all(target_arch = "wasm", not(target_os = "wasi")))]
use wasm_bindgen_test::wasm_bindgen_test as test;

fn is_error<T: std::error::Error + Send + Sync>() {}
Expand Down
16 changes: 8 additions & 8 deletions tokio/tests/sync_mpsc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
#![warn(rust_2018_idioms)]
#![cfg(feature = "sync")]

#[cfg(all(target_arch = "wasm32", not(target_os = "wasi")))]
#[cfg(all(target_arch = "wasm", not(target_os = "wasi")))]
use wasm_bindgen_test::wasm_bindgen_test as test;
#[cfg(all(target_arch = "wasm32", not(target_os = "wasi")))]
#[cfg(all(target_arch = "wasm", not(target_os = "wasi")))]
use wasm_bindgen_test::wasm_bindgen_test as maybe_tokio_test;

#[cfg(not(all(target_arch = "wasm32", not(target_os = "wasi"))))]
#[cfg(not(all(target_arch = "wasm", not(target_os = "wasi"))))]
use tokio::test as maybe_tokio_test;

use tokio::sync::mpsc;
Expand All @@ -16,7 +16,7 @@ use tokio_test::*;

use std::sync::Arc;

#[cfg(not(target_arch = "wasm32"))]
#[cfg(not(target_arch = "wasm"))]
mod support {
pub(crate) mod mpsc_stream;
}
Expand Down Expand Up @@ -155,7 +155,7 @@ async fn start_send_past_cap() {

#[test]
#[should_panic]
#[cfg(not(target_arch = "wasm32"))] // wasm currently doesn't support unwinding
#[cfg(not(target_arch = "wasm"))] // wasm currently doesn't support unwinding
fn buffer_gteq_one() {
mpsc::channel::<i32>(0);
}
Expand Down Expand Up @@ -471,7 +471,7 @@ fn blocking_recv() {

#[tokio::test]
#[should_panic]
#[cfg(not(target_arch = "wasm32"))] // wasm currently doesn't support unwinding
#[cfg(not(target_arch = "wasm"))] // wasm currently doesn't support unwinding
async fn blocking_recv_async() {
let (_tx, mut rx) = mpsc::channel::<()>(1);
let _ = rx.blocking_recv();
Expand All @@ -496,7 +496,7 @@ fn blocking_send() {

#[tokio::test]
#[should_panic]
#[cfg(not(target_arch = "wasm32"))] // wasm currently doesn't support unwinding
#[cfg(not(target_arch = "wasm"))] // wasm currently doesn't support unwinding
async fn blocking_send_async() {
let (tx, _rx) = mpsc::channel::<()>(1);
let _ = tx.blocking_send(());
Expand Down Expand Up @@ -649,7 +649,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(target_arch = "wasm32"))] // wasm currently doesn't support unwinding
#[cfg(not(target_arch = "wasm"))] // wasm currently doesn't support unwinding
fn recv_timeout_panic() {
use futures::future::FutureExt;
use tokio::time::Duration;
Expand Down
6 changes: 3 additions & 3 deletions tokio/tests/sync_mutex.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#![warn(rust_2018_idioms)]
#![cfg(feature = "sync")]

#[cfg(all(target_arch = "wasm32", not(target_os = "wasi")))]
#[cfg(all(target_arch = "wasm", not(target_os = "wasi")))]
use wasm_bindgen_test::wasm_bindgen_test as test;
#[cfg(all(target_arch = "wasm32", not(target_os = "wasi")))]
#[cfg(all(target_arch = "wasm", not(target_os = "wasi")))]
use wasm_bindgen_test::wasm_bindgen_test as maybe_tokio_test;

#[cfg(not(all(target_arch = "wasm32", not(target_os = "wasi"))))]
#[cfg(not(all(target_arch = "wasm", not(target_os = "wasi"))))]
use tokio::test as maybe_tokio_test;

use tokio::sync::Mutex;
Expand Down
6 changes: 3 additions & 3 deletions tokio/tests/sync_mutex_owned.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#![warn(rust_2018_idioms)]
#![cfg(feature = "sync")]

#[cfg(all(target_arch = "wasm32", not(target_os = "wasi")))]
#[cfg(all(target_arch = "wasm", not(target_os = "wasi")))]
use wasm_bindgen_test::wasm_bindgen_test as test;
#[cfg(all(target_arch = "wasm32", not(target_os = "wasi")))]
#[cfg(all(target_arch = "wasm", not(target_os = "wasi")))]
use wasm_bindgen_test::wasm_bindgen_test as maybe_tokio_test;

#[cfg(not(all(target_arch = "wasm32", not(target_os = "wasi"))))]
#[cfg(not(all(target_arch = "wasm", not(target_os = "wasi"))))]
use tokio::test as maybe_tokio_test;

use tokio::sync::Mutex;
Expand Down
2 changes: 1 addition & 1 deletion tokio/tests/sync_notify.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#![warn(rust_2018_idioms)]
#![cfg(feature = "sync")]

#[cfg(all(target_arch = "wasm32", not(target_os = "wasi")))]
#[cfg(all(target_arch = "wasm", not(target_os = "wasi")))]
use wasm_bindgen_test::wasm_bindgen_test as test;

use tokio::sync::Notify;
Expand Down
8 changes: 4 additions & 4 deletions tokio/tests/sync_oneshot.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#![warn(rust_2018_idioms)]
#![cfg(feature = "sync")]

#[cfg(all(target_arch = "wasm32", not(target_os = "wasi")))]
#[cfg(all(target_arch = "wasm", not(target_os = "wasi")))]
use wasm_bindgen_test::wasm_bindgen_test as test;
#[cfg(all(target_arch = "wasm32", not(target_os = "wasi")))]
#[cfg(all(target_arch = "wasm", not(target_os = "wasi")))]
use wasm_bindgen_test::wasm_bindgen_test as maybe_tokio_test;

#[cfg(not(all(target_arch = "wasm32", not(target_os = "wasi"))))]
#[cfg(not(all(target_arch = "wasm", not(target_os = "wasi"))))]
use tokio::test as maybe_tokio_test;

use tokio::sync::oneshot;
Expand Down Expand Up @@ -179,7 +179,7 @@ fn explicit_close_try_recv() {

#[test]
#[should_panic]
#[cfg(not(target_arch = "wasm32"))] // wasm currently doesn't support unwinding
#[cfg(not(target_arch = "wasm"))] // wasm currently doesn't support unwinding
fn close_try_recv_poll() {
let (_tx, rx) = oneshot::channel::<i32>();
let mut rx = task::spawn(rx);
Expand Down
Loading

0 comments on commit 6c858e7

Please sign in to comment.