From e22baedb1f1099488cdfcc49f561ec24ea457395 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Sun, 17 May 2020 10:08:45 +0200 Subject: [PATCH] add test suite filter example to README and 'cargo miri --help' --- README.md | 11 ++++++----- src/bin/cargo-miri.rs | 6 +++++- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 02fbd6cdfa..12fc6d22cf 100644 --- a/README.md +++ b/README.md @@ -83,16 +83,17 @@ 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. +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-stacked-borrows` runs the program without checking +the aliasing of references. To filter the tests being run, use `cargo miri test +-- -- filter`. + 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 -basic type invariants and without checking the aliasing of references. - When compiling code via `cargo miri`, the `miri` config flag is set. You can use this to ignore test cases that fail under Miri because they do things Miri does not support: diff --git a/src/bin/cargo-miri.rs b/src/bin/cargo-miri.rs index b2e5238489..5dadd3f931 100644 --- a/src/bin/cargo-miri.rs +++ b/src/bin/cargo-miri.rs @@ -15,7 +15,7 @@ const XARGO_MIN_VERSION: (u32, u32, u32) = (0, 3, 20); const CARGO_MIRI_HELP: &str = r#"Interprets bin crates and tests in Miri Usage: - cargo miri [subcommand] [options] [--] [...] [--] [...] + cargo miri [subcommand] [...] [--] [...] [--] [...] Subcommands: run Run binaries (default) @@ -30,6 +30,10 @@ Common options: Other [options] are the same as `cargo check`. Everything after the first "--" is passed verbatim to Miri, which will pass everything after the second "--" verbatim to the interpreted program. + +Examples: + cargo miri run -- -Zmiri-disable-stacked-borrows + cargo miri test -- -- test-suite-filter "#; #[derive(Copy, Clone, Debug, PartialEq, Eq)]