From 14541044dbfa3593acfcf4861af28b9e8f1f84e7 Mon Sep 17 00:00:00 2001 From: Ben Kimock Date: Sat, 11 Mar 2023 16:44:19 -0500 Subject: [PATCH 1/2] Add a section on using nextest --- src/tools/miri/README.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/tools/miri/README.md b/src/tools/miri/README.md index 1086d0481c83..93e00cca117d 100644 --- a/src/tools/miri/README.md +++ b/src/tools/miri/README.md @@ -225,6 +225,26 @@ degree documented below): reduced feature set. We might ship Miri with a nightly even when some features on these targets regress. +### Running tests in parallel + +Though it implements Rust threading, Miri itself is a single-threaded interpreter. +This means that when running `cargo miri test`, you will probably see a dramatic +increase in the amount of time it takes to run your whole test suite due to the +inherent interpreter slowdown and a loss of parallelism. + +You can get your test suite's parallelism back by running `cargo miri nextest run -jN` +(note that you will need [`cargo-nextest`](https://nexte.st) installed). +This works because `cargo-nextest` collects a list of all tests then launches a +separate `cargo miri run` for each test. You will need to specify a `-j` or `--test-threads`, +by default `cargo miri nextest run` runs one test at a time. You can find the `cargo-nextest` +documentation for its Miri support here: https://nexte.st/book/miri.html + +Note: This one-test-per-process model means that `cargo miri test` is able to detect data +races where two tests race on a shared resource, but `cargo miri nextest run` will not detect +such races. + +Note: `cargo-nextest` does not support doctests, see https://github.com/nextest-rs/nextest/issues/16 + ### Common Problems When using the above instructions, you may encounter a number of confusing compiler From d3ce3de68c6a4d9db362f4128e8e544516f9d315 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Sun, 12 Mar 2023 22:23:09 +0100 Subject: [PATCH 2/2] tweak readme --- src/tools/miri/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/tools/miri/README.md b/src/tools/miri/README.md index 93e00cca117d..f0b73d058739 100644 --- a/src/tools/miri/README.md +++ b/src/tools/miri/README.md @@ -235,9 +235,9 @@ inherent interpreter slowdown and a loss of parallelism. You can get your test suite's parallelism back by running `cargo miri nextest run -jN` (note that you will need [`cargo-nextest`](https://nexte.st) installed). This works because `cargo-nextest` collects a list of all tests then launches a -separate `cargo miri run` for each test. You will need to specify a `-j` or `--test-threads`, -by default `cargo miri nextest run` runs one test at a time. You can find the `cargo-nextest` -documentation for its Miri support here: https://nexte.st/book/miri.html +separate `cargo miri run` for each test. You will need to specify a `-j` or `--test-threads`; +by default `cargo miri nextest run` runs one test at a time. For more details, see the +[`cargo-nextest` Miri documentation](https://nexte.st/book/miri.html). Note: This one-test-per-process model means that `cargo miri test` is able to detect data races where two tests race on a shared resource, but `cargo miri nextest run` will not detect