Skip to content

Commit 0d7beed

Browse files
committed
fix cfg for poison test macro
Signed-off-by: Connor Tsui <[email protected]>
1 parent 5e33838 commit 0d7beed

File tree

3 files changed

+39
-39
lines changed

3 files changed

+39
-39
lines changed

library/std/tests/sync/condvar.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ nonpoison_and_poison_unwrap_test!(
1717
}
1818
);
1919

20-
#[cfg_attr(any(target_os = "emscripten", target_os = "wasi"), ignore)] // no threads
20+
#[cfg(not(any(target_os = "emscripten", target_os = "wasi")))] // No threads.
2121
nonpoison_and_poison_unwrap_test!(
2222
name: notify_one,
2323
test_body: {
@@ -38,7 +38,7 @@ nonpoison_and_poison_unwrap_test!(
3838
}
3939
);
4040

41-
#[cfg_attr(any(target_os = "emscripten", target_os = "wasi"), ignore)] // no threads
41+
#[cfg(not(any(target_os = "emscripten", target_os = "wasi")))] // No threads.
4242
nonpoison_and_poison_unwrap_test!(
4343
name: notify_all,
4444
test_body: {
@@ -79,7 +79,7 @@ nonpoison_and_poison_unwrap_test!(
7979
}
8080
);
8181

82-
#[cfg_attr(any(target_os = "emscripten", target_os = "wasi"), ignore)] // no threads
82+
#[cfg(not(any(target_os = "emscripten", target_os = "wasi")))] // No threads.
8383
nonpoison_and_poison_unwrap_test!(
8484
name: test_mutex_arc_condvar,
8585
test_body: {
@@ -116,7 +116,7 @@ nonpoison_and_poison_unwrap_test!(
116116
}
117117
);
118118

119-
#[cfg_attr(any(target_os = "emscripten", target_os = "wasi"), ignore)] // no threads
119+
#[cfg(not(any(target_os = "emscripten", target_os = "wasi")))] // No threads.
120120
nonpoison_and_poison_unwrap_test!(
121121
name: wait_while,
122122
test_body: {
@@ -141,7 +141,7 @@ nonpoison_and_poison_unwrap_test!(
141141
}
142142
);
143143

144-
#[cfg_attr(any(target_os = "emscripten", target_os = "wasi"), ignore)] // no threads
144+
#[cfg(not(any(target_os = "emscripten", target_os = "wasi")))] // No threads.
145145
nonpoison_and_poison_unwrap_test!(
146146
name: wait_timeout_wait,
147147
test_body: {
@@ -164,7 +164,7 @@ nonpoison_and_poison_unwrap_test!(
164164
}
165165
);
166166

167-
#[cfg_attr(any(target_os = "emscripten", target_os = "wasi"), ignore)] // no threads
167+
#[cfg(not(any(target_os = "emscripten", target_os = "wasi")))] // No threads.
168168
nonpoison_and_poison_unwrap_test!(
169169
name: wait_timeout_while_wait,
170170
test_body: {
@@ -180,7 +180,7 @@ nonpoison_and_poison_unwrap_test!(
180180
}
181181
);
182182

183-
#[cfg_attr(any(target_os = "emscripten", target_os = "wasi"), ignore)] // no threads
183+
#[cfg(not(any(target_os = "emscripten", target_os = "wasi")))] // No threads.
184184
nonpoison_and_poison_unwrap_test!(
185185
name: wait_timeout_while_instant_satisfy,
186186
test_body: {
@@ -197,7 +197,7 @@ nonpoison_and_poison_unwrap_test!(
197197
}
198198
);
199199

200-
#[cfg_attr(any(target_os = "emscripten", target_os = "wasi"), ignore)] // no threads
200+
#[cfg(not(any(target_os = "emscripten", target_os = "wasi")))] // No threads.
201201
nonpoison_and_poison_unwrap_test!(
202202
name: wait_timeout_while_wake,
203203
test_body: {
@@ -226,7 +226,7 @@ nonpoison_and_poison_unwrap_test!(
226226
}
227227
);
228228

229-
#[cfg_attr(any(target_os = "emscripten", target_os = "wasi"), ignore)] // no threads
229+
#[cfg(not(any(target_os = "emscripten", target_os = "wasi")))] // No threads.
230230
nonpoison_and_poison_unwrap_test!(
231231
name: wait_timeout_wake,
232232
test_body: {

library/std/tests/sync/mutex.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ nonpoison_and_poison_unwrap_test!(
266266
}
267267
);
268268

269-
#[cfg_attr(not(panic = "unwind"), ignore = "test requires unwinding support")]
269+
#[cfg(panic = "unwind")] // Requires unwinding support.
270270
nonpoison_and_poison_unwrap_test!(
271271
name: test_panics,
272272
test_body: {
@@ -297,7 +297,7 @@ nonpoison_and_poison_unwrap_test!(
297297
}
298298
);
299299

300-
#[cfg_attr(not(panic = "unwind"), ignore = "test requires unwinding support")]
300+
#[cfg(panic = "unwind")] // Requires unwinding support.
301301
nonpoison_and_poison_unwrap_test!(
302302
name: test_mutex_arc_access_in_unwind,
303303
test_body: {
@@ -344,7 +344,7 @@ fn new_poisoned_mutex<T>(value: T) -> Mutex<T> {
344344
}
345345

346346
#[test]
347-
#[cfg_attr(not(panic = "unwind"), ignore = "test requires unwinding support")]
347+
#[cfg(panic = "unwind")] // Requires unwinding support.
348348
fn test_into_inner_poison() {
349349
let m = new_poisoned_mutex(NonCopy(10));
350350

@@ -355,7 +355,7 @@ fn test_into_inner_poison() {
355355
}
356356

357357
#[test]
358-
#[cfg_attr(not(panic = "unwind"), ignore = "test requires unwinding support")]
358+
#[cfg(panic = "unwind")] // Requires unwinding support.
359359
fn test_get_cloned_poison() {
360360
#[derive(Clone, Eq, PartialEq, Debug)]
361361
struct Cloneable(i32);
@@ -369,7 +369,7 @@ fn test_get_cloned_poison() {
369369
}
370370

371371
#[test]
372-
#[cfg_attr(not(panic = "unwind"), ignore = "test requires unwinding support")]
372+
#[cfg(panic = "unwind")] // Requires unwinding support.
373373
fn test_get_mut_poison() {
374374
let mut m = new_poisoned_mutex(NonCopy(10));
375375

@@ -380,7 +380,7 @@ fn test_get_mut_poison() {
380380
}
381381

382382
#[test]
383-
#[cfg_attr(not(panic = "unwind"), ignore = "test requires unwinding support")]
383+
#[cfg(panic = "unwind")] // Requires unwinding support.
384384
fn test_set_poison() {
385385
fn inner<T>(mut init: impl FnMut() -> T, mut value: impl FnMut() -> T)
386386
where
@@ -402,7 +402,7 @@ fn test_set_poison() {
402402
}
403403

404404
#[test]
405-
#[cfg_attr(not(panic = "unwind"), ignore = "test requires unwinding support")]
405+
#[cfg(panic = "unwind")] // Requires unwinding support.
406406
fn test_replace_poison() {
407407
fn inner<T>(mut init: impl FnMut() -> T, mut value: impl FnMut() -> T)
408408
where
@@ -424,7 +424,7 @@ fn test_replace_poison() {
424424
}
425425

426426
#[test]
427-
#[cfg_attr(not(panic = "unwind"), ignore = "test requires unwinding support")]
427+
#[cfg(panic = "unwind")] // Requires unwinding support.
428428
fn test_arc_condvar_poison() {
429429
struct Packet<T>(Arc<(Mutex<T>, Condvar)>);
430430

@@ -456,7 +456,7 @@ fn test_arc_condvar_poison() {
456456
}
457457

458458
#[test]
459-
#[cfg_attr(not(panic = "unwind"), ignore = "test requires unwinding support")]
459+
#[cfg(panic = "unwind")] // Requires unwinding support.
460460
fn test_mutex_arc_poison() {
461461
let arc = Arc::new(Mutex::new(1));
462462
assert!(!arc.is_poisoned());
@@ -471,7 +471,7 @@ fn test_mutex_arc_poison() {
471471
}
472472

473473
#[test]
474-
#[cfg_attr(not(panic = "unwind"), ignore = "test requires unwinding support")]
474+
#[cfg(panic = "unwind")] // Requires unwinding support.
475475
fn test_mutex_arc_poison_mapped() {
476476
let arc = Arc::new(Mutex::new(1));
477477
assert!(!arc.is_poisoned());
@@ -487,7 +487,7 @@ fn test_mutex_arc_poison_mapped() {
487487
}
488488

489489
#[test]
490-
#[cfg_attr(not(panic = "unwind"), ignore = "test requires unwinding support")]
490+
#[cfg(panic = "unwind")] // Requires unwinding support.
491491
fn panic_while_mapping_unlocked_poison() {
492492
let lock = Mutex::new(());
493493

library/std/tests/sync/rwlock.rs

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ nonpoison_and_poison_unwrap_test!(
5050
// FIXME: On macOS we use a provenance-incorrect implementation and Miri
5151
// catches that issue with a chance of around 1/1000.
5252
// See <https://github.com/rust-lang/rust/issues/121950> for details.
53-
#[cfg_attr(all(miri, target_os = "macos"), ignore)]
53+
#[cfg(not(all(miri, target_os = "macos")))]
5454
nonpoison_and_poison_unwrap_test!(
5555
name: frob,
5656
test_body: {
@@ -124,7 +124,7 @@ nonpoison_and_poison_unwrap_test!(
124124
}
125125
);
126126

127-
#[cfg_attr(not(panic = "unwind"), ignore = "test requires unwinding support")]
127+
#[cfg(panic = "unwind")] // Requires unwinding support.
128128
nonpoison_and_poison_unwrap_test!(
129129
name: test_rw_arc_access_in_unwind,
130130
test_body: {
@@ -315,7 +315,7 @@ nonpoison_and_poison_unwrap_test!(
315315

316316
// FIXME: On macOS we use a provenance-incorrect implementation and Miri catches that issue.
317317
// See <https://github.com/rust-lang/rust/issues/121950> for details.
318-
#[cfg_attr(all(miri, target_os = "macos"), ignore)]
318+
#[cfg(not(all(miri, target_os = "macos")))]
319319
nonpoison_and_poison_unwrap_test!(
320320
name: test_downgrade_observe,
321321
test_body: {
@@ -362,7 +362,7 @@ nonpoison_and_poison_unwrap_test!(
362362

363363
// FIXME: On macOS we use a provenance-incorrect implementation and Miri catches that issue.
364364
// See <https://github.com/rust-lang/rust/issues/121950> for details.
365-
#[cfg_attr(all(miri, target_os = "macos"), ignore)]
365+
#[cfg(not(all(miri, target_os = "macos")))]
366366
nonpoison_and_poison_unwrap_test!(
367367
name: test_downgrade_atomic,
368368
test_body: {
@@ -524,7 +524,7 @@ fn new_poisoned_rwlock<T>(value: T) -> RwLock<T> {
524524
}
525525

526526
#[test]
527-
#[cfg_attr(not(panic = "unwind"), ignore = "test requires unwinding support")]
527+
#[cfg(panic = "unwind")] // Requires unwinding support.
528528
fn test_into_inner_poison() {
529529
let m = new_poisoned_rwlock(NonCopy(10));
530530

@@ -535,7 +535,7 @@ fn test_into_inner_poison() {
535535
}
536536

537537
#[test]
538-
#[cfg_attr(not(panic = "unwind"), ignore = "test requires unwinding support")]
538+
#[cfg(panic = "unwind")] // Requires unwinding support.
539539
fn test_get_cloned_poison() {
540540
#[derive(Clone, Eq, PartialEq, Debug)]
541541
struct Cloneable(i32);
@@ -549,7 +549,7 @@ fn test_get_cloned_poison() {
549549
}
550550

551551
#[test]
552-
#[cfg_attr(not(panic = "unwind"), ignore = "test requires unwinding support")]
552+
#[cfg(panic = "unwind")] // Requires unwinding support.
553553
fn test_get_mut_poison() {
554554
let mut m = new_poisoned_rwlock(NonCopy(10));
555555

@@ -560,7 +560,7 @@ fn test_get_mut_poison() {
560560
}
561561

562562
#[test]
563-
#[cfg_attr(not(panic = "unwind"), ignore = "test requires unwinding support")]
563+
#[cfg(panic = "unwind")] // Requires unwinding support.
564564
fn test_set_poison() {
565565
fn inner<T>(mut init: impl FnMut() -> T, mut value: impl FnMut() -> T)
566566
where
@@ -582,7 +582,7 @@ fn test_set_poison() {
582582
}
583583

584584
#[test]
585-
#[cfg_attr(not(panic = "unwind"), ignore = "test requires unwinding support")]
585+
#[cfg(panic = "unwind")] // Requires unwinding support.
586586
fn test_replace_poison() {
587587
fn inner<T>(mut init: impl FnMut() -> T, mut value: impl FnMut() -> T)
588588
where
@@ -604,7 +604,7 @@ fn test_replace_poison() {
604604
}
605605

606606
#[test]
607-
#[cfg_attr(not(panic = "unwind"), ignore = "test requires unwinding support")]
607+
#[cfg(panic = "unwind")] // Requires unwinding support.
608608
fn test_rw_arc_poison_wr() {
609609
let arc = Arc::new(RwLock::new(1));
610610
let arc2 = arc.clone();
@@ -617,7 +617,7 @@ fn test_rw_arc_poison_wr() {
617617
}
618618

619619
#[test]
620-
#[cfg_attr(not(panic = "unwind"), ignore = "test requires unwinding support")]
620+
#[cfg(panic = "unwind")] // Requires unwinding support.
621621
fn test_rw_arc_poison_mapped_w_r() {
622622
let arc = Arc::new(RwLock::new(1));
623623
let arc2 = arc.clone();
@@ -631,7 +631,7 @@ fn test_rw_arc_poison_mapped_w_r() {
631631
}
632632

633633
#[test]
634-
#[cfg_attr(not(panic = "unwind"), ignore = "test requires unwinding support")]
634+
#[cfg(panic = "unwind")] // Requires unwinding support.
635635
fn test_rw_arc_poison_ww() {
636636
let arc = Arc::new(RwLock::new(1));
637637
assert!(!arc.is_poisoned());
@@ -646,7 +646,7 @@ fn test_rw_arc_poison_ww() {
646646
}
647647

648648
#[test]
649-
#[cfg_attr(not(panic = "unwind"), ignore = "test requires unwinding support")]
649+
#[cfg(panic = "unwind")] // Requires unwinding support.
650650
fn test_rw_arc_poison_mapped_w_w() {
651651
let arc = Arc::new(RwLock::new(1));
652652
let arc2 = arc.clone();
@@ -661,7 +661,7 @@ fn test_rw_arc_poison_mapped_w_w() {
661661
}
662662

663663
#[test]
664-
#[cfg_attr(not(panic = "unwind"), ignore = "test requires unwinding support")]
664+
#[cfg(panic = "unwind")] // Requires unwinding support.
665665
fn test_rw_arc_no_poison_rr() {
666666
let arc = Arc::new(RwLock::new(1));
667667
let arc2 = arc.clone();
@@ -675,7 +675,7 @@ fn test_rw_arc_no_poison_rr() {
675675
}
676676

677677
#[test]
678-
#[cfg_attr(not(panic = "unwind"), ignore = "test requires unwinding support")]
678+
#[cfg(panic = "unwind")] // Requires unwinding support.
679679
fn test_rw_arc_no_poison_mapped_r_r() {
680680
let arc = Arc::new(RwLock::new(1));
681681
let arc2 = arc.clone();
@@ -690,7 +690,7 @@ fn test_rw_arc_no_poison_mapped_r_r() {
690690
}
691691

692692
#[test]
693-
#[cfg_attr(not(panic = "unwind"), ignore = "test requires unwinding support")]
693+
#[cfg(panic = "unwind")] // Requires unwinding support.
694694
fn test_rw_arc_no_poison_rw() {
695695
let arc = Arc::new(RwLock::new(1));
696696
let arc2 = arc.clone();
@@ -704,7 +704,7 @@ fn test_rw_arc_no_poison_rw() {
704704
}
705705

706706
#[test]
707-
#[cfg_attr(not(panic = "unwind"), ignore = "test requires unwinding support")]
707+
#[cfg(panic = "unwind")] // Requires unwinding support.
708708
fn test_rw_arc_no_poison_mapped_r_w() {
709709
let arc = Arc::new(RwLock::new(1));
710710
let arc2 = arc.clone();
@@ -719,7 +719,7 @@ fn test_rw_arc_no_poison_mapped_r_w() {
719719
}
720720

721721
#[test]
722-
#[cfg_attr(not(panic = "unwind"), ignore = "test requires unwinding support")]
722+
#[cfg(panic = "unwind")] // Requires unwinding support.
723723
fn panic_while_mapping_read_unlocked_no_poison() {
724724
let lock = RwLock::new(());
725725

@@ -793,7 +793,7 @@ fn panic_while_mapping_read_unlocked_no_poison() {
793793
}
794794

795795
#[test]
796-
#[cfg_attr(not(panic = "unwind"), ignore = "test requires unwinding support")]
796+
#[cfg(panic = "unwind")] // Requires unwinding support.
797797
fn panic_while_mapping_write_unlocked_poison() {
798798
let lock = RwLock::new(());
799799

0 commit comments

Comments
 (0)