about summary refs log tree commit diff
path: root/src/liballoc
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2019-04-17 10:31:37 +0200
committerGitHub <noreply@github.com>2019-04-17 10:31:37 +0200
commiteb958e1b2e498f4751ac7c36cb2aeb4ce2ab68a0 (patch)
tree6e1c2fac1877bdabc52c519385f0af67527fee65 /src/liballoc
parent23e8aaf4719972884ca825165a0de3ac8a2aaf9e (diff)
parentd55e4b7a259b887202be91708f839a75b234697c (diff)
downloadrust-eb958e1b2e498f4751ac7c36cb2aeb4ce2ab68a0.tar.gz
rust-eb958e1b2e498f4751ac7c36cb2aeb4ce2ab68a0.zip
Rollup merge of #60018 - RalfJung:miri-test-libstd, r=oli-obk
Miri now supports entropy, but is still slow

Adjust the `cfg` and their comments in the test suites accordingly.
Diffstat (limited to 'src/liballoc')
-rw-r--r--src/liballoc/tests/binary_heap.rs2
-rw-r--r--src/liballoc/tests/slice.rs21
2 files changed, 16 insertions, 7 deletions
diff --git a/src/liballoc/tests/binary_heap.rs b/src/liballoc/tests/binary_heap.rs
index 0930f8dacd4..0685fa943c0 100644
--- a/src/liballoc/tests/binary_heap.rs
+++ b/src/liballoc/tests/binary_heap.rs
@@ -282,7 +282,7 @@ fn assert_covariance() {
 //
 // Destructors must be called exactly once per element.
 #[test]
-#[cfg(not(miri))] // Miri does not support panics nor entropy
+#[cfg(not(miri))] // Miri does not support catching panics
 fn panic_safe() {
     static DROP_COUNTER: AtomicUsize = AtomicUsize::new(0);
 
diff --git a/src/liballoc/tests/slice.rs b/src/liballoc/tests/slice.rs
index b54c128a024..ad2cd7c95eb 100644
--- a/src/liballoc/tests/slice.rs
+++ b/src/liballoc/tests/slice.rs
@@ -389,7 +389,7 @@ fn test_reverse() {
 }
 
 #[test]
-#[cfg(not(miri))] // Miri does not support entropy
+#[cfg(not(miri))] // Miri is too slow
 fn test_sort() {
     let mut rng = thread_rng();
 
@@ -466,10 +466,19 @@ fn test_sort() {
 }
 
 #[test]
-#[cfg(not(miri))] // Miri does not support entropy
 fn test_sort_stability() {
-    for len in (2..25).chain(500..510) {
-        for _ in 0..10 {
+    #[cfg(not(miri))] // Miri is too slow
+    let large_range = 500..510;
+    #[cfg(not(miri))] // Miri is too slow
+    let rounds = 10;
+
+    #[cfg(miri)]
+    let large_range = 0..0; // empty range
+    #[cfg(miri)]
+    let rounds = 1;
+
+    for len in (2..25).chain(large_range) {
+        for _ in 0..rounds {
             let mut counts = [0; 10];
 
             // create a vector like [(6, 1), (5, 1), (6, 2), ...],
@@ -1397,7 +1406,7 @@ fn test_box_slice_clone() {
 #[test]
 #[allow(unused_must_use)] // here, we care about the side effects of `.clone()`
 #[cfg_attr(target_os = "emscripten", ignore)]
-#[cfg(not(miri))] // Miri does not support threads nor entropy
+#[cfg(not(miri))] // Miri does not support threads
 fn test_box_slice_clone_panics() {
     use std::sync::Arc;
     use std::sync::atomic::{AtomicUsize, Ordering};
@@ -1589,7 +1598,7 @@ thread_local!(static SILENCE_PANIC: Cell<bool> = Cell::new(false));
 
 #[test]
 #[cfg_attr(target_os = "emscripten", ignore)] // no threads
-#[cfg(not(miri))] // Miri does not support threads nor entropy
+#[cfg(not(miri))] // Miri does not support threads
 fn panic_safe() {
     let prev = panic::take_hook();
     panic::set_hook(Box::new(move |info| {