Skip to content

Commit 535db18

Browse files
committed
Auto merge of rust-lang#3189 - RalfJung:ci, r=RalfJung
run the provenance-gc=1 test on all targets, but only for the host tests No need to slow down *all those tests* running on the Linux host... but lets cover each major OS at least once. We've had bugs that only some macOS-specific code in `getrandom` found, after all. Let's see how much this affects timing on the macOS / Windows runners.
2 parents 2132d78 + 695f1a5 commit 535db18

File tree

2 files changed

+20
-11
lines changed

2 files changed

+20
-11
lines changed

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

-4
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,6 @@ jobs:
3535
steps:
3636
- uses: actions/checkout@v3
3737

38-
- name: Set the tag GC interval to 1 on linux
39-
if: runner.os == 'Linux'
40-
run: echo "MIRIFLAGS=-Zmiri-provenance-gc=1" >> $GITHUB_ENV
41-
4238
# Cache the global cargo directory, but NOT the local `target` directory which
4339
# we cannot reuse anyway when the nightly changes (and it grows quite large
4440
# over time).

src/tools/miri/ci.sh

+20-7
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,23 @@ endgroup
3030

3131
# Test
3232
function run_tests {
33-
if [ -n "${MIRI_TEST_TARGET+exists}" ]; then
33+
if [ -n "${MIRI_TEST_TARGET:-}" ]; then
3434
begingroup "Testing foreign architecture $MIRI_TEST_TARGET"
3535
else
3636
begingroup "Testing host architecture"
3737
fi
3838

3939
## ui test suite
40-
./miri test
41-
if [ -z "${MIRI_TEST_TARGET+exists}" ]; then
42-
# Host-only tests: running these on all targets is unlikely to catch more problems and would
40+
# On the host and on Linux, also stress-test the GC.
41+
if [ -z "${MIRI_TEST_TARGET:-}" ] || [ "$HOST_TARGET" = x86_64-unknown-linux-gnu ]; then
42+
MIRIFLAGS="${MIRIFLAGS:-} -Zmiri-provenance-gc=1" ./miri test
43+
else
44+
./miri test
45+
fi
46+
47+
# Host-only tests
48+
if [ -z "${MIRI_TEST_TARGET:-}" ]; then
49+
# Running these on all targets is unlikely to catch more problems and would
4350
# cost a lot of CI time.
4451

4552
# Tests with optimizations (`-O` is what cargo passes, but crank MIR optimizations up all the
@@ -85,10 +92,11 @@ function run_tests {
8592
}
8693

8794
function run_tests_minimal {
88-
if [ -n "${MIRI_TEST_TARGET+exists}" ]; then
95+
if [ -n "${MIRI_TEST_TARGET:-}" ]; then
8996
begingroup "Testing MINIMAL foreign architecture $MIRI_TEST_TARGET: only testing $@"
9097
else
91-
begingroup "Testing MINIMAL host architecture: only testing $@"
98+
echo "run_tests_minimal requires MIRI_TEST_TARGET to be set"
99+
exit 1
92100
fi
93101

94102
./miri test -- "$@"
@@ -99,15 +107,20 @@ function run_tests_minimal {
99107
endgroup
100108
}
101109

102-
# host
110+
## Main Testing Logic ##
111+
112+
# Host target.
103113
run_tests
104114

115+
# Extra targets.
116+
# In particular, fully cover all tier 1 targets.
105117
case $HOST_TARGET in
106118
x86_64-unknown-linux-gnu)
107119
MIRI_TEST_TARGET=i686-unknown-linux-gnu run_tests
108120
MIRI_TEST_TARGET=aarch64-unknown-linux-gnu run_tests
109121
MIRI_TEST_TARGET=aarch64-apple-darwin run_tests
110122
MIRI_TEST_TARGET=i686-pc-windows-gnu run_tests
123+
# Some targets are only partially supported.
111124
MIRI_TEST_TARGET=x86_64-unknown-freebsd run_tests_minimal hello integer vec panic/panic concurrency/simple pthread-threadname libc-getentropy libc-getrandom libc-misc libc-fs atomic env align
112125
MIRI_TEST_TARGET=i686-unknown-freebsd run_tests_minimal hello integer vec panic/panic concurrency/simple pthread-threadname libc-getentropy libc-getrandom libc-misc libc-fs atomic env align
113126
MIRI_TEST_TARGET=aarch64-linux-android run_tests_minimal hello integer vec panic/panic

0 commit comments

Comments
 (0)