Skip to content

Commit 9395e1f

Browse files
committed
bash: use variable expansion that properly distinguishes null vs non-existing
1 parent 5d1e92d commit 9395e1f

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/tools/miri/ci/ci.sh

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -51,37 +51,37 @@ endgroup
5151
# - MANY_SEEDS: if set to N, run the "many-seeds" tests N times
5252
# - TEST_BENCH: if non-empty, check that the benchmarks all build
5353
function run_tests {
54-
if [ -n "${MIRI_TEST_TARGET:-}" ]; then
54+
if [ -n "${MIRI_TEST_TARGET-}" ]; then
5555
begingroup "Testing foreign architecture $MIRI_TEST_TARGET"
5656
else
5757
begingroup "Testing host architecture"
5858
fi
5959

6060
## ui test suite
61-
if [ -n "${GC_STRESS:-}" ]; then
62-
MIRIFLAGS="${MIRIFLAGS:-} -Zmiri-provenance-gc=1" ./miri test
61+
if [ -n "${GC_STRESS-}" ]; then
62+
MIRIFLAGS="${MIRIFLAGS-} -Zmiri-provenance-gc=1" ./miri test
6363
else
6464
./miri test
6565
fi
6666

6767
## advanced tests
68-
if [ -n "${MIR_OPT:-}" ]; then
68+
if [ -n "${MIR_OPT-}" ]; then
6969
# Tests with optimizations (`-O` is what cargo passes, but crank MIR optimizations up all the
7070
# way, too).
7171
# Optimizations change diagnostics (mostly backtraces), so we don't check
7272
# them. Also error locations change so we don't run the failing tests.
7373
# We explicitly enable debug-assertions here, they are disabled by -O but we have tests
7474
# which exist to check that we panic on debug assertion failures.
75-
MIRIFLAGS="${MIRIFLAGS:-} -O -Zmir-opt-level=4 -Cdebug-assertions=yes" MIRI_SKIP_UI_CHECKS=1 ./miri test -- tests/{pass,panic}
75+
MIRIFLAGS="${MIRIFLAGS-} -O -Zmir-opt-level=4 -Cdebug-assertions=yes" MIRI_SKIP_UI_CHECKS=1 ./miri test -- tests/{pass,panic}
7676
fi
77-
if [ -n "${MANY_SEEDS:-}" ]; then
77+
if [ -n "${MANY_SEEDS-}" ]; then
7878
# Also run some many-seeds tests. 64 seeds means this takes around a minute per test.
7979
# (Need to invoke via explicit `bash -c` for Windows.)
8080
for FILE in tests/many-seeds/*.rs; do
8181
MIRI_SEEDS=$MANY_SEEDS ./miri many-seeds "$BASH" -c "./miri run '$FILE'"
8282
done
8383
fi
84-
if [ -n "${TEST_BENCH:-}" ]; then
84+
if [ -n "${TEST_BENCH-}" ]; then
8585
# Check that the benchmarks build and run, but without actually benchmarking.
8686
HYPERFINE="'$BASH' -c" ./miri bench
8787
fi
@@ -112,7 +112,7 @@ function run_tests {
112112
}
113113

114114
function run_tests_minimal {
115-
if [ -n "${MIRI_TEST_TARGET:-}" ]; then
115+
if [ -n "${MIRI_TEST_TARGET-}" ]; then
116116
begingroup "Testing MINIMAL foreign architecture $MIRI_TEST_TARGET: only testing $@"
117117
else
118118
echo "run_tests_minimal requires MIRI_TEST_TARGET to be set"
@@ -169,7 +169,7 @@ case $HOST_TARGET in
169169
MIRI_TEST_TARGET=x86_64-unknown-linux-gnu run_tests
170170
;;
171171
*)
172-
echo "FATAL: unknown OS"
172+
echo "FATAL: unknown host target: $HOST_TARGET"
173173
exit 1
174174
;;
175175
esac

0 commit comments

Comments
 (0)