Rollup merge of #74974 - RalfJung:miri-tests, r=Mark-Simulacrum
Make tests faster in Miri Reduce some test iteration counts in Miri.
This commit is contained in:
commit
7d18040b0c
@ -107,7 +107,8 @@ fn test_insert() {
|
|||||||
let cap = tester.capacity();
|
let cap = tester.capacity();
|
||||||
|
|
||||||
// len is the length *after* insertion
|
// len is the length *after* insertion
|
||||||
for len in 1..cap {
|
let minlen = if cfg!(miri) { cap - 1 } else { 1 }; // Miri is too slow
|
||||||
|
for len in minlen..cap {
|
||||||
// 0, 1, 2, .., len - 1
|
// 0, 1, 2, .., len - 1
|
||||||
let expected = (0..).take(len).collect::<VecDeque<_>>();
|
let expected = (0..).take(len).collect::<VecDeque<_>>();
|
||||||
for tail_pos in 0..cap {
|
for tail_pos in 0..cap {
|
||||||
@ -221,7 +222,8 @@ fn test_remove() {
|
|||||||
let cap = tester.capacity();
|
let cap = tester.capacity();
|
||||||
|
|
||||||
// len is the length *after* removal
|
// len is the length *after* removal
|
||||||
for len in 0..cap - 1 {
|
let minlen = if cfg!(miri) { cap - 2 } else { 0 }; // Miri is too slow
|
||||||
|
for len in minlen..cap - 1 {
|
||||||
// 0, 1, 2, .., len - 1
|
// 0, 1, 2, .., len - 1
|
||||||
let expected = (0..).take(len).collect::<VecDeque<_>>();
|
let expected = (0..).take(len).collect::<VecDeque<_>>();
|
||||||
for tail_pos in 0..cap {
|
for tail_pos in 0..cap {
|
||||||
@ -251,7 +253,8 @@ fn test_range() {
|
|||||||
let mut tester: VecDeque<usize> = VecDeque::with_capacity(7);
|
let mut tester: VecDeque<usize> = VecDeque::with_capacity(7);
|
||||||
|
|
||||||
let cap = tester.capacity();
|
let cap = tester.capacity();
|
||||||
for len in 0..=cap {
|
let minlen = if cfg!(miri) { cap - 1 } else { 0 }; // Miri is too slow
|
||||||
|
for len in minlen..=cap {
|
||||||
for tail in 0..=cap {
|
for tail in 0..=cap {
|
||||||
for start in 0..=len {
|
for start in 0..=len {
|
||||||
for end in start..=len {
|
for end in start..=len {
|
||||||
@ -384,7 +387,8 @@ fn test_split_off() {
|
|||||||
let cap = tester.capacity();
|
let cap = tester.capacity();
|
||||||
|
|
||||||
// len is the length *before* splitting
|
// len is the length *before* splitting
|
||||||
for len in 0..cap {
|
let minlen = if cfg!(miri) { cap - 1 } else { 0 }; // Miri is too slow
|
||||||
|
for len in minlen..cap {
|
||||||
// index to split at
|
// index to split at
|
||||||
for at in 0..=len {
|
for at in 0..=len {
|
||||||
// 0, 1, 2, .., at - 1 (may be empty)
|
// 0, 1, 2, .., at - 1 (may be empty)
|
||||||
@ -495,8 +499,9 @@ fn create_vec_and_test_convert(capacity: usize, offset: usize, len: usize) {
|
|||||||
fn test_clone_from() {
|
fn test_clone_from() {
|
||||||
let m = vec![1; 8];
|
let m = vec![1; 8];
|
||||||
let n = vec![2; 12];
|
let n = vec![2; 12];
|
||||||
for pfv in 0..8 {
|
let limit = if cfg!(miri) { 4 } else { 8 }; // Miri is too slow
|
||||||
for pfu in 0..8 {
|
for pfv in 0..limit {
|
||||||
|
for pfu in 0..limit {
|
||||||
for longer in 0..2 {
|
for longer in 0..2 {
|
||||||
let (vr, ur) = if longer == 0 { (&m, &n) } else { (&n, &m) };
|
let (vr, ur) = if longer == 0 { (&m, &n) } else { (&n, &m) };
|
||||||
let mut v = VecDeque::from(vr.clone());
|
let mut v = VecDeque::from(vr.clone());
|
||||||
|
@ -1721,8 +1721,8 @@ fn panic_safe() {
|
|||||||
|
|
||||||
let mut rng = thread_rng();
|
let mut rng = thread_rng();
|
||||||
|
|
||||||
// Miri is too slow
|
// Miri is too slow (but still need to `chain` to make the types match)
|
||||||
let lens = if cfg!(miri) { (1..10).chain(20..21) } else { (1..20).chain(70..MAX_LEN) };
|
let lens = if cfg!(miri) { (1..10).chain(0..0) } else { (1..20).chain(70..MAX_LEN) };
|
||||||
let moduli: &[u32] = if cfg!(miri) { &[5] } else { &[5, 20, 50] };
|
let moduli: &[u32] = if cfg!(miri) { &[5] } else { &[5, 20, 50] };
|
||||||
|
|
||||||
for len in lens {
|
for len in lens {
|
||||||
|
@ -188,7 +188,7 @@ fn exact_f32_random_equivalence_test() {
|
|||||||
fn exact_f64_random_equivalence_test() {
|
fn exact_f64_random_equivalence_test() {
|
||||||
use core::num::flt2dec::strategy::dragon::format_exact as fallback;
|
use core::num::flt2dec::strategy::dragon::format_exact as fallback;
|
||||||
// Miri is too slow
|
// Miri is too slow
|
||||||
let n = if cfg!(miri) { 3 } else { 1_000 };
|
let n = if cfg!(miri) { 2 } else { 1_000 };
|
||||||
|
|
||||||
for k in 1..21 {
|
for k in 1..21 {
|
||||||
f64_random_equivalence_test(
|
f64_random_equivalence_test(
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
use core::num::flt2dec::strategy::grisu::*;
|
use core::num::flt2dec::strategy::grisu::*;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[cfg_attr(miri, ignore)] // Miri is too slow
|
||||||
fn test_cached_power() {
|
fn test_cached_power() {
|
||||||
assert_eq!(CACHED_POW10.first().unwrap().1, CACHED_POW10_FIRST_E);
|
assert_eq!(CACHED_POW10.first().unwrap().1, CACHED_POW10_FIRST_E);
|
||||||
assert_eq!(CACHED_POW10.last().unwrap().1, CACHED_POW10_LAST_E);
|
assert_eq!(CACHED_POW10.last().unwrap().1, CACHED_POW10_LAST_E);
|
||||||
|
@ -1358,15 +1358,15 @@ fn sort_unstable() {
|
|||||||
use core::slice::heapsort;
|
use core::slice::heapsort;
|
||||||
use rand::{rngs::StdRng, seq::SliceRandom, Rng, SeedableRng};
|
use rand::{rngs::StdRng, seq::SliceRandom, Rng, SeedableRng};
|
||||||
|
|
||||||
// Miri is too slow
|
// Miri is too slow (but still need to `chain` to make the types match)
|
||||||
let large_range = if cfg!(miri) { 0..0 } else { 500..510 };
|
let lens = if cfg!(miri) { (2..20).chain(0..0) } else { (2..25).chain(500..510) };
|
||||||
let rounds = if cfg!(miri) { 1 } else { 100 };
|
let rounds = if cfg!(miri) { 1 } else { 100 };
|
||||||
|
|
||||||
let mut v = [0; 600];
|
let mut v = [0; 600];
|
||||||
let mut tmp = [0; 600];
|
let mut tmp = [0; 600];
|
||||||
let mut rng = StdRng::from_entropy();
|
let mut rng = StdRng::from_entropy();
|
||||||
|
|
||||||
for len in (2..25).chain(large_range) {
|
for len in lens {
|
||||||
let v = &mut v[0..len];
|
let v = &mut v[0..len];
|
||||||
let tmp = &mut tmp[0..len];
|
let tmp = &mut tmp[0..len];
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user