Skip to content

Commit 9b21324

Browse files
committed
Miri now supports entropy, but is still slow
1 parent 07133ac commit 9b21324

File tree

3 files changed

+18
-9
lines changed

3 files changed

+18
-9
lines changed

src/liballoc/tests/binary_heap.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ fn assert_covariance() {
282282
//
283283
// Destructors must be called exactly once per element.
284284
#[test]
285-
#[cfg(not(miri))] // Miri does not support panics nor entropy
285+
#[cfg(not(miri))] // Miri does not support catching panics
286286
fn panic_safe() {
287287
static DROP_COUNTER: AtomicUsize = AtomicUsize::new(0);
288288

src/liballoc/tests/slice.rs

+15-6
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ fn test_reverse() {
389389
}
390390

391391
#[test]
392-
#[cfg(not(miri))] // Miri does not support entropy
392+
#[cfg(not(miri))] // Miri is too slow
393393
fn test_sort() {
394394
let mut rng = thread_rng();
395395

@@ -466,10 +466,19 @@ fn test_sort() {
466466
}
467467

468468
#[test]
469-
#[cfg(not(miri))] // Miri does not support entropy
470469
fn test_sort_stability() {
471-
for len in (2..25).chain(500..510) {
472-
for _ in 0..10 {
470+
#[cfg(not(miri))] // Miri is too slow
471+
let large_limit = 510;
472+
#[cfg(not(miri))] // Miri is too slow
473+
let rounds = 10;
474+
475+
#[cfg(miri)]
476+
let large_limit = 500; // effectively skips the large tests
477+
#[cfg(miri)]
478+
let rounds = 1;
479+
480+
for len in (2..25).chain(500..large_limit) {
481+
for _ in 0..rounds {
473482
let mut counts = [0; 10];
474483

475484
// create a vector like [(6, 1), (5, 1), (6, 2), ...],
@@ -1397,7 +1406,7 @@ fn test_box_slice_clone() {
13971406
#[test]
13981407
#[allow(unused_must_use)] // here, we care about the side effects of `.clone()`
13991408
#[cfg_attr(target_os = "emscripten", ignore)]
1400-
#[cfg(not(miri))] // Miri does not support threads nor entropy
1409+
#[cfg(not(miri))] // Miri does not support threads
14011410
fn test_box_slice_clone_panics() {
14021411
use std::sync::Arc;
14031412
use std::sync::atomic::{AtomicUsize, Ordering};
@@ -1589,7 +1598,7 @@ thread_local!(static SILENCE_PANIC: Cell<bool> = Cell::new(false));
15891598

15901599
#[test]
15911600
#[cfg_attr(target_os = "emscripten", ignore)] // no threads
1592-
#[cfg(not(miri))] // Miri does not support threads nor entropy
1601+
#[cfg(not(miri))] // Miri does not support threads
15931602
fn panic_safe() {
15941603
let prev = panic::take_hook();
15951604
panic::set_hook(Box::new(move |info| {

src/libcore/tests/slice.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1024,7 +1024,7 @@ fn test_rotate_right() {
10241024

10251025
#[test]
10261026
#[cfg(not(target_arch = "wasm32"))]
1027-
#[cfg(not(miri))] // Miri does not support entropy
1027+
#[cfg(not(miri))] // Miri is too slow
10281028
fn sort_unstable() {
10291029
use core::cmp::Ordering::{Equal, Greater, Less};
10301030
use core::slice::heapsort;
@@ -1095,7 +1095,7 @@ fn sort_unstable() {
10951095

10961096
#[test]
10971097
#[cfg(not(target_arch = "wasm32"))]
1098-
#[cfg(not(miri))] // Miri does not support entropy
1098+
#[cfg(not(miri))] // Miri is too slow
10991099
fn partition_at_index() {
11001100
use core::cmp::Ordering::{Equal, Greater, Less};
11011101
use rand::rngs::SmallRng;

0 commit comments

Comments
 (0)