-
Notifications
You must be signed in to change notification settings - Fork 9
/
run-miri-test-all
executable file
·78 lines (70 loc) · 2.75 KB
/
run-miri-test-all
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/bin/bash
# To install MIRI, see: https://github.com/rust-lang/miri
echo "Sometime between 2022-07-01 and 2022-10-01 MIRI stopped exposing its vtable"
echo "simulation, so any tests using the queue/flat.rs implementation will fail."
echo "Those tests are now skipped. This means that it's no longer possible to check"
echo "for undefined behaviour in that queue implementation, unless you use an old "
echo "nightly. (It does pass with 2022-07-01 nightlies, though.)"
echo ""
export MIRIFLAGS=-Zmiri-disable-isolation
./run-feature-combinations | while read FEATURES
do
echo === $FEATURES
case "$FEATURES" in
*no-unsafe*) ;;
*)
echo "*** SKIPPING test that uses queue/flat.rs because MIRI no longer exposes vtable simulation ***"
continue;;
esac
case "$FEATURES" in
*multi-*)
# These tests can run in parallel
cargo +nightly miri test $FEATURES || exit 1
continue;;
esac
# Since 1.67 `RUST_TEST_THREADS=1` no longer runs all tests in a
# single thread. See:
# <https://github.com/rust-lang/cargo/issues/11896> and
# <https://github.com/rust-lang/rust/issues/104053>. The general
# workaround for this problem is to run a worker thread and send
# the tests to that thread to run. However running a worker
# thread makes MIRI complain that we haven't waited for that
# thread to finish, and it seems impossible to do that. So
# instead run MIRI tests one at a time using --list and --exact.
COMMAND="cargo +nightly miri test --lib $FEATURES"
echo "*** Applying work-around for testing single-threaded tests ***"
FLAG_FAILED=/tmp/stakker-run-test-all-aux-$$-flag
FLAG_TESTED=/tmp/stakker-run-test-all-aux-$$-tested
TMPOUT=/tmp/stakker-run-test-all-aux-$$-out
rm -f $FLAG_FAILED >&/dev/null
rm -f $FLAG_TESTED >&/dev/null
$COMMAND -- --list 2>/dev/null |
grep ': test' |
perl -pe 's/: test$//;' |
while read xx
do
if $COMMAND -- --exact "$xx" >$TMPOUT 2>&1
then
grep "test .* [.][.][.]" $TMPOUT || cat $TMPOUT
else
echo "=== $xx"
cat $TMPOUT
touch $FLAG_FAILED
fi
rm $TMPOUT
touch $FLAG_TESTED
done
[ ! -f $FLAG_TESTED ] && {
$COMMAND -- --list
echo "NO TESTS WERE FOUND. Check run-miri-test-all script. Maybe output of --list has changed?"
rm -f $FLAG_FAILED >&/dev/null
exit 1
}
rm -f $FLAG_TESTED >&/dev/null
[ -f $FLAG_FAILED ] && {
rm $FLAG_FAILED
exit 1
}
# Doc-tests are run one-per-process and are unaffected
cargo +nightly miri test --doc $FEATURES || exit 1
done