@@ -31,24 +31,26 @@ time ./miri build --all-targets # the build that all the `./miri test` below wil
31
31
endgroup
32
32
33
33
# Run tests. Recognizes these variables:
34
- # - MIRI_TEST_TARGET : the target to test. Empty for host target.
34
+ # - TEST_TARGET : the target to test. Empty for host target.
35
35
# - GC_STRESS: if non-empty, run the GC stress test for the main test suite.
36
36
# - MIR_OPT: if non-empty, re-run test `pass` tests with mir-opt-level=4
37
37
# - MANY_SEEDS: if set to N, run the "many-seeds" tests N times
38
38
# - TEST_BENCH: if non-empty, check that the benchmarks all build
39
39
# - CARGO_MIRI_ENV: if non-empty, set some env vars and config to potentially confuse cargo-miri
40
40
function run_tests {
41
- if [ -n " ${MIRI_TEST_TARGET-} " ]; then
42
- begingroup " Testing foreign architecture $MIRI_TEST_TARGET "
41
+ if [ -n " ${TEST_TARGET-} " ]; then
42
+ begingroup " Testing foreign architecture $TEST_TARGET "
43
+ TARGET_FLAG=" --target $TEST_TARGET "
43
44
else
44
45
begingroup " Testing host architecture"
46
+ TARGET_FLAG=" "
45
47
fi
46
48
47
49
# # ui test suite
48
50
if [ -n " ${GC_STRESS-} " ]; then
49
- time MIRIFLAGS=" ${MIRIFLAGS-} -Zmiri-provenance-gc=1" ./miri test
51
+ time MIRIFLAGS=" ${MIRIFLAGS-} -Zmiri-provenance-gc=1" ./miri test $TARGET_FLAG
50
52
else
51
- time ./miri test
53
+ time ./miri test $TARGET_FLAG
52
54
fi
53
55
54
56
# # advanced tests
@@ -59,17 +61,17 @@ function run_tests {
59
61
# them. Also error locations change so we don't run the failing tests.
60
62
# We explicitly enable debug-assertions here, they are disabled by -O but we have tests
61
63
# which exist to check that we panic on debug assertion failures.
62
- time MIRIFLAGS=" ${MIRIFLAGS-} -O -Zmir-opt-level=4 -Cdebug-assertions=yes" MIRI_SKIP_UI_CHECKS=1 ./miri test tests/{pass,panic}
64
+ time MIRIFLAGS=" ${MIRIFLAGS-} -O -Zmir-opt-level=4 -Cdebug-assertions=yes" MIRI_SKIP_UI_CHECKS=1 ./miri test $TARGET_FLAG tests/{pass,panic}
63
65
fi
64
66
if [ -n " ${MANY_SEEDS-} " ]; then
65
67
# Also run some many-seeds tests.
66
68
time for FILE in tests/many-seeds/* .rs; do
67
- ./miri run " --many-seeds=0..$MANY_SEEDS " " $FILE "
69
+ ./miri run " --many-seeds=0..$MANY_SEEDS " $TARGET_FLAG " $FILE "
68
70
done
69
71
fi
70
72
if [ -n " ${TEST_BENCH-} " ]; then
71
73
# Check that the benchmarks build and run, but only once.
72
- time HYPERFINE=" hyperfine -w0 -r1" ./miri bench
74
+ time HYPERFINE=" hyperfine -w0 -r1" ./miri bench $TARGET_FLAG
73
75
fi
74
76
75
77
# # test-cargo-miri
@@ -91,7 +93,7 @@ function run_tests {
91
93
echo ' build.rustc-wrapper = "thisdoesnotexist"' > .cargo/config.toml
92
94
fi
93
95
# Run the actual test
94
- time ${PYTHON} test-cargo-miri/run-test.py
96
+ time ${PYTHON} test-cargo-miri/run-test.py $TARGET_FLAG
95
97
# Clean up
96
98
unset RUSTC MIRI
97
99
rm -rf .cargo
@@ -100,17 +102,18 @@ function run_tests {
100
102
}
101
103
102
104
function run_tests_minimal {
103
- if [ -n " ${MIRI_TEST_TARGET-} " ]; then
104
- begingroup " Testing MINIMAL foreign architecture $MIRI_TEST_TARGET : only testing $@ "
105
+ if [ -n " ${TEST_TARGET-} " ]; then
106
+ begingroup " Testing MINIMAL foreign architecture $TEST_TARGET : only testing $@ "
107
+ TARGET_FLAG=" --target $TEST_TARGET "
105
108
else
106
- echo " run_tests_minimal requires MIRI_TEST_TARGET to be set"
109
+ echo " run_tests_minimal requires TEST_TARGET to be set"
107
110
exit 1
108
111
fi
109
112
110
- time ./miri test " $@ "
113
+ time ./miri test $TARGET_FLAG " $@ "
111
114
112
115
# Ensure that a small smoke test of cargo-miri works.
113
- time cargo miri run --manifest-path test-cargo-miri/no-std-smoke/Cargo.toml --target ${MIRI_TEST_TARGET- $HOST_TARGET }
116
+ time cargo miri run --manifest-path test-cargo-miri/no-std-smoke/Cargo.toml $TARGET_FLAG
114
117
115
118
endgroup
116
119
}
@@ -126,33 +129,33 @@ case $HOST_TARGET in
126
129
# Extra tier 1
127
130
# With reduced many-seed count to avoid spending too much time on that.
128
131
# (All OSes and ABIs are run with 64 seeds at least once though via the macOS runner.)
129
- MANY_SEEDS=16 MIRI_TEST_TARGET =i686-unknown-linux-gnu run_tests
130
- MANY_SEEDS=16 MIRI_TEST_TARGET =aarch64-unknown-linux-gnu run_tests
131
- MANY_SEEDS=16 MIRI_TEST_TARGET =x86_64-apple-darwin run_tests
132
- MANY_SEEDS=16 MIRI_TEST_TARGET =x86_64-pc-windows-gnu run_tests
132
+ MANY_SEEDS=16 TEST_TARGET =i686-unknown-linux-gnu run_tests
133
+ MANY_SEEDS=16 TEST_TARGET =aarch64-unknown-linux-gnu run_tests
134
+ MANY_SEEDS=16 TEST_TARGET =x86_64-apple-darwin run_tests
135
+ MANY_SEEDS=16 TEST_TARGET =x86_64-pc-windows-gnu run_tests
133
136
;;
134
137
aarch64-apple-darwin)
135
138
# Host (tier 2)
136
139
GC_STRESS=1 MIR_OPT=1 MANY_SEEDS=64 TEST_BENCH=1 CARGO_MIRI_ENV=1 run_tests
137
140
# Extra tier 1
138
- MANY_SEEDS=64 MIRI_TEST_TARGET =i686-pc-windows-gnu run_tests
139
- MANY_SEEDS=64 MIRI_TEST_TARGET =x86_64-pc-windows-msvc CARGO_MIRI_ENV=1 run_tests
141
+ MANY_SEEDS=64 TEST_TARGET =i686-pc-windows-gnu run_tests
142
+ MANY_SEEDS=64 TEST_TARGET =x86_64-pc-windows-msvc CARGO_MIRI_ENV=1 run_tests
140
143
# Extra tier 2
141
- MIRI_TEST_TARGET =arm-unknown-linux-gnueabi run_tests
142
- MIRI_TEST_TARGET =s390x-unknown-linux-gnu run_tests # big-endian architecture of choice
144
+ TEST_TARGET =arm-unknown-linux-gnueabi run_tests
145
+ TEST_TARGET =s390x-unknown-linux-gnu run_tests # big-endian architecture of choice
143
146
# Partially supported targets (tier 2)
144
147
VERY_BASIC=" integer vec string btreemap" # common things we test on all of them (if they have std), requires no target-specific shims
145
148
BASIC=" $VERY_BASIC hello hashmap alloc align" # ensures we have the shims for stdout and basic data structures
146
- MIRI_TEST_TARGET =x86_64-unknown-freebsd run_tests_minimal $BASIC panic/panic concurrency/simple atomic threadname libc-mem libc-misc libc-random libc-time fs env num_cpus
147
- MIRI_TEST_TARGET =i686-unknown-freebsd run_tests_minimal $BASIC panic/panic concurrency/simple atomic threadname libc-mem libc-misc libc-random libc-time fs env num_cpus
148
- MIRI_TEST_TARGET =x86_64-unknown-illumos run_tests_minimal $VERY_BASIC hello panic/panic concurrency/simple pthread-sync libc-mem libc-misc libc-random
149
- MIRI_TEST_TARGET =x86_64-pc-solaris run_tests_minimal $VERY_BASIC hello panic/panic concurrency/simple pthread-sync libc-mem libc-misc libc-random
150
- MIRI_TEST_TARGET =aarch64-linux-android run_tests_minimal $VERY_BASIC hello panic/panic
151
- MIRI_TEST_TARGET =wasm32-wasi run_tests_minimal $VERY_BASIC wasm
152
- MIRI_TEST_TARGET =wasm32-unknown-unknown run_tests_minimal $VERY_BASIC wasm
153
- MIRI_TEST_TARGET =thumbv7em-none-eabihf run_tests_minimal no_std
149
+ TEST_TARGET =x86_64-unknown-freebsd run_tests_minimal $BASIC panic/panic concurrency/simple atomic threadname libc-mem libc-misc libc-random libc-time fs env num_cpus
150
+ TEST_TARGET =i686-unknown-freebsd run_tests_minimal $BASIC panic/panic concurrency/simple atomic threadname libc-mem libc-misc libc-random libc-time fs env num_cpus
151
+ TEST_TARGET =x86_64-unknown-illumos run_tests_minimal $VERY_BASIC hello panic/panic concurrency/simple pthread-sync libc-mem libc-misc libc-random
152
+ TEST_TARGET =x86_64-pc-solaris run_tests_minimal $VERY_BASIC hello panic/panic concurrency/simple pthread-sync libc-mem libc-misc libc-random
153
+ TEST_TARGET =aarch64-linux-android run_tests_minimal $VERY_BASIC hello panic/panic
154
+ TEST_TARGET =wasm32-wasi run_tests_minimal $VERY_BASIC wasm
155
+ TEST_TARGET =wasm32-unknown-unknown run_tests_minimal $VERY_BASIC wasm
156
+ TEST_TARGET =thumbv7em-none-eabihf run_tests_minimal no_std
154
157
# Custom target JSON file
155
- MIRI_TEST_TARGET =tests/avr.json MIRI_NO_STD=1 run_tests_minimal no_std
158
+ TEST_TARGET =tests/avr.json MIRI_NO_STD=1 run_tests_minimal no_std
156
159
;;
157
160
i686-pc-windows-msvc)
158
161
# Host
@@ -162,7 +165,7 @@ case $HOST_TARGET in
162
165
# Extra tier 1
163
166
# We really want to ensure a Linux target works on a Windows host,
164
167
# and a 64bit target works on a 32bit host.
165
- MIRI_TEST_TARGET =x86_64-unknown-linux-gnu run_tests
168
+ TEST_TARGET =x86_64-unknown-linux-gnu run_tests
166
169
;;
167
170
* )
168
171
echo " FATAL: unknown host target: $HOST_TARGET "
0 commit comments