From e1b654f09a6adeddb5a8b5e91cdcec656184c33f Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Sun, 22 Mar 2020 08:55:53 +0100 Subject: [PATCH] mention cross-running in docs --- CONTRIBUTING.md | 10 ++++++---- README.md | 5 +++++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c673e107d55d..573f9f6ef6e4 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -52,18 +52,19 @@ all the same flags as `rustc` (though the ones only affecting code generation and linking obviously will have no effect) [and more][miri-flags]. Running the Miri driver requires some fiddling with environment variables, so -the `miri` script helps you do that. For example, you can run the driver on a -particular file by doing +the `miri` script helps you do that. For example, you can (cross-)run the +driver on a particular file by doing ```sh ./miri run tests/run-pass/format.rs ./miri run tests/run-pass/hello.rs --target i686-unknown-linux-gnu ``` -and you can run the test suite using: +and you can (cross-)run the test suite using: ``` ./miri test +MIRI_TEST_TARGET=i686-unknown-linux-gnu ./miri test ``` `./miri test FILTER` only runs those tests that contain `FILTER` in their @@ -104,7 +105,8 @@ and then you can use it as if it was installed by `rustup`. Make sure you use the same toolchain when calling `cargo miri` that you used when installing Miri! There's a test for the cargo wrapper in the `test-cargo-miri` directory; run -`./run-test.py` in there to execute it. +`./run-test.py` in there to execute it. Like `./miri test`, this respects the +`MIRI_TEST_TARGET` environment variable to execute the test for another target. ## Building Miri with a locally built rustc diff --git a/README.md b/README.md index e0e7df24faad..59394830d79b 100644 --- a/README.md +++ b/README.md @@ -76,6 +76,11 @@ Now you can run your project in Miri: The first time you run Miri, it will perform some extra setup and install some dependencies. It will ask you for confirmation before installing anything. +Miri supports cross-execution: if you want to run the program as if it was a +Linux program, you can do `cargo miri run --target x86_64-unknown-linux-gnu`. +This is particularly useful if you are using Windows, as the Linux target is +much better supported than Windows targets. + You can pass arguments to Miri after the first `--`, and pass arguments to the interpreted program or test suite after the second `--`. For example, `cargo miri run -- -Zmiri-disable-validation` runs the program without validation of