Skip to content

Commit b9ced21

Browse files
committed
update docs, and also use MIRIFLAGS for the test suite
1 parent 4e9fdb8 commit b9ced21

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,10 @@ Now you can run your project in Miri:
8383
The first time you run Miri, it will perform some extra setup and install some
8484
dependencies. It will ask you for confirmation before installing anything.
8585

86-
You can pass arguments to Miri after the first `--`, and pass arguments to the
87-
interpreted program or test suite after the second `--`. For example, `cargo
88-
miri run -- -Zmiri-disable-stacked-borrows` runs the program without checking
89-
the aliasing of references. To filter the tests being run, use `cargo miri test
90-
-- -- filter`.
86+
`cargo miri run/test` supports the exact same flags as `cargo run/test`. You
87+
can pass arguments to Miri via `MIRIFLAGS`. For example,
88+
`MIRIFLAGS="-Zmiri-disable-stacked-borrows" cargo miri run` runs the program
89+
without checking the aliasing of references.
9190

9291
Miri supports cross-execution: if you want to run the program as if it was a
9392
Linux program, you can do `cargo miri run --target x86_64-unknown-linux-gnu`.
@@ -163,7 +162,8 @@ up the sysroot. If you are using `miri` (the Miri driver) directly, see the
163162
## Miri `-Z` flags and environment variables
164163
[miri-flags]: #miri--z-flags-and-environment-variables
165164

166-
Miri adds its own set of `-Z` flags:
165+
Miri adds its own set of `-Z` flags, which are usually set via the `MIRIFLAGS`
166+
environment variable:
167167

168168
* `-Zmiri-disable-alignment-check` disables checking pointer alignment, so you
169169
can focus on other failures, but it means Miri can miss bugs in your program.
@@ -229,14 +229,14 @@ Moreover, Miri recognizes some environment variables:
229229

230230
* `MIRI_LOG`, `MIRI_BACKTRACE` control logging and backtrace printing during
231231
Miri executions, also [see above][testing-miri].
232+
* `MIRIFLAGS` (recognized by `cargo miri` and the test suite) defines extra
233+
flags to be passed to Miri.
232234
* `MIRI_SYSROOT` (recognized by `cargo miri` and the test suite)
233235
indicates the sysroot to use. To do the same thing with `miri`
234236
directly, use the `--sysroot` flag.
235237
* `MIRI_TEST_TARGET` (recognized by the test suite) indicates which target
236238
architecture to test against. `miri` and `cargo miri` accept the `--target`
237239
flag for the same purpose.
238-
* `MIRI_TEST_FLAGS` (recognized by the test suite) defines extra flags to be
239-
passed to Miri.
240240

241241
The following environment variables are internal, but used to communicate between
242242
different Miri binaries, and as such worth documenting:

ci.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ function run_tests {
2626
if ! [ -n "${MIRI_TEST_TARGET+exists}" ]; then
2727
# Only for host architecture: tests with MIR optimizations
2828
# FIXME: only testing level 2 because of <https://github.com/rust-lang/rust/issues/76432>.
29-
MIRI_TEST_FLAGS="-Z mir-opt-level=2" ./miri test --locked
29+
MIRIFLAGS="-Z mir-opt-level=2" ./miri test --locked
3030
fi
3131
# "miri test" has built the sysroot for us, now this should pass without
3232
# any interactive questions.

tests/compiletest.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ fn run_tests(mode: &str, path: &str, target: &str) {
2727
if let Ok(sysroot) = std::env::var("MIRI_SYSROOT") {
2828
flags.push(format!("--sysroot {}", sysroot));
2929
}
30-
if let Ok(extra_flags) = std::env::var("MIRI_TEST_FLAGS") {
30+
if let Ok(extra_flags) = std::env::var("MIRIFLAGS") {
3131
flags.push(extra_flags);
3232
}
3333

0 commit comments

Comments
 (0)