Skip to content

Commit ae79f0e

Browse files
committed
Filter tests that need true threading
1 parent 2898830 commit ae79f0e

File tree

16 files changed

+104
-3
lines changed

16 files changed

+104
-3
lines changed

rayon-core/src/broadcast/test.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ fn broadcast_global() {
1212
}
1313

1414
#[test]
15+
#[cfg_attr(any(target_os = "emscripten", target_family = "wasm"), ignore)]
1516
fn spawn_broadcast_global() {
1617
let (tx, rx) = crossbeam_channel::unbounded();
1718
crate::spawn_broadcast(move |ctx| tx.send(ctx.index()).unwrap());
@@ -22,13 +23,15 @@ fn spawn_broadcast_global() {
2223
}
2324

2425
#[test]
26+
#[cfg_attr(any(target_os = "emscripten", target_family = "wasm"), ignore)]
2527
fn broadcast_pool() {
2628
let pool = ThreadPoolBuilder::new().num_threads(7).build().unwrap();
2729
let v = pool.broadcast(|ctx| ctx.index());
2830
assert!(v.into_iter().eq(0..7));
2931
}
3032

3133
#[test]
34+
#[cfg_attr(any(target_os = "emscripten", target_family = "wasm"), ignore)]
3235
fn spawn_broadcast_pool() {
3336
let (tx, rx) = crossbeam_channel::unbounded();
3437
let pool = ThreadPoolBuilder::new().num_threads(7).build().unwrap();
@@ -40,13 +43,15 @@ fn spawn_broadcast_pool() {
4043
}
4144

4245
#[test]
46+
#[cfg_attr(any(target_os = "emscripten", target_family = "wasm"), ignore)]
4347
fn broadcast_self() {
4448
let pool = ThreadPoolBuilder::new().num_threads(7).build().unwrap();
4549
let v = pool.install(|| crate::broadcast(|ctx| ctx.index()));
4650
assert!(v.into_iter().eq(0..7));
4751
}
4852

4953
#[test]
54+
#[cfg_attr(any(target_os = "emscripten", target_family = "wasm"), ignore)]
5055
fn spawn_broadcast_self() {
5156
let (tx, rx) = crossbeam_channel::unbounded();
5257
let pool = ThreadPoolBuilder::new().num_threads(7).build().unwrap();
@@ -58,6 +63,7 @@ fn spawn_broadcast_self() {
5863
}
5964

6065
#[test]
66+
#[cfg_attr(any(target_os = "emscripten", target_family = "wasm"), ignore)]
6167
fn broadcast_mutual() {
6268
let count = AtomicUsize::new(0);
6369
let pool1 = ThreadPoolBuilder::new().num_threads(3).build().unwrap();
@@ -73,6 +79,7 @@ fn broadcast_mutual() {
7379
}
7480

7581
#[test]
82+
#[cfg_attr(any(target_os = "emscripten", target_family = "wasm"), ignore)]
7683
fn spawn_broadcast_mutual() {
7784
let (tx, rx) = crossbeam_channel::unbounded();
7885
let pool1 = Arc::new(ThreadPoolBuilder::new().num_threads(3).build().unwrap());
@@ -90,6 +97,7 @@ fn spawn_broadcast_mutual() {
9097
}
9198

9299
#[test]
100+
#[cfg_attr(any(target_os = "emscripten", target_family = "wasm"), ignore)]
93101
fn broadcast_mutual_sleepy() {
94102
let count = AtomicUsize::new(0);
95103
let pool1 = ThreadPoolBuilder::new().num_threads(3).build().unwrap();
@@ -108,6 +116,7 @@ fn broadcast_mutual_sleepy() {
108116
}
109117

110118
#[test]
119+
#[cfg_attr(any(target_os = "emscripten", target_family = "wasm"), ignore)]
111120
fn spawn_broadcast_mutual_sleepy() {
112121
let (tx, rx) = crossbeam_channel::unbounded();
113122
let pool1 = Arc::new(ThreadPoolBuilder::new().num_threads(3).build().unwrap());
@@ -206,6 +215,7 @@ fn spawn_broadcast_panic_many() {
206215
}
207216

208217
#[test]
218+
#[cfg_attr(any(target_os = "emscripten", target_family = "wasm"), ignore)]
209219
fn broadcast_sleep_race() {
210220
let test_duration = time::Duration::from_secs(1);
211221
let pool = ThreadPoolBuilder::new().num_threads(7).build().unwrap();

rayon-core/src/join/test.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ fn sort() {
4747
}
4848

4949
#[test]
50+
#[cfg_attr(any(target_os = "emscripten", target_family = "wasm"), ignore)]
5051
fn sort_in_pool() {
5152
let rng = seeded_rng();
5253
let mut data: Vec<u32> = rng.sample_iter(&Standard).take(12 * 1024).collect();
@@ -87,6 +88,7 @@ fn panic_b_still_executes() {
8788
}
8889

8990
#[test]
91+
#[cfg_attr(any(target_os = "emscripten", target_family = "wasm"), ignore)]
9092
fn join_context_both() {
9193
// If we're not in a pool, both should be marked stolen as they're injected.
9294
let (a_migrated, b_migrated) = join_context(|a| a.migrated(), |b| b.migrated());
@@ -95,6 +97,7 @@ fn join_context_both() {
9597
}
9698

9799
#[test]
100+
#[cfg_attr(any(target_os = "emscripten", target_family = "wasm"), ignore)]
98101
fn join_context_neither() {
99102
// If we're already in a 1-thread pool, neither job should be stolen.
100103
let pool = ThreadPoolBuilder::new().num_threads(1).build().unwrap();
@@ -105,6 +108,7 @@ fn join_context_neither() {
105108
}
106109

107110
#[test]
111+
#[cfg_attr(any(target_os = "emscripten", target_family = "wasm"), ignore)]
108112
fn join_context_second() {
109113
use std::sync::Barrier;
110114

@@ -128,6 +132,7 @@ fn join_context_second() {
128132
}
129133

130134
#[test]
135+
#[cfg_attr(any(target_os = "emscripten", target_family = "wasm"), ignore)]
131136
fn join_counter_overflow() {
132137
const MAX: u32 = 500_000;
133138

rayon-core/src/scope/test.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ fn update_tree() {
148148
/// linearly with N. We test this by some unsafe hackery and
149149
/// permitting an approx 10% change with a 10x input change.
150150
#[test]
151+
#[cfg_attr(any(target_os = "emscripten", target_family = "wasm"), ignore)]
151152
fn linear_stack_growth() {
152153
let builder = ThreadPoolBuilder::new().num_threads(1);
153154
let pool = builder.build().unwrap();
@@ -296,6 +297,7 @@ macro_rules! test_order {
296297
}
297298

298299
#[test]
300+
#[cfg_attr(any(target_os = "emscripten", target_family = "wasm"), ignore)]
299301
fn lifo_order() {
300302
// In the absence of stealing, `scope()` runs its `spawn()` jobs in LIFO order.
301303
let vec = test_order!(scope => spawn);
@@ -304,6 +306,7 @@ fn lifo_order() {
304306
}
305307

306308
#[test]
309+
#[cfg_attr(any(target_os = "emscripten", target_family = "wasm"), ignore)]
307310
fn fifo_order() {
308311
// In the absence of stealing, `scope_fifo()` runs its `spawn_fifo()` jobs in FIFO order.
309312
let vec = test_order!(scope_fifo => spawn_fifo);
@@ -338,6 +341,7 @@ macro_rules! test_nested_order {
338341
}
339342

340343
#[test]
344+
#[cfg_attr(any(target_os = "emscripten", target_family = "wasm"), ignore)]
341345
fn nested_lifo_order() {
342346
// In the absence of stealing, `scope()` runs its `spawn()` jobs in LIFO order.
343347
let vec = test_nested_order!(scope => spawn, scope => spawn);
@@ -346,6 +350,7 @@ fn nested_lifo_order() {
346350
}
347351

348352
#[test]
353+
#[cfg_attr(any(target_os = "emscripten", target_family = "wasm"), ignore)]
349354
fn nested_fifo_order() {
350355
// In the absence of stealing, `scope_fifo()` runs its `spawn_fifo()` jobs in FIFO order.
351356
let vec = test_nested_order!(scope_fifo => spawn_fifo, scope_fifo => spawn_fifo);
@@ -354,6 +359,7 @@ fn nested_fifo_order() {
354359
}
355360

356361
#[test]
362+
#[cfg_attr(any(target_os = "emscripten", target_family = "wasm"), ignore)]
357363
fn nested_lifo_fifo_order() {
358364
// LIFO on the outside, FIFO on the inside
359365
let vec = test_nested_order!(scope => spawn, scope_fifo => spawn_fifo);
@@ -365,6 +371,7 @@ fn nested_lifo_fifo_order() {
365371
}
366372

367373
#[test]
374+
#[cfg_attr(any(target_os = "emscripten", target_family = "wasm"), ignore)]
368375
fn nested_fifo_lifo_order() {
369376
// FIFO on the outside, LIFO on the inside
370377
let vec = test_nested_order!(scope_fifo => spawn_fifo, scope => spawn);
@@ -407,6 +414,7 @@ macro_rules! test_mixed_order {
407414
}
408415

409416
#[test]
417+
#[cfg_attr(any(target_os = "emscripten", target_family = "wasm"), ignore)]
410418
fn mixed_lifo_order() {
411419
// NB: the end of the inner scope makes us execute some of the outer scope
412420
// before they've all been spawned, so they're not perfectly LIFO.
@@ -416,13 +424,15 @@ fn mixed_lifo_order() {
416424
}
417425

418426
#[test]
427+
#[cfg_attr(any(target_os = "emscripten", target_family = "wasm"), ignore)]
419428
fn mixed_fifo_order() {
420429
let vec = test_mixed_order!(scope_fifo => spawn_fifo, scope_fifo => spawn_fifo);
421430
let expected = vec![-1, 0, -2, 1, -3, 2, 3];
422431
assert_eq!(vec, expected);
423432
}
424433

425434
#[test]
435+
#[cfg_attr(any(target_os = "emscripten", target_family = "wasm"), ignore)]
426436
fn mixed_lifo_fifo_order() {
427437
// NB: the end of the inner scope makes us execute some of the outer scope
428438
// before they've all been spawned, so they're not perfectly LIFO.
@@ -432,6 +442,7 @@ fn mixed_lifo_fifo_order() {
432442
}
433443

434444
#[test]
445+
#[cfg_attr(any(target_os = "emscripten", target_family = "wasm"), ignore)]
435446
fn mixed_fifo_lifo_order() {
436447
let vec = test_mixed_order!(scope_fifo => spawn_fifo, scope => spawn);
437448
let expected = vec![-3, 0, -2, 1, -1, 2, 3];
@@ -557,6 +568,7 @@ fn scope_spawn_broadcast_nested() {
557568
}
558569

559570
#[test]
571+
#[cfg_attr(any(target_os = "emscripten", target_family = "wasm"), ignore)]
560572
fn scope_spawn_broadcast_barrier() {
561573
let barrier = Barrier::new(8);
562574
let pool = ThreadPoolBuilder::new().num_threads(7).build().unwrap();
@@ -569,6 +581,7 @@ fn scope_spawn_broadcast_barrier() {
569581
}
570582

571583
#[test]
584+
#[cfg_attr(any(target_os = "emscripten", target_family = "wasm"), ignore)]
572585
fn scope_spawn_broadcast_panic_one() {
573586
let count = AtomicUsize::new(0);
574587
let pool = ThreadPoolBuilder::new().num_threads(7).build().unwrap();
@@ -587,6 +600,7 @@ fn scope_spawn_broadcast_panic_one() {
587600
}
588601

589602
#[test]
603+
#[cfg_attr(any(target_os = "emscripten", target_family = "wasm"), ignore)]
590604
fn scope_spawn_broadcast_panic_many() {
591605
let count = AtomicUsize::new(0);
592606
let pool = ThreadPoolBuilder::new().num_threads(7).build().unwrap();

rayon-core/src/spawn/test.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ use super::{spawn, spawn_fifo};
77
use crate::ThreadPoolBuilder;
88

99
#[test]
10+
#[cfg_attr(any(target_os = "emscripten", target_family = "wasm"), ignore)]
1011
fn spawn_then_join_in_worker() {
1112
let (tx, rx) = channel();
1213
scope(move |_| {
@@ -16,6 +17,7 @@ fn spawn_then_join_in_worker() {
1617
}
1718

1819
#[test]
20+
#[cfg_attr(any(target_os = "emscripten", target_family = "wasm"), ignore)]
1921
fn spawn_then_join_outside_worker() {
2022
let (tx, rx) = channel();
2123
spawn(move || tx.send(22).unwrap());
@@ -55,6 +57,7 @@ fn panic_fwd() {
5557
/// still active asynchronous tasks. We expect the thread-pool to stay
5658
/// alive and executing until those threads are complete.
5759
#[test]
60+
#[cfg_attr(any(target_os = "emscripten", target_family = "wasm"), ignore)]
5861
fn termination_while_things_are_executing() {
5962
let (tx0, rx0) = channel();
6063
let (tx1, rx1) = channel();
@@ -168,6 +171,7 @@ macro_rules! test_order {
168171
}
169172

170173
#[test]
174+
#[cfg_attr(any(target_os = "emscripten", target_family = "wasm"), ignore)]
171175
fn lifo_order() {
172176
// In the absence of stealing, `spawn()` jobs on a thread will run in LIFO order.
173177
let vec = test_order!(spawn, spawn);
@@ -176,6 +180,7 @@ fn lifo_order() {
176180
}
177181

178182
#[test]
183+
#[cfg_attr(any(target_os = "emscripten", target_family = "wasm"), ignore)]
179184
fn fifo_order() {
180185
// In the absence of stealing, `spawn_fifo()` jobs on a thread will run in FIFO order.
181186
let vec = test_order!(spawn_fifo, spawn_fifo);
@@ -184,6 +189,7 @@ fn fifo_order() {
184189
}
185190

186191
#[test]
192+
#[cfg_attr(any(target_os = "emscripten", target_family = "wasm"), ignore)]
187193
fn lifo_fifo_order() {
188194
// LIFO on the outside, FIFO on the inside
189195
let vec = test_order!(spawn, spawn_fifo);
@@ -195,6 +201,7 @@ fn lifo_fifo_order() {
195201
}
196202

197203
#[test]
204+
#[cfg_attr(any(target_os = "emscripten", target_family = "wasm"), ignore)]
198205
fn fifo_lifo_order() {
199206
// FIFO on the outside, LIFO on the inside
200207
let vec = test_order!(spawn_fifo, spawn);
@@ -232,13 +239,15 @@ macro_rules! test_mixed_order {
232239
}
233240

234241
#[test]
242+
#[cfg_attr(any(target_os = "emscripten", target_family = "wasm"), ignore)]
235243
fn mixed_lifo_fifo_order() {
236244
let vec = test_mixed_order!(spawn, spawn_fifo);
237245
let expected = vec![3, -1, 2, -2, 1, -3, 0];
238246
assert_eq!(vec, expected);
239247
}
240248

241249
#[test]
250+
#[cfg_attr(any(target_os = "emscripten", target_family = "wasm"), ignore)]
242251
fn mixed_fifo_lifo_order() {
243252
let vec = test_mixed_order!(spawn_fifo, spawn);
244253
let expected = vec![0, -3, 1, -2, 2, -1, 3];

rayon-core/src/test.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use std::sync::atomic::{AtomicUsize, Ordering};
55
use std::sync::{Arc, Barrier};
66

77
#[test]
8+
#[cfg_attr(any(target_os = "emscripten", target_family = "wasm"), ignore)]
89
fn worker_thread_index() {
910
let pool = ThreadPoolBuilder::new().num_threads(22).build().unwrap();
1011
assert_eq!(pool.current_num_threads(), 22);
@@ -14,6 +15,7 @@ fn worker_thread_index() {
1415
}
1516

1617
#[test]
18+
#[cfg_attr(any(target_os = "emscripten", target_family = "wasm"), ignore)]
1719
fn start_callback_called() {
1820
let n_threads = 16;
1921
let n_called = Arc::new(AtomicUsize::new(0));
@@ -40,6 +42,7 @@ fn start_callback_called() {
4042
}
4143

4244
#[test]
45+
#[cfg_attr(any(target_os = "emscripten", target_family = "wasm"), ignore)]
4346
fn exit_callback_called() {
4447
let n_threads = 16;
4548
let n_called = Arc::new(AtomicUsize::new(0));
@@ -69,6 +72,7 @@ fn exit_callback_called() {
6972
}
7073

7174
#[test]
75+
#[cfg_attr(any(target_os = "emscripten", target_family = "wasm"), ignore)]
7276
fn handler_panics_handled_correctly() {
7377
let n_threads = 16;
7478
let n_called = Arc::new(AtomicUsize::new(0));
@@ -119,6 +123,7 @@ fn handler_panics_handled_correctly() {
119123
}
120124

121125
#[test]
126+
#[cfg_attr(any(target_os = "emscripten", target_family = "wasm"), ignore)]
122127
fn check_config_build() {
123128
let pool = ThreadPoolBuilder::new().num_threads(22).build().unwrap();
124129
assert_eq!(pool.current_num_threads(), 22);
@@ -134,6 +139,7 @@ fn check_error_send_sync() {
134139

135140
#[allow(deprecated)]
136141
#[test]
142+
#[cfg_attr(any(target_os = "emscripten", target_family = "wasm"), ignore)]
137143
fn configuration() {
138144
let start_handler = move |_| {};
139145
let exit_handler = move |_| {};
@@ -154,6 +160,7 @@ fn configuration() {
154160
}
155161

156162
#[test]
163+
#[cfg_attr(any(target_os = "emscripten", target_family = "wasm"), ignore)]
157164
fn default_pool() {
158165
ThreadPoolBuilder::default().build().unwrap();
159166
}
@@ -162,6 +169,7 @@ fn default_pool() {
162169
/// the pool is done with them, allowing them to be used with rayon again
163170
/// later. e.g. WebAssembly want to have their own pool of available threads.
164171
#[test]
172+
#[cfg_attr(any(target_os = "emscripten", target_family = "wasm"), ignore)]
165173
fn cleared_current_thread() -> Result<(), ThreadPoolBuildError> {
166174
let n_threads = 5;
167175
let mut handles = vec![];

0 commit comments

Comments
 (0)