Skip to content

Commit adbd479

Browse files
committed
reduce number of tests being run under Miri
1 parent 2d13059 commit adbd479

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

crates/test_helpers/src/lib.rs

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,19 +77,29 @@ impl<T: core::fmt::Debug + DefaultStrategy, const LANES: usize> DefaultStrategy
7777
}
7878
}
7979

80+
#[cfg(not(miri))]
81+
fn make_runner() -> proptest::test_runner::TestRunner {
82+
Default::default()
83+
}
84+
#[cfg(miri)]
85+
fn make_runner() -> proptest::test_runner::TestRunner {
86+
// Only run a few tests on Miri
87+
proptest::test_runner::TestRunner::new(proptest::test_runner::Config::with_cases(4))
88+
}
89+
8090
/// Test a function that takes a single value.
8191
pub fn test_1<A: core::fmt::Debug + DefaultStrategy>(
8292
f: &dyn Fn(A) -> proptest::test_runner::TestCaseResult,
8393
) {
84-
let mut runner = proptest::test_runner::TestRunner::default();
94+
let mut runner = make_runner();
8595
runner.run(&A::default_strategy(), f).unwrap();
8696
}
8797

8898
/// Test a function that takes two values.
8999
pub fn test_2<A: core::fmt::Debug + DefaultStrategy, B: core::fmt::Debug + DefaultStrategy>(
90100
f: &dyn Fn(A, B) -> proptest::test_runner::TestCaseResult,
91101
) {
92-
let mut runner = proptest::test_runner::TestRunner::default();
102+
let mut runner = make_runner();
93103
runner
94104
.run(&(A::default_strategy(), B::default_strategy()), |(a, b)| {
95105
f(a, b)
@@ -105,7 +115,7 @@ pub fn test_3<
105115
>(
106116
f: &dyn Fn(A, B, C) -> proptest::test_runner::TestCaseResult,
107117
) {
108-
let mut runner = proptest::test_runner::TestRunner::default();
118+
let mut runner = make_runner();
109119
runner
110120
.run(
111121
&(
@@ -361,24 +371,28 @@ macro_rules! test_lanes {
361371

362372
#[test]
363373
#[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
374+
#[cfg(not(miri))] // Miri intrinsic implementations are uniform and larger tests are sloooow
364375
fn lanes_8() {
365376
implementation::<8>();
366377
}
367378

368379
#[test]
369380
#[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
381+
#[cfg(not(miri))] // Miri intrinsic implementations are uniform and larger tests are sloooow
370382
fn lanes_16() {
371383
implementation::<16>();
372384
}
373385

374386
#[test]
375387
#[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
388+
#[cfg(not(miri))] // Miri intrinsic implementations are uniform and larger tests are sloooow
376389
fn lanes_32() {
377390
implementation::<32>();
378391
}
379392

380393
#[test]
381394
#[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
395+
#[cfg(not(miri))] // Miri intrinsic implementations are uniform and larger tests are sloooow
382396
fn lanes_64() {
383397
implementation::<64>();
384398
}

0 commit comments

Comments
 (0)