diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-04-17 10:31:37 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-04-17 10:31:37 +0200 |
| commit | eb958e1b2e498f4751ac7c36cb2aeb4ce2ab68a0 (patch) | |
| tree | 6e1c2fac1877bdabc52c519385f0af67527fee65 /src/libcore | |
| parent | 23e8aaf4719972884ca825165a0de3ac8a2aaf9e (diff) | |
| parent | d55e4b7a259b887202be91708f839a75b234697c (diff) | |
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/libcore')
| -rw-r--r-- | src/libcore/tests/slice.rs | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/libcore/tests/slice.rs b/src/libcore/tests/slice.rs index 007283b5f69..acf6b03791f 100644 --- a/src/libcore/tests/slice.rs +++ b/src/libcore/tests/slice.rs @@ -1024,22 +1024,31 @@ fn test_rotate_right() { #[test] #[cfg(not(target_arch = "wasm32"))] -#[cfg(not(miri))] // Miri does not support entropy fn sort_unstable() { use core::cmp::Ordering::{Equal, Greater, Less}; use core::slice::heapsort; use rand::{FromEntropy, Rng, rngs::SmallRng, seq::SliceRandom}; + #[cfg(not(miri))] // Miri is too slow + let large_range = 500..510; + #[cfg(not(miri))] // Miri is too slow + let rounds = 100; + + #[cfg(miri)] + let large_range = 0..0; // empty range + #[cfg(miri)] + let rounds = 1; + let mut v = [0; 600]; let mut tmp = [0; 600]; let mut rng = SmallRng::from_entropy(); - for len in (2..25).chain(500..510) { + for len in (2..25).chain(large_range) { let v = &mut v[0..len]; let tmp = &mut tmp[0..len]; for &modulus in &[5, 10, 100, 1000] { - for _ in 0..100 { + for _ in 0..rounds { for i in 0..len { v[i] = rng.gen::<i32>() % modulus; } @@ -1095,7 +1104,7 @@ fn sort_unstable() { #[test] #[cfg(not(target_arch = "wasm32"))] -#[cfg(not(miri))] // Miri does not support entropy +#[cfg(not(miri))] // Miri is too slow fn partition_at_index() { use core::cmp::Ordering::{Equal, Greater, Less}; use rand::rngs::SmallRng; |
