@@ -20,6 +20,7 @@ to the final `cargo test` invocation.
20
20
21
21
./miri run <flags>:
22
22
Build miri, set up a sysroot and then run the driver with the given <flags>.
23
+ (Also respects MIRIFLAGS environment variable.)
23
24
24
25
The commands above also exist in a "-debug" variant (e.g. "./miri run-debug
25
26
<flags>") which uses debug builds instead of release builds, for faster build
@@ -31,6 +32,11 @@ Format all sources and tests. <flags> are passed to `rustfmt`.
31
32
./miri clippy <flags>:
32
33
Format all sources and tests. <flags> are passed to `cargo clippy`.
33
34
35
+ ./miri many-seeds <command>:
36
+ Runs <command> over and over again with different seeds for Miri. The MIRIFLAGS
37
+ variable is set to its original value appended with ` -Zmiri-seed=$SEED` for
38
+ many different seeds.
39
+
34
40
ENVIRONMENT VARIABLES
35
41
36
42
MIRI_SYSROOT:
@@ -41,6 +47,20 @@ Pass extra flags to all cargo invocations.
41
47
EOF
42
48
)
43
49
50
+ # Determine command.
51
+ COMMAND=" $1 "
52
+ [ $# -gt 0 ] && shift
53
+
54
+ # # Handle some commands early, since they should *not* alter the environment.
55
+ case " $COMMAND " in
56
+ many-seeds)
57
+ for SEED in $( { echo obase=16; seq 0 255; } | bc) ; do
58
+ MIRIFLAGS=" $MIRIFLAGS -Zmiri-seed=$SEED " $@ || { echo " Failing seed: $SEED " ; break ; }
59
+ done
60
+ exit 0
61
+ ;;
62
+ esac
63
+
44
64
# # Preparation
45
65
# macOS does not have a useful readlink/realpath so we have to use Python instead...
46
66
MIRIDIR=$( dirname " $( python3 -c ' import os, sys; print(os.path.realpath(sys.argv[1]))' " $0 " ) " )
@@ -99,10 +119,6 @@ find_sysroot() {
99
119
100
120
# # Main
101
121
102
- # Determine command.
103
- COMMAND=" $1 "
104
- [ $# -gt 0 ] && shift
105
-
106
122
# Determine flags passed to all cargo invocations.
107
123
# This is a bit more annoying that one would hope due to
108
124
# <https://github.com/rust-lang/cargo/issues/6992>.
@@ -166,7 +182,7 @@ run|run-debug)
166
182
$CARGO build $CARGO_BUILD_FLAGS --manifest-path " $MIRIDIR " /Cargo.toml
167
183
find_sysroot
168
184
# Then run the actual command.
169
- exec $CARGO run $CARGO_BUILD_FLAGS --manifest-path " $MIRIDIR " /Cargo.toml -- --sysroot " $MIRI_SYSROOT " " $@ "
185
+ exec $CARGO run $CARGO_BUILD_FLAGS --manifest-path " $MIRIDIR " /Cargo.toml -- --sysroot " $MIRI_SYSROOT " $MIRIFLAGS " $@ "
170
186
;;
171
187
fmt)
172
188
find " $MIRIDIR " -not \( -name target -prune \) -name ' *.rs' \
0 commit comments