Skip to content

Commit a229979

Browse files
committed
enable more panic-catching tests in Miri
1 parent 8af2f22 commit a229979

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

src/liballoc/tests/binary_heap.rs

+3
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,10 @@ fn panic_safe() {
376376
}
377377
let mut rng = thread_rng();
378378
const DATASZ: usize = 32;
379+
#[cfg(not(miri))] // Miri is too slow
379380
const NTEST: usize = 10;
381+
#[cfg(miri)]
382+
const NTEST: usize = 1;
380383

381384
// don't use 0 in the data -- we want to catch the zeroed-out case.
382385
let data = (1..=DATASZ).collect::<Vec<_>>();

src/liballoc/tests/slice.rs

+12-4
Original file line numberDiff line numberDiff line change
@@ -1605,12 +1605,17 @@ fn panic_safe() {
16051605
let mut rng = thread_rng();
16061606

16071607
#[cfg(not(miri))] // Miri is too slow
1608-
let large_range = 70..MAX_LEN;
1608+
let lens = (1..20).chain(70..MAX_LEN);
1609+
#[cfg(not(miri))] // Miri is too slow
1610+
let moduli = &[5, 20, 50];
1611+
16091612
#[cfg(miri)]
1610-
let large_range = 0..0; // empty range
1613+
let lens = (1..13);
1614+
#[cfg(miri)]
1615+
let moduli = &[10];
16111616

1612-
for len in (1..20).chain(large_range) {
1613-
for &modulus in &[5, 20, 50] {
1617+
for len in lens {
1618+
for &modulus in moduli {
16141619
for &has_runs in &[false, true] {
16151620
let mut input = (0..len)
16161621
.map(|id| {
@@ -1643,6 +1648,9 @@ fn panic_safe() {
16431648
}
16441649
}
16451650
}
1651+
1652+
// Set default panic hook again.
1653+
drop(panic::take_hook());
16461654
}
16471655

16481656
#[test]

0 commit comments

Comments
 (0)