@@ -50,6 +50,7 @@ endgroup
50
50
# - MIR_OPT: if non-empty, re-run test `pass` tests with mir-opt-level=4
51
51
# - MANY_SEEDS: if set to N, run the "many-seeds" tests N times
52
52
# - TEST_BENCH: if non-empty, check that the benchmarks all build
53
+ # - CARGO_MIRI_ENV: if non-empty, set some env vars and config to potentially confuse cargo-miri
53
54
function run_tests {
54
55
if [ -n " ${MIRI_TEST_TARGET-} " ]; then
55
56
begingroup " Testing foreign architecture $MIRI_TEST_TARGET "
@@ -94,14 +95,16 @@ function run_tests {
94
95
PYTHON=python
95
96
fi
96
97
# Some environment setup that attempts to confuse the heck out of cargo-miri.
97
- if [ " $HOST_TARGET " = x86_64-unknown-linux-gnu ]; then
98
- # These act up on Windows (`which miri` produces a filename that does not exist?!?),
99
- # so let's do this only on Linux. Also makes sure things work without these set.
100
- export RUSTC=$( which rustc) # Produces a warning unless we also set MIRI
98
+ if [ -n " ${CARGO_MIRI_ENV-} " ]; then
99
+ # These act up on Windows (`which miri` produces a filename that does not exist?!?).
100
+ # RUSTC is the main thing to set (it changes the first argument our wrapper will see).
101
+ # Unless MIRI is also set, that produces a warning.
102
+ export RUSTC=$( which rustc)
101
103
export MIRI=$( rustc +miri --print sysroot) /bin/miri
104
+ # We entirely ignore other wrappers.
105
+ mkdir -p .cargo
106
+ echo ' build.rustc-wrapper = "thisdoesnotexist"' > .cargo/config.toml
102
107
fi
103
- mkdir -p .cargo
104
- echo ' build.rustc-wrapper = "thisdoesnotexist"' > .cargo/config.toml
105
108
# Run the actual test
106
109
${PYTHON} test-cargo-miri/run-test.py
107
110
# Clean up
@@ -133,7 +136,7 @@ function run_tests_minimal {
133
136
case $HOST_TARGET in
134
137
x86_64-unknown-linux-gnu)
135
138
# Host
136
- GC_STRESS=1 MIR_OPT=1 MANY_SEEDS=64 TEST_BENCH=1 run_tests
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
141
MIRI_TEST_TARGET=i686-unknown-linux-gnu run_tests
139
142
MIRI_TEST_TARGET=aarch64-unknown-linux-gnu run_tests
@@ -154,9 +157,9 @@ case $HOST_TARGET in
154
157
;;
155
158
x86_64-apple-darwin)
156
159
# Host
157
- GC_STRESS=1 MIR_OPT=1 MANY_SEEDS=64 TEST_BENCH=1 run_tests
160
+ GC_STRESS=1 MIR_OPT=1 MANY_SEEDS=64 TEST_BENCH=1 CARGO_MIRI_ENV=1 run_tests
158
161
# Extra tier 1
159
- MIRI_TEST_TARGET=x86_64-pc-windows-msvc run_tests
162
+ MIRI_TEST_TARGET=x86_64-pc-windows-msvc CARGO_MIRI_ENV=1 run_tests
160
163
# Extra tier 2
161
164
MIRI_TEST_TARGET=s390x-unknown-linux-gnu run_tests # big-endian architecture
162
165
;;
0 commit comments