Skip to content

Commit dcddf24

Browse files
committed
Auto merge of rust-lang#3402 - RalfJung:miri-script, r=RalfJung
miri script: build with stable toolchain `./miri toolchain` sets up a `rustup override miri`. But then if something goes wrong and the `miri` toolchain doesn't work, one can't even run `./miri toolchain` again as building miri-script needs a toolchain... So let's always use stable to build miri-script, making it override-independent. I assume everyone will have that installed.
2 parents f97f448 + a12decc commit dcddf24

File tree

4 files changed

+21
-6
lines changed

4 files changed

+21
-6
lines changed

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

+9-3
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@ jobs:
3434
steps:
3535
- uses: actions/checkout@v3
3636

37+
- name: Show Rust version (stable toolchain)
38+
run: |
39+
rustup show
40+
rustc -Vv
41+
cargo -V
42+
3743
# Cache the global cargo directory, but NOT the local `target` directory which
3844
# we cannot reuse anyway when the nightly changes (and it grows quite large
3945
# over time).
@@ -57,21 +63,21 @@ jobs:
5763
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
5864
run: cargo install -f rustup-toolchain-install-master
5965

60-
- name: Install "master" toolchain
66+
- name: Install miri toolchain
6167
run: |
6268
if [[ ${{ github.event_name }} == 'schedule' ]]; then
6369
echo "Building against latest rustc git version"
6470
git ls-remote https://github.com/rust-lang/rust/ HEAD | cut -f 1 > rust-version
6571
fi
6672
./miri toolchain --host ${{ matrix.host_target }}
6773
68-
- name: Show Rust version
74+
- name: Show Rust version (miri toolchain)
6975
run: |
7076
rustup show
7177
rustc -Vv
7278
cargo -V
7379
74-
- name: Test
80+
- name: Test Miri
7581
run: ./ci/ci.sh
7682

7783
style:

src/tools/miri/ci/ci.sh

+10-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,15 @@ function endgroup {
1313

1414
begingroup "Building Miri"
1515

16+
# Special Windows hacks
17+
if [ "$HOST_TARGET" = i686-pc-windows-msvc ]; then
18+
# The $BASH variable is `/bin/bash` here, but that path does not actually work. There are some
19+
# hacks in place somewhere to try to paper over this, but the hacks dont work either (see
20+
# <https://github.com/rust-lang/miri/pull/3402>). So we hard-code the correct location for Github
21+
# CI instead.
22+
BASH="C:/Program Files/Git/usr/bin/bash"
23+
fi
24+
1625
# Determine configuration for installed build
1726
echo "Installing release version of Miri"
1827
export RUSTFLAGS="-D warnings"
@@ -64,7 +73,7 @@ function run_tests {
6473
done
6574

6675
# Check that the benchmarks build and run, but without actually benchmarking.
67-
HYPERFINE="bash -c" ./miri bench
76+
HYPERFINE="'$BASH' -c" ./miri bench
6877
fi
6978

7079
## test-cargo-miri

src/tools/miri/miri

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ set -e
33
# Instead of doing just `cargo run --manifest-path .. $@`, we invoke miri-script binary directly. Invoking `cargo run` goes through
44
# rustup (that sets it's own environmental variables), which is undesirable.
55
MIRI_SCRIPT_TARGET_DIR="$(dirname "$0")"/miri-script/target
6-
cargo build $CARGO_EXTRA_FLAGS -q --target-dir "$MIRI_SCRIPT_TARGET_DIR" --manifest-path "$(dirname "$0")"/miri-script/Cargo.toml
6+
cargo +stable build $CARGO_EXTRA_FLAGS -q --target-dir "$MIRI_SCRIPT_TARGET_DIR" --manifest-path "$(dirname "$0")"/miri-script/Cargo.toml
77
"$MIRI_SCRIPT_TARGET_DIR"/debug/miri-script "$@"

src/tools/miri/miri.bat

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ set MIRI_SCRIPT_TARGET_DIR=%0\..\miri-script\target
55

66
:: If any other steps are added, the "|| exit /b" must be appended to early
77
:: return from the script. If not, it will continue execution.
8-
cargo build %CARGO_EXTRA_FLAGS% -q --target-dir %MIRI_SCRIPT_TARGET_DIR% --manifest-path %0\..\miri-script\Cargo.toml || exit /b
8+
cargo +stable build %CARGO_EXTRA_FLAGS% -q --target-dir %MIRI_SCRIPT_TARGET_DIR% --manifest-path %0\..\miri-script\Cargo.toml || exit /b
99

1010
:: Forwards all arguments to this file to the executable.
1111
:: We invoke the binary directly to avoid going through rustup, which would set some extra

0 commit comments

Comments
 (0)