about summary refs log tree commit diff
path: root/src/liballoc/tests
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2019-11-23 08:53:53 +0100
committerRalf Jung <post@ralfj.de>2019-11-23 08:53:53 +0100
commita2299799e6193799f4d2cb546e56589c5dd587aa (patch)
treeee031762c265d0cd529bf6a800195b6e3baa7ffb /src/liballoc/tests
parent8af2f22985c672bf4cb23b615ac97af00031a2ca (diff)
downloadrust-a2299799e6193799f4d2cb546e56589c5dd587aa.tar.gz
rust-a2299799e6193799f4d2cb546e56589c5dd587aa.zip
enable more panic-catching tests in Miri
Diffstat (limited to 'src/liballoc/tests')
-rw-r--r--src/liballoc/tests/binary_heap.rs3
-rw-r--r--src/liballoc/tests/slice.rs16
2 files changed, 15 insertions, 4 deletions
diff --git a/src/liballoc/tests/binary_heap.rs b/src/liballoc/tests/binary_heap.rs
index 81b22ca815b..a896a1064d9 100644
--- a/src/liballoc/tests/binary_heap.rs
+++ b/src/liballoc/tests/binary_heap.rs
@@ -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<_>>();
diff --git a/src/liballoc/tests/slice.rs b/src/liballoc/tests/slice.rs
index 6433cbd1842..d9707b95740 100644
--- a/src/liballoc/tests/slice.rs
+++ b/src/liballoc/tests/slice.rs
@@ -1605,12 +1605,17 @@ fn panic_safe() {
     let mut rng = thread_rng();
 
     #[cfg(not(miri))] // Miri is too slow
-    let large_range = 70..MAX_LEN;
+    let lens = (1..20).chain(70..MAX_LEN);
+    #[cfg(not(miri))] // Miri is too slow
+    let moduli = &[5, 20, 50];
+
     #[cfg(miri)]
-    let large_range = 0..0; // empty range
+    let lens = (1..13);
+    #[cfg(miri)]
+    let moduli = &[10];
 
-    for len in (1..20).chain(large_range) {
-        for &modulus in &[5, 20, 50] {
+    for len in lens {
+        for &modulus in moduli {
             for &has_runs in &[false, true] {
                 let mut input = (0..len)
                     .map(|id| {
@@ -1643,6 +1648,9 @@ fn panic_safe() {
             }
         }
     }
+
+    // Set default panic hook again.
+    drop(panic::take_hook());
 }
 
 #[test]