about summary refs log tree commit diff
path: root/library/core
diff options
context:
space:
mode:
authorPietro Albini <pietro.albini@ferrous-systems.com>2023-06-05 15:13:15 +0200
committerPietro Albini <pietro.albini@ferrous-systems.com>2023-06-13 15:53:24 +0200
commit44556eed363ea17a755a137c68e0af9ab6f522b1 (patch)
tree34087458e77659ebf3c7d370d59d7ce1886e842b /library/core
parent42f28f9eb41adb7a197697e5e2d6535d00fd0f4a (diff)
downloadrust-44556eed363ea17a755a137c68e0af9ab6f522b1.tar.gz
rust-44556eed363ea17a755a137c68e0af9ab6f522b1.zip
ignore core, alloc and test tests that require unwinding on panic=abort
Diffstat (limited to 'library/core')
-rw-r--r--library/core/tests/array.rs15
1 files changed, 3 insertions, 12 deletions
diff --git a/library/core/tests/array.rs b/library/core/tests/array.rs
index 0869644c040..982d7853f69 100644
--- a/library/core/tests/array.rs
+++ b/library/core/tests/array.rs
@@ -257,14 +257,8 @@ fn iterator_drops() {
     assert_eq!(i.get(), 5);
 }
 
-// This test does not work on targets without panic=unwind support.
-// To work around this problem, test is marked is should_panic, so it will
-// be automagically skipped on unsuitable targets, such as
-// wasm32-unknown-unknown.
-//
-// It means that we use panic for indicating success.
-#[test]
-#[should_panic(expected = "test succeeded")]
+#[test]
+#[cfg_attr(not(panic = "unwind"), ignore = "test requires unwinding support")]
 fn array_default_impl_avoids_leaks_on_panic() {
     use core::sync::atomic::{AtomicUsize, Ordering::Relaxed};
     static COUNTER: AtomicUsize = AtomicUsize::new(0);
@@ -296,7 +290,6 @@ fn array_default_impl_avoids_leaks_on_panic() {
     assert_eq!(*panic_msg, "bomb limit exceeded");
     // check that all bombs are successfully dropped
     assert_eq!(COUNTER.load(Relaxed), 0);
-    panic!("test succeeded")
 }
 
 #[test]
@@ -317,9 +310,8 @@ fn array_map() {
     assert_eq!(b, [1, 2, 3]);
 }
 
-// See note on above test for why `should_panic` is used.
 #[test]
-#[should_panic(expected = "test succeeded")]
+#[cfg_attr(not(panic = "unwind"), ignore = "test requires unwinding support")]
 fn array_map_drop_safety() {
     static DROPPED: AtomicUsize = AtomicUsize::new(0);
     struct DropCounter;
@@ -341,7 +333,6 @@ fn array_map_drop_safety() {
     });
     assert!(success.is_err());
     assert_eq!(DROPPED.load(Ordering::SeqCst), num_to_create);
-    panic!("test succeeded")
 }
 
 #[test]