Skip to content

Commit 89bc660

Browse files
#255: run Miri on CI
This is allowed to fail, but might produce useful results to check on.
2 parents 2d13059 + 4023d77 commit 89bc660

File tree

2 files changed

+34
-3
lines changed

2 files changed

+34
-3
lines changed

.github/workflows/ci.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,23 @@ jobs:
5858
- name: Run Clippy
5959
run: cargo clippy --all-targets --target ${{ matrix.target }}
6060

61+
miri:
62+
name: "miri"
63+
runs-on: ubuntu-latest
64+
steps:
65+
- uses: actions/checkout@v2
66+
- name: Install Miri
67+
run: |
68+
rustup toolchain install nightly --component miri
69+
rustup override set nightly
70+
cargo miri setup
71+
- name: Test with Miri (failures allowed)
72+
continue-on-error: true
73+
run: |
74+
cargo miri test --test i32_ops
75+
cargo miri test --test f32_ops
76+
cargo miri test --test cast
77+
6178
x86-tests:
6279
name: "${{ matrix.target_feature }} on ${{ matrix.target }}"
6380
runs-on: ${{ matrix.os }}

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)