about summary refs log tree commit diff
path: root/src/tools
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2025-02-24 13:14:04 +0000
committerGitHub <noreply@github.com>2025-02-24 13:14:04 +0000
commita3dd76430735bfa192697c04c1a6be232948fff5 (patch)
treee0e71b5bf0ddeaba7de10ba9bd8f84ad10f680c5 /src/tools
parentbba96636213e996d712454f24e4b08abf105835f (diff)
parentb4bb011cbcf73bdecc499562346cb8a0f33b44bb (diff)
downloadrust-a3dd76430735bfa192697c04c1a6be232948fff5.tar.gz
rust-a3dd76430735bfa192697c04c1a6be232948fff5.zip
Merge pull request #4205 from RalfJung/host-target
make sure we install the toolchain for the intended host target
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/miri/.github/workflows/ci.yml2
-rw-r--r--src/tools/miri/.github/workflows/setup/action.yml6
-rwxr-xr-xsrc/tools/miri/ci/ci.sh13
-rw-r--r--src/tools/miri/tests/pass/float.rs34
4 files changed, 43 insertions, 12 deletions
diff --git a/src/tools/miri/.github/workflows/ci.yml b/src/tools/miri/.github/workflows/ci.yml
index 81df0964d59..59bae513a58 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 bf5749a7b17..146b432171e 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 5583030b490..3327ad17c44 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 0eb7d6e8309..d8792a6c302 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(|| 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.asinh());
         ensure_nondet(|| 1.0f64.cosh());
-        ensure_nondet(|| 3.0f64.acosh());
-        ensure_nondet(|| 1.0f64.tan());
         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());
     }