about summary refs log tree commit diff
path: root/src/liballoc/tests/binary_heap.rs
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2019-12-01 04:49:21 +0100
committerGitHub <noreply@github.com>2019-12-01 04:49:21 +0100
commitcb43d82fd65774a6e7bca5c3cd78381d3496b357 (patch)
tree20253ba70970ebebb2b7bf4993d1331d6d52fdd4 /src/liballoc/tests/binary_heap.rs
parent6110d3ebc8224929c8f426def15b9443ffb3258d (diff)
parenta2299799e6193799f4d2cb546e56589c5dd587aa (diff)
downloadrust-cb43d82fd65774a6e7bca5c3cd78381d3496b357.tar.gz
rust-cb43d82fd65774a6e7bca5c3cd78381d3496b357.zip
Rollup merge of #66662 - RalfJung:miri-test-liballoc, r=dtolnay
Miri: run panic-catching tests in liballoc

I also converted two tests from using `thread::spawn(...).join()` just for catching panics, to `catch_panic`, so that Miri can run them.
Diffstat (limited to 'src/liballoc/tests/binary_heap.rs')
-rw-r--r--src/liballoc/tests/binary_heap.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/liballoc/tests/binary_heap.rs b/src/liballoc/tests/binary_heap.rs
index a44cf1eaf6d..a896a1064d9 100644
--- a/src/liballoc/tests/binary_heap.rs
+++ b/src/liballoc/tests/binary_heap.rs
@@ -347,7 +347,7 @@ fn assert_covariance() {
 // Destructors must be called exactly once per element.
 // FIXME: re-enable emscripten once it can unwind again
 #[test]
-#[cfg(not(any(miri, target_os = "emscripten")))] // Miri does not support catching panics
+#[cfg(not(target_os = "emscripten"))]
 fn panic_safe() {
     use std::cmp;
     use std::panic::{self, AssertUnwindSafe};
@@ -376,7 +376,10 @@ fn panic_safe() {
     }
     let mut rng = thread_rng();
     const DATASZ: usize = 32;
+    #[cfg(not(miri))] // Miri is too slow
     const NTEST: usize = 10;
+    #[cfg(miri)]
+    const NTEST: usize = 1;
 
     // don't use 0 in the data -- we want to catch the zeroed-out case.
     let data = (1..=DATASZ).collect::<Vec<_>>();