diff --git a/src/tools/miri/.github/workflows/ci.yml b/src/tools/miri/.github/workflows/ci.yml index 81df0964d591..59bae513a58f 100644 --- a/src/tools/miri/.github/workflows/ci.yml +++ b/src/tools/miri/.github/workflows/ci.yml @@ -30,6 +30,8 @@ jobs: steps: - uses: actions/checkout@v4 - uses: ./.github/workflows/setup + with: + toolchain_flags: "--host ${{ matrix.host_target }}" # The `style` job only runs on Linux; this makes sure the Windows-host-specific # code is also covered by clippy. diff --git a/src/tools/miri/.github/workflows/setup/action.yml b/src/tools/miri/.github/workflows/setup/action.yml index bf5749a7b17e..146b432171e1 100644 --- a/src/tools/miri/.github/workflows/setup/action.yml +++ b/src/tools/miri/.github/workflows/setup/action.yml @@ -1,5 +1,9 @@ name: "Miri CI setup" description: "Sets up Miri CI" +inputs: + toolchain_flags: + required: false + default: '' runs: using: "composite" steps: @@ -45,7 +49,7 @@ runs: echo "Building against latest rustc git version" git ls-remote https://github.com/rust-lang/rust/ HEAD | cut -f 1 > rust-version fi - ./miri toolchain + ./miri toolchain ${{ inputs.toolchain_flags }} shell: bash - name: Show Rust version (miri toolchain) diff --git a/src/tools/miri/ci/ci.sh b/src/tools/miri/ci/ci.sh index 5583030b490a..3327ad17c44e 100755 --- a/src/tools/miri/ci/ci.sh +++ b/src/tools/miri/ci/ci.sh @@ -1,5 +1,5 @@ #!/bin/bash -set -euo pipefail +set -eu function begingroup { echo "::group::$@" @@ -11,6 +11,17 @@ function endgroup { echo "::endgroup" } +begingroup "Sanity-check environment" + +# Ensure the HOST_TARGET is what it should be. +if ! rustc -vV | grep -q "^host: $HOST_TARGET\$"; then + echo "This runner should be using host target $HOST_TARGET but rustc disagrees:" + rustc -vV + exit 1 +fi + +endgroup + begingroup "Building Miri" # Global configuration diff --git a/src/tools/miri/tests/pass/float.rs b/src/tools/miri/tests/pass/float.rs index 0eb7d6e83095..d8792a6c3026 100644 --- a/src/tools/miri/tests/pass/float.rs +++ b/src/tools/miri/tests/pass/float.rs @@ -1327,15 +1327,24 @@ fn test_non_determinism() { ensure_nondet(|| 3.0f32.hypot(4.0f32)); ensure_nondet(|| 1f32.sin()); ensure_nondet(|| 0f32.cos()); - ensure_nondet(|| 1.0f32.sinh()); + // On i686-pc-windows-msvc , these functions are implemented by calling the `f64` version, + // which means the little rounding errors Miri introduces are discard by the cast down to `f32`. + // Just skip the test for them. + if !cfg!(all(target_os = "windows", target_env = "msvc", target_arch = "x86")) { + ensure_nondet(|| 1.0f32.tan()); + ensure_nondet(|| 1.0f32.asin()); + ensure_nondet(|| 5.0f32.acos()); + ensure_nondet(|| 1.0f32.atan()); + ensure_nondet(|| 1.0f32.atan2(2.0f32)); + ensure_nondet(|| 1.0f32.sinh()); + ensure_nondet(|| 1.0f32.cosh()); + ensure_nondet(|| 1.0f32.tanh()); + } ensure_nondet(|| 1.0f32.asinh()); - ensure_nondet(|| 1.0f32.cosh()); ensure_nondet(|| 2.0f32.acosh()); - ensure_nondet(|| 1.0f32.tan()); - ensure_nondet(|| 1.0f32.tanh()); - ensure_nondet(|| 1.0f32.atan2(2.0f32)); ensure_nondet(|| 0.5f32.atanh()); ensure_nondet(|| 5.0f32.gamma()); + ensure_nondet(|| 5.0f32.ln_gamma()); ensure_nondet(|| 5.0f32.erf()); ensure_nondet(|| 5.0f32.erfc()); } @@ -1348,18 +1357,23 @@ fn test_non_determinism() { ensure_nondet(|| 1f64.ln_1p()); ensure_nondet(|| f64::consts::E.log10()); ensure_nondet(|| f64::consts::E.log2()); - ensure_nondet(|| 1f64.sin()); - ensure_nondet(|| 0f64.cos()); ensure_nondet(|| 27.0f64.cbrt()); ensure_nondet(|| 3.0f64.hypot(4.0f64)); - ensure_nondet(|| 1.0f64.sinh()); - ensure_nondet(|| 1.0f64.asinh()); - ensure_nondet(|| 1.0f64.cosh()); - ensure_nondet(|| 3.0f64.acosh()); + ensure_nondet(|| 1f64.sin()); + ensure_nondet(|| 0f64.cos()); ensure_nondet(|| 1.0f64.tan()); + ensure_nondet(|| 1.0f64.asin()); + ensure_nondet(|| 5.0f64.acos()); + ensure_nondet(|| 1.0f64.atan()); + ensure_nondet(|| 1.0f64.atan2(2.0f64)); + ensure_nondet(|| 1.0f64.sinh()); + ensure_nondet(|| 1.0f64.cosh()); ensure_nondet(|| 1.0f64.tanh()); + ensure_nondet(|| 1.0f64.asinh()); + ensure_nondet(|| 3.0f64.acosh()); ensure_nondet(|| 0.5f64.atanh()); ensure_nondet(|| 5.0f64.gamma()); + ensure_nondet(|| 5.0f64.ln_gamma()); ensure_nondet(|| 5.0f64.erf()); ensure_nondet(|| 5.0f64.erfc()); }