Skip to content

Commit a3dd764

Browse files
authored
Merge pull request rust-lang#4205 from RalfJung/host-target
make sure we install the toolchain for the intended host target
2 parents bba9663 + b4bb011 commit a3dd764

File tree

4 files changed

+43
-12
lines changed

4 files changed

+43
-12
lines changed

src/tools/miri/.github/workflows/ci.yml

+2
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ jobs:
3030
steps:
3131
- uses: actions/checkout@v4
3232
- uses: ./.github/workflows/setup
33+
with:
34+
toolchain_flags: "--host ${{ matrix.host_target }}"
3335

3436
# The `style` job only runs on Linux; this makes sure the Windows-host-specific
3537
# code is also covered by clippy.

src/tools/miri/.github/workflows/setup/action.yml

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
name: "Miri CI setup"
22
description: "Sets up Miri CI"
3+
inputs:
4+
toolchain_flags:
5+
required: false
6+
default: ''
37
runs:
48
using: "composite"
59
steps:
@@ -45,7 +49,7 @@ runs:
4549
echo "Building against latest rustc git version"
4650
git ls-remote https://github.com/rust-lang/rust/ HEAD | cut -f 1 > rust-version
4751
fi
48-
./miri toolchain
52+
./miri toolchain ${{ inputs.toolchain_flags }}
4953
shell: bash
5054

5155
- name: Show Rust version (miri toolchain)

src/tools/miri/ci/ci.sh

+12-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash
2-
set -euo pipefail
2+
set -eu
33

44
function begingroup {
55
echo "::group::$@"
@@ -11,6 +11,17 @@ function endgroup {
1111
echo "::endgroup"
1212
}
1313

14+
begingroup "Sanity-check environment"
15+
16+
# Ensure the HOST_TARGET is what it should be.
17+
if ! rustc -vV | grep -q "^host: $HOST_TARGET\$"; then
18+
echo "This runner should be using host target $HOST_TARGET but rustc disagrees:"
19+
rustc -vV
20+
exit 1
21+
fi
22+
23+
endgroup
24+
1425
begingroup "Building Miri"
1526

1627
# Global configuration

src/tools/miri/tests/pass/float.rs

+24-10
Original file line numberDiff line numberDiff line change
@@ -1327,15 +1327,24 @@ fn test_non_determinism() {
13271327
ensure_nondet(|| 3.0f32.hypot(4.0f32));
13281328
ensure_nondet(|| 1f32.sin());
13291329
ensure_nondet(|| 0f32.cos());
1330-
ensure_nondet(|| 1.0f32.sinh());
1330+
// On i686-pc-windows-msvc , these functions are implemented by calling the `f64` version,
1331+
// which means the little rounding errors Miri introduces are discard by the cast down to `f32`.
1332+
// Just skip the test for them.
1333+
if !cfg!(all(target_os = "windows", target_env = "msvc", target_arch = "x86")) {
1334+
ensure_nondet(|| 1.0f32.tan());
1335+
ensure_nondet(|| 1.0f32.asin());
1336+
ensure_nondet(|| 5.0f32.acos());
1337+
ensure_nondet(|| 1.0f32.atan());
1338+
ensure_nondet(|| 1.0f32.atan2(2.0f32));
1339+
ensure_nondet(|| 1.0f32.sinh());
1340+
ensure_nondet(|| 1.0f32.cosh());
1341+
ensure_nondet(|| 1.0f32.tanh());
1342+
}
13311343
ensure_nondet(|| 1.0f32.asinh());
1332-
ensure_nondet(|| 1.0f32.cosh());
13331344
ensure_nondet(|| 2.0f32.acosh());
1334-
ensure_nondet(|| 1.0f32.tan());
1335-
ensure_nondet(|| 1.0f32.tanh());
1336-
ensure_nondet(|| 1.0f32.atan2(2.0f32));
13371345
ensure_nondet(|| 0.5f32.atanh());
13381346
ensure_nondet(|| 5.0f32.gamma());
1347+
ensure_nondet(|| 5.0f32.ln_gamma());
13391348
ensure_nondet(|| 5.0f32.erf());
13401349
ensure_nondet(|| 5.0f32.erfc());
13411350
}
@@ -1348,18 +1357,23 @@ fn test_non_determinism() {
13481357
ensure_nondet(|| 1f64.ln_1p());
13491358
ensure_nondet(|| f64::consts::E.log10());
13501359
ensure_nondet(|| f64::consts::E.log2());
1351-
ensure_nondet(|| 1f64.sin());
1352-
ensure_nondet(|| 0f64.cos());
13531360
ensure_nondet(|| 27.0f64.cbrt());
13541361
ensure_nondet(|| 3.0f64.hypot(4.0f64));
1362+
ensure_nondet(|| 1f64.sin());
1363+
ensure_nondet(|| 0f64.cos());
1364+
ensure_nondet(|| 1.0f64.tan());
1365+
ensure_nondet(|| 1.0f64.asin());
1366+
ensure_nondet(|| 5.0f64.acos());
1367+
ensure_nondet(|| 1.0f64.atan());
1368+
ensure_nondet(|| 1.0f64.atan2(2.0f64));
13551369
ensure_nondet(|| 1.0f64.sinh());
1356-
ensure_nondet(|| 1.0f64.asinh());
13571370
ensure_nondet(|| 1.0f64.cosh());
1358-
ensure_nondet(|| 3.0f64.acosh());
1359-
ensure_nondet(|| 1.0f64.tan());
13601371
ensure_nondet(|| 1.0f64.tanh());
1372+
ensure_nondet(|| 1.0f64.asinh());
1373+
ensure_nondet(|| 3.0f64.acosh());
13611374
ensure_nondet(|| 0.5f64.atanh());
13621375
ensure_nondet(|| 5.0f64.gamma());
1376+
ensure_nondet(|| 5.0f64.ln_gamma());
13631377
ensure_nondet(|| 5.0f64.erf());
13641378
ensure_nondet(|| 5.0f64.erfc());
13651379
}

0 commit comments

Comments
 (0)