diff options
Diffstat (limited to 'vendor/rayon/tests')
-rw-r--r-- | vendor/rayon/tests/clones.rs | 20 | ||||
-rw-r--r-- | vendor/rayon/tests/collect.rs | 2 | ||||
-rw-r--r-- | vendor/rayon/tests/cross-pool.rs | 1 | ||||
-rw-r--r-- | vendor/rayon/tests/debug.rs | 4 | ||||
-rw-r--r-- | vendor/rayon/tests/iter_panic.rs | 1 | ||||
-rw-r--r-- | vendor/rayon/tests/named-threads.rs | 1 | ||||
-rw-r--r-- | vendor/rayon/tests/octillion.rs | 32 | ||||
-rw-r--r-- | vendor/rayon/tests/par_bridge_recursion.rs | 1 | ||||
-rw-r--r-- | vendor/rayon/tests/sort-panic-safe.rs | 10 |
9 files changed, 63 insertions, 9 deletions
diff --git a/vendor/rayon/tests/clones.rs b/vendor/rayon/tests/clones.rs index 2b78f0987..0d6c86487 100644 --- a/vendor/rayon/tests/clones.rs +++ b/vendor/rayon/tests/clones.rs @@ -10,6 +10,13 @@ where assert_eq!(a, b); } +fn check_count<I>(iter: I) +where + I: ParallelIterator + Clone, +{ + assert_eq!(iter.clone().count(), iter.count()); +} + #[test] fn clone_binary_heap() { use std::collections::BinaryHeap; @@ -150,8 +157,10 @@ fn clone_adaptors() { check(v.par_iter().panic_fuse()); check(v.par_iter().positions(|_| true)); check(v.par_iter().rev()); - check(v.par_iter().skip(1)); - check(v.par_iter().take(1)); + check(v.par_iter().skip(42)); + check(v.par_iter().skip_any_while(|_| false)); + check(v.par_iter().take(42)); + check(v.par_iter().take_any_while(|_| true)); check(v.par_iter().cloned().while_some()); check(v.par_iter().with_max_len(1)); check(v.par_iter().with_min_len(1)); @@ -161,6 +170,13 @@ fn clone_adaptors() { } #[test] +fn clone_counted_adaptors() { + let v: Vec<_> = (0..1000).collect(); + check_count(v.par_iter().skip_any(42)); + check_count(v.par_iter().take_any(42)); +} + +#[test] fn clone_empty() { check(rayon::iter::empty::<i32>()); } diff --git a/vendor/rayon/tests/collect.rs b/vendor/rayon/tests/collect.rs index 48b80f699..bfb080ceb 100644 --- a/vendor/rayon/tests/collect.rs +++ b/vendor/rayon/tests/collect.rs @@ -6,6 +6,7 @@ use std::sync::atomic::Ordering; use std::sync::Mutex; #[test] +#[cfg_attr(not(panic = "unwind"), ignore)] fn collect_drop_on_unwind() { struct Recorddrop<'a>(i64, &'a Mutex<Vec<i64>>); @@ -61,6 +62,7 @@ fn collect_drop_on_unwind() { } #[test] +#[cfg_attr(not(panic = "unwind"), ignore)] fn collect_drop_on_unwind_zst() { static INSERTS: AtomicUsize = AtomicUsize::new(0); static DROPS: AtomicUsize = AtomicUsize::new(0); diff --git a/vendor/rayon/tests/cross-pool.rs b/vendor/rayon/tests/cross-pool.rs index f0a2128a7..835e2e27f 100644 --- a/vendor/rayon/tests/cross-pool.rs +++ b/vendor/rayon/tests/cross-pool.rs @@ -2,6 +2,7 @@ use rayon::prelude::*; use rayon::ThreadPoolBuilder; #[test] +#[cfg_attr(any(target_os = "emscripten", target_family = "wasm"), ignore)] fn cross_pool_busy() { let pool1 = ThreadPoolBuilder::new().num_threads(1).build().unwrap(); let pool2 = ThreadPoolBuilder::new().num_threads(1).build().unwrap(); diff --git a/vendor/rayon/tests/debug.rs b/vendor/rayon/tests/debug.rs index 1cbf4e6ed..14f37917b 100644 --- a/vendor/rayon/tests/debug.rs +++ b/vendor/rayon/tests/debug.rs @@ -172,7 +172,11 @@ fn debug_adaptors() { check(v.par_iter().positions(|_| true)); check(v.par_iter().rev()); check(v.par_iter().skip(1)); + check(v.par_iter().skip_any(1)); + check(v.par_iter().skip_any_while(|_| false)); check(v.par_iter().take(1)); + check(v.par_iter().take_any(1)); + check(v.par_iter().take_any_while(|_| true)); check(v.par_iter().map(Some).while_some()); check(v.par_iter().with_max_len(1)); check(v.par_iter().with_min_len(1)); diff --git a/vendor/rayon/tests/iter_panic.rs b/vendor/rayon/tests/iter_panic.rs index 37d4d6a3a..c62a8dbda 100644 --- a/vendor/rayon/tests/iter_panic.rs +++ b/vendor/rayon/tests/iter_panic.rs @@ -20,6 +20,7 @@ fn iter_panic() { } #[test] +#[cfg_attr(not(panic = "unwind"), ignore)] fn iter_panic_fuse() { // We only use a single thread in order to make the behavior // of 'panic_fuse' deterministic diff --git a/vendor/rayon/tests/named-threads.rs b/vendor/rayon/tests/named-threads.rs index fd1b0be2d..dadb37ba6 100644 --- a/vendor/rayon/tests/named-threads.rs +++ b/vendor/rayon/tests/named-threads.rs @@ -4,6 +4,7 @@ use rayon::prelude::*; use rayon::*; #[test] +#[cfg_attr(any(target_os = "emscripten", target_family = "wasm"), ignore)] fn named_threads() { ThreadPoolBuilder::new() .thread_name(|i| format!("hello-name-test-{}", i)) diff --git a/vendor/rayon/tests/octillion.rs b/vendor/rayon/tests/octillion.rs index cff2b1192..1af9ad8ba 100644 --- a/vendor/rayon/tests/octillion.rs +++ b/vendor/rayon/tests/octillion.rs @@ -68,7 +68,14 @@ fn two_threads<F: Send + FnOnce() -> R, R: Send>(f: F) -> R { } #[test] -#[cfg_attr(not(target_pointer_width = "64"), ignore)] +#[cfg_attr( + any( + not(target_pointer_width = "64"), + target_os = "emscripten", + target_family = "wasm" + ), + ignore +)] fn find_last_octillion() { // It would be nice if `find_last` could prioritize the later splits, // basically flipping the `join` args, without needing indexed `rev`. @@ -78,32 +85,49 @@ fn find_last_octillion() { } #[test] -#[cfg_attr(not(target_pointer_width = "64"), ignore)] +#[cfg_attr( + any( + not(target_pointer_width = "64"), + target_os = "emscripten", + target_family = "wasm" + ), + ignore +)] fn find_last_octillion_inclusive() { let x = two_threads(|| octillion_inclusive().find_last(|_| true)); assert_eq!(x, Some(OCTILLION)); } #[test] -#[cfg_attr(not(target_pointer_width = "64"), ignore)] +#[cfg_attr( + any( + not(target_pointer_width = "64"), + target_os = "emscripten", + target_family = "wasm" + ), + ignore +)] fn find_last_octillion_flat() { let x = two_threads(|| octillion_flat().find_last(|_| true)); assert_eq!(x, Some(OCTILLION - 1)); } #[test] +#[cfg_attr(any(target_os = "emscripten", target_family = "wasm"), ignore)] fn find_any_octillion() { let x = two_threads(|| octillion().find_any(|x| *x > OCTILLION / 2)); assert!(x.is_some()); } #[test] +#[cfg_attr(any(target_os = "emscripten", target_family = "wasm"), ignore)] fn find_any_octillion_flat() { let x = two_threads(|| octillion_flat().find_any(|x| *x > OCTILLION / 2)); assert!(x.is_some()); } #[test] +#[cfg_attr(any(target_os = "emscripten", target_family = "wasm"), ignore)] fn filter_find_any_octillion() { let x = two_threads(|| { octillion() @@ -114,6 +138,7 @@ fn filter_find_any_octillion() { } #[test] +#[cfg_attr(any(target_os = "emscripten", target_family = "wasm"), ignore)] fn filter_find_any_octillion_flat() { let x = two_threads(|| { octillion_flat() @@ -124,6 +149,7 @@ fn filter_find_any_octillion_flat() { } #[test] +#[cfg_attr(any(target_os = "emscripten", target_family = "wasm"), ignore)] fn fold_find_any_octillion_flat() { let x = two_threads(|| octillion_flat().fold(|| (), |_, _| ()).find_any(|_| true)); assert!(x.is_some()); diff --git a/vendor/rayon/tests/par_bridge_recursion.rs b/vendor/rayon/tests/par_bridge_recursion.rs index 4def0a9e4..3a48ef143 100644 --- a/vendor/rayon/tests/par_bridge_recursion.rs +++ b/vendor/rayon/tests/par_bridge_recursion.rs @@ -4,6 +4,7 @@ use std::iter::once_with; const N: usize = 100_000; #[test] +#[cfg_attr(any(target_os = "emscripten", target_family = "wasm"), ignore)] fn par_bridge_recursion() { let pool = rayon::ThreadPoolBuilder::new() .num_threads(10) diff --git a/vendor/rayon/tests/sort-panic-safe.rs b/vendor/rayon/tests/sort-panic-safe.rs index 00a973106..95ef88d39 100644 --- a/vendor/rayon/tests/sort-panic-safe.rs +++ b/vendor/rayon/tests/sort-panic-safe.rs @@ -8,11 +8,12 @@ use std::sync::atomic::AtomicUsize; use std::sync::atomic::Ordering::Relaxed; use std::thread; -static VERSIONS: AtomicUsize = AtomicUsize::new(0); +const ZERO: AtomicUsize = AtomicUsize::new(0); +const LEN: usize = 20_000; -lazy_static::lazy_static! { - static ref DROP_COUNTS: Vec<AtomicUsize> = (0..20_000).map(|_| AtomicUsize::new(0)).collect(); -} +static VERSIONS: AtomicUsize = ZERO; + +static DROP_COUNTS: [AtomicUsize; LEN] = [ZERO; LEN]; #[derive(Clone, Eq)] struct DropCounter { @@ -117,6 +118,7 @@ macro_rules! test { thread_local!(static SILENCE_PANIC: Cell<bool> = Cell::new(false)); #[test] +#[cfg_attr(any(target_os = "emscripten", target_family = "wasm"), ignore)] fn sort_panic_safe() { let prev = panic::take_hook(); panic::set_hook(Box::new(move |info| { |