@@ -44,7 +44,12 @@ export CARGO_EXTRA_FLAGS="$CARGO_EXTRA_FLAGS --all-features"
44
44
45
45
endgroup
46
46
47
- # Test
47
+ # Run tests. Recognizes these variables:
48
+ # - MIRI_TEST_TARGET: the target to test. Empty for host target.
49
+ # - GC_STRESS: if non-empty, run the GC stress test for the main test suite.
50
+ # - MIR_OPT: if non-empty, re-run test `pass` tests with mir-opt-level=4
51
+ # - MANY_SEEDS: if set to N, run the "many-seeds" tests N times
52
+ # - TEST_BENCH: if non-empty, check that the benchmarks all build
48
53
function run_tests {
49
54
if [ -n " ${MIRI_TEST_TARGET:- } " ]; then
50
55
begingroup " Testing foreign architecture $MIRI_TEST_TARGET "
@@ -53,32 +58,30 @@ function run_tests {
53
58
fi
54
59
55
60
# # ui test suite
56
- # On the host, also stress-test the GC.
57
- if [ -z " ${MIRI_TEST_TARGET:- } " ]; then
61
+ if [ -n " ${GC_STRESS:- } " ]; then
58
62
MIRIFLAGS=" ${MIRIFLAGS:- } -Zmiri-provenance-gc=1" ./miri test
59
63
else
60
64
./miri test
61
65
fi
62
66
63
- # Host-only tests
64
- if [ -z " ${MIRI_TEST_TARGET:- } " ]; then
65
- # Running these on all targets is unlikely to catch more problems and would
66
- # cost a lot of CI time.
67
-
67
+ # # advanced tests
68
+ if [ -n " ${MIR_OPT:- } " ]; then
68
69
# Tests with optimizations (`-O` is what cargo passes, but crank MIR optimizations up all the
69
70
# way, too).
70
71
# Optimizations change diagnostics (mostly backtraces), so we don't check
71
72
# them. Also error locations change so we don't run the failing tests.
72
73
# We explicitly enable debug-assertions here, they are disabled by -O but we have tests
73
74
# which exist to check that we panic on debug assertion failures.
74
75
MIRIFLAGS=" ${MIRIFLAGS:- } -O -Zmir-opt-level=4 -Cdebug-assertions=yes" MIRI_SKIP_UI_CHECKS=1 ./miri test -- tests/{pass,panic}
75
-
76
+ fi
77
+ if [ -n " ${MANY_SEEDS:- } " ]; then
76
78
# Also run some many-seeds tests. 64 seeds means this takes around a minute per test.
77
79
# (Need to invoke via explicit `bash -c` for Windows.)
78
80
for FILE in tests/many-seeds/* .rs; do
79
- MIRI_SEEDS=64 ./miri many-seeds " $BASH " -c " ./miri run '$FILE '"
81
+ MIRI_SEEDS=$MANY_SEEDS ./miri many-seeds " $BASH " -c " ./miri run '$FILE '"
80
82
done
81
-
83
+ fi
84
+ if [ -n " ${TEST_BENCH:- } " ]; then
82
85
# Check that the benchmarks build and run, but without actually benchmarking.
83
86
HYPERFINE=" '$BASH ' -c" ./miri bench
84
87
fi
@@ -126,34 +129,43 @@ function run_tests_minimal {
126
129
127
130
# # Main Testing Logic ##
128
131
129
- # Host target.
130
- run_tests
131
-
132
- # Extra targets.
133
132
# In particular, fully cover all tier 1 targets.
134
133
case $HOST_TARGET in
135
134
x86_64-unknown-linux-gnu)
135
+ # Host
136
+ GC_STRESS=1 MIR_OPT=1 MANY_SEEDS=64 TEST_BENCH=1 run_tests
137
+ # Extra tier 1
136
138
MIRI_TEST_TARGET=i686-unknown-linux-gnu run_tests
137
139
MIRI_TEST_TARGET=aarch64-unknown-linux-gnu run_tests
138
- MIRI_TEST_TARGET=aarch64-apple-darwin run_tests
139
140
MIRI_TEST_TARGET=i686-pc-windows-gnu run_tests
140
141
MIRI_TEST_TARGET=x86_64-pc-windows-gnu run_tests
142
+ # Extra tier 2
143
+ MIRI_TEST_TARGET=aarch64-apple-darwin run_tests
141
144
MIRI_TEST_TARGET=arm-unknown-linux-gnueabi run_tests
142
- # Some targets are only partially supported.
145
+ # Partially supported targets (tier 2)
143
146
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 num_cpus
144
147
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 num_cpus
145
-
146
148
MIRI_TEST_TARGET=aarch64-linux-android run_tests_minimal hello integer vec panic/panic
147
149
MIRI_TEST_TARGET=wasm32-wasi run_tests_minimal no_std integer strings wasm
148
150
MIRI_TEST_TARGET=wasm32-unknown-unknown run_tests_minimal no_std integer strings wasm
149
- MIRI_TEST_TARGET=thumbv7em-none-eabihf run_tests_minimal no_std # no_std embedded architecture
150
- MIRI_TEST_TARGET=tests/avr.json MIRI_NO_STD=1 run_tests_minimal no_std # JSON target file
151
+ MIRI_TEST_TARGET=thumbv7em-none-eabihf run_tests_minimal no_std
152
+ # Custom target JSON file
153
+ MIRI_TEST_TARGET=tests/avr.json MIRI_NO_STD=1 run_tests_minimal no_std
151
154
;;
152
155
x86_64-apple-darwin)
153
- MIRI_TEST_TARGET=s390x-unknown-linux-gnu run_tests # big-endian architecture
156
+ # Host
157
+ GC_STRESS=1 MIR_OPT=1 MANY_SEEDS=64 TEST_BENCH=1 run_tests
158
+ # Extra tier 1
154
159
MIRI_TEST_TARGET=x86_64-pc-windows-msvc run_tests
160
+ # Extra tier 2
161
+ MIRI_TEST_TARGET=s390x-unknown-linux-gnu run_tests # big-endian architecture
155
162
;;
156
163
i686-pc-windows-msvc)
164
+ # Host
165
+ GC_STRESS=1 MIR_OPT=1 MANY_SEEDS=64 TEST_BENCH=1 run_tests
166
+ # Extra tier 1
167
+ # We really want to ensure a Linux target works on a Windows host,
168
+ # and a 64bit target works on a 32bit host.
157
169
MIRI_TEST_TARGET=x86_64-unknown-linux-gnu run_tests
158
170
;;
159
171
* )
0 commit comments