Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 8f03405

Browse files
authoredMay 11, 2024
Rollup merge of rust-lang#125005 - RalfJung:miri-sync, r=RalfJung
Miri subtree update r? `@ghost`
2 parents 8eac6d2 + 79a85d4 commit 8f03405

File tree

156 files changed

+1182
-1166
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

156 files changed

+1182
-1166
lines changed
 

‎src/tools/miri/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ tex/*/out
99
perf.data
1010
perf.data.old
1111
flamegraph.svg
12-
tests/extern-so/libtestlib.so
12+
tests/native-lib/libtestlib.so
1313
.auto-*

‎src/tools/miri/CONTRIBUTING.md

Lines changed: 44 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,14 @@ For example:
7272

7373
You can (cross-)run the entire test suite using:
7474

75-
```
75+
```sh
7676
./miri test
77-
MIRI_TEST_TARGET=i686-unknown-linux-gnu ./miri test
77+
./miri test --target i686-unknown-linux-gnu
7878
```
7979

8080
`./miri test FILTER` only runs those tests that contain `FILTER` in their filename (including the
81-
base directory, e.g. `./miri test fail` will run all compile-fail tests). These filters are passed
82-
to `cargo test`, so for multiple filters you need to use `./miri test -- FILTER1 FILTER2`.
81+
base directory, e.g. `./miri test fail` will run all compile-fail tests). Multiple filters are
82+
supported: `./miri test FILTER1 FILTER2` runs all tests that contain either string.
8383

8484
#### Fine grained logging
8585

@@ -139,9 +139,8 @@ and then you can use it as if it was installed by `rustup` as a component of the
139139
in the `miri` toolchain's sysroot to prevent conflicts with other toolchains.
140140
The Miri binaries in the `cargo` bin directory (usually `~/.cargo/bin`) are managed by rustup.
141141

142-
There's a test for the cargo wrapper in the `test-cargo-miri` directory; run
143-
`./run-test.py` in there to execute it. Like `./miri test`, this respects the
144-
`MIRI_TEST_TARGET` environment variable to execute the test for another target.
142+
There's a test for the cargo wrapper in the `test-cargo-miri` directory; run `./run-test.py` in
143+
there to execute it. You can pass `--target` to execute the test for another target.
145144

146145
### Using a modified standard library
147146

@@ -287,3 +286,41 @@ https. Add the following to your `.gitconfig`:
287286
[url "git@github.com:"]
288287
pushInsteadOf = https://github.com/
289288
```
289+
290+
## Internal environment variables
291+
292+
The following environment variables are *internal* and must not be used by
293+
anyone but Miri itself. They are used to communicate between different Miri
294+
binaries, and as such worth documenting:
295+
296+
* `CARGO_EXTRA_FLAGS` is understood by `./miri` and passed to all host cargo invocations.
297+
* `MIRI_BE_RUSTC` can be set to `host` or `target`. It tells the Miri driver to
298+
actually not interpret the code but compile it like rustc would. With `target`, Miri sets
299+
some compiler flags to prepare the code for interpretation; with `host`, this is not done.
300+
This environment variable is useful to be sure that the compiled `rlib`s are compatible
301+
with Miri.
302+
* `MIRI_CALLED_FROM_SETUP` is set during the Miri sysroot build,
303+
which will re-invoke `cargo-miri` as the `rustc` to use for this build.
304+
* `MIRI_CALLED_FROM_RUSTDOC` when set to any value tells `cargo-miri` that it is
305+
running as a child process of `rustdoc`, which invokes it twice for each doc-test
306+
and requires special treatment, most notably a check-only build before interpretation.
307+
This is set by `cargo-miri` itself when running as a `rustdoc`-wrapper.
308+
* `MIRI_CWD` when set to any value tells the Miri driver to change to the given
309+
directory after loading all the source files, but before commencing
310+
interpretation. This is useful if the interpreted program wants a different
311+
working directory at run-time than at build-time.
312+
* `MIRI_LOCAL_CRATES` is set by `cargo-miri` to tell the Miri driver which
313+
crates should be given special treatment in diagnostics, in addition to the
314+
crate currently being compiled.
315+
* `MIRI_ORIG_RUSTDOC` is set and read by different phases of `cargo-miri` to remember the
316+
value of `RUSTDOC` from before it was overwritten.
317+
* `MIRI_REPLACE_LIBRS_IF_NOT_TEST` when set to any value enables a hack that helps bootstrap
318+
run the standard library tests in Miri.
319+
* `MIRI_TEST_TARGET` is set by `./miri test` (and `./x.py test miri`) to tell the test harness about
320+
the chosen target.
321+
* `MIRI_VERBOSE` when set to any value tells the various `cargo-miri` phases to
322+
perform verbose logging.
323+
* `MIRI_HOST_SYSROOT` is set by bootstrap to tell `cargo-miri` which sysroot to use for *host*
324+
operations.
325+
* `RUSTC_BLESS` is set by `./miri test` (and `./x.py test miri`) to indicate bless-mode to the test
326+
harness.

0 commit comments

Comments
 (0)
Please sign in to comment.