Skip to content

Commit e8d724d

Browse files
committed
Include miri, drop cargotest
1 parent c23d548 commit e8d724d

File tree

2 files changed

+75
-2
lines changed

2 files changed

+75
-2
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
#!/bin/sh
2+
# ignore-tidy-linelength
3+
4+
set -eu
5+
set -x # so one can see where we are in the script
6+
7+
X_PY="$1"
8+
9+
# Try to test the toolstate-tracked tools and store the build/test success in the TOOLSTATE_FILE.
10+
11+
# Pre-build the compiler and the library first to output a better error message when the build
12+
# itself fails (see https://github.com/rust-lang/rust/issues/127869 for context).
13+
python3 "$X_PY" build --stage 2 compiler rustdoc
14+
15+
# set +e
16+
# python3 "$X_PY" test --stage 2 --no-fail-fast \
17+
# src/doc/book \
18+
# src/doc/nomicon \
19+
# src/doc/reference \
20+
# src/doc/rust-by-example \
21+
# src/doc/embedded-book \
22+
# src/doc/edition-guide \
23+
24+
# set -e
25+
26+
# debugging: print out the saved toolstates
27+
# cat /tmp/toolstate/toolstates.json
28+
29+
# Test remaining tools that must pass.
30+
# python3 "$X_PY" test --stage 2 check-tools
31+
# python3 "$X_PY" test --stage 2 src/tools/clippy
32+
# python3 "$X_PY" test --stage 2 src/tools/rustfmt
33+
34+
# Testing Miri is a bit more complicated.
35+
# We set the GC interval to the shortest possible value (0 would be off) to increase the chance
36+
# that bugs which only surface when the GC runs at a specific time are more likely to cause CI to fail.
37+
# This significantly increases the runtime of our test suite, or we'd do this in PR CI too.
38+
if [ -z "${PR_CI_JOB:-}" ]; then
39+
MIRIFLAGS=-Zmiri-provenance-gc=1 python3 "$X_PY" test --stage 2 src/tools/miri src/tools/miri/cargo-miri
40+
else
41+
python3 "$X_PY" test --stage 2 src/tools/miri src/tools/miri/cargo-miri
42+
fi
43+
# We natively run this script on x86_64-unknown-linux-gnu and x86_64-pc-windows-msvc.
44+
# Also cover some other targets via cross-testing, in particular all tier 1 targets.
45+
case $HOST_TARGET in
46+
x86_64-unknown-linux-gnu)
47+
# Only this branch runs in PR CI.
48+
# Fully test all main OSes, including a 32bit target.
49+
python3 "$X_PY" test --stage 2 src/tools/miri src/tools/miri/cargo-miri --target x86_64-apple-darwin
50+
python3 "$X_PY" test --stage 2 src/tools/miri src/tools/miri/cargo-miri --target i686-pc-windows-msvc
51+
# Only run "pass" tests for the remaining targets, which is quite a bit faster.
52+
python3 "$X_PY" test --stage 2 src/tools/miri --target x86_64-pc-windows-gnu --test-args pass
53+
python3 "$X_PY" test --stage 2 src/tools/miri --target i686-unknown-linux-gnu --test-args pass
54+
python3 "$X_PY" test --stage 2 src/tools/miri --target aarch64-unknown-linux-gnu --test-args pass
55+
python3 "$X_PY" test --stage 2 src/tools/miri --target s390x-unknown-linux-gnu --test-args pass
56+
;;
57+
x86_64-pc-windows-msvc)
58+
# Strangely, Linux targets do not work here. cargo always says
59+
# "error: cannot produce cdylib for ... as the target ... does not support these crate types".
60+
# Only run "pass" tests, which is quite a bit faster.
61+
python3 "$X_PY" test --stage 2 src/tools/miri --target aarch64-apple-darwin --test-args pass
62+
python3 "$X_PY" test --stage 2 src/tools/miri --target i686-pc-windows-gnu --test-args pass
63+
;;
64+
*)
65+
echo "FATAL: unexpected host $HOST_TARGET"
66+
exit 1
67+
;;
68+
esac
69+
# Also smoke-test `x.py miri`. This doesn't run any actual tests (that would take too long),
70+
# but it ensures that the crates build properly when tested with Miri.
71+
python3 "$X_PY" miri --stage 2 library/core --test-args notest
72+
python3 "$X_PY" miri --stage 2 library/alloc --test-args notest
73+
python3 "$X_PY" miri --stage 2 library/std --test-args notest

src/ci/github-actions/jobs.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -82,14 +82,14 @@ envs:
8282
pr:
8383
- image: x86_64-msvc-ext1
8484
env:
85-
SCRIPT: python x.py --stage 2 test src/tools/cargotest src/tools/cargo
85+
SCRIPT: python x.py --stage 2 test src/tools/cargo && src/ci/docker/host-x86_64/x86_64-gnu-tools/checktools2.sh x.py /tmp/toolstate/toolstates.json windows
8686
HOST_TARGET: x86_64-pc-windows-msvc
8787
RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --enable-lld --save-toolstates=/tmp/toolstate/toolstates.json --set build.cargo=C:/a/rust/rust/cargo.exe
8888
DEPLOY_TOOLSTATES_JSON: toolstates-windows.json
8989
<<: *job-windows-8c
9090
- image: x86_64-msvc-ext2
9191
env:
92-
SCRIPT: python x.py --stage 2 test src/tools/cargotest src/tools/cargo
92+
SCRIPT: python x.py --stage 2 test src/tools/cargo && src/ci/docker/host-x86_64/x86_64-gnu-tools/checktools2.sh x.py /tmp/toolstate/toolstates.json windows
9393
HOST_TARGET: x86_64-pc-windows-msvc
9494
RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --enable-lld --save-toolstates=/tmp/toolstate/toolstates.json --set build.cargo=C:/a/rust/rust/cargo.exe
9595
DEPLOY_TOOLSTATES_JSON: toolstates-windows.json

0 commit comments

Comments
 (0)