Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redo cargo-miri logic #1540

Merged
merged 29 commits into from
Sep 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
2b3b83e
canonicalize miri's directory
RalfJung Sep 6, 2020
16afe1a
towards letting cargo do binary selection: wrappers and runners set up
RalfJung Sep 6, 2020
e2119dc
stub JSON information flow from cargo-build-time to run-time
RalfJung Sep 7, 2020
7ee2729
it actually runs tests now!
RalfJung Sep 7, 2020
c41a039
patch --extern and --emit; test suite passes now!
RalfJung Sep 9, 2020
ee7d589
test respecting 'test=false', and what happens with doctests
RalfJung Sep 8, 2020
9a9988a
update docs, and also use MIRIFLAGS for the test suite
RalfJung Sep 8, 2020
0019fe2
fix typo
RalfJung Sep 8, 2020
147330c
even when not linking, create stub .rlib files to fool cargo
RalfJung Sep 8, 2020
53eab71
make our filename handling work better across platforms
RalfJung Sep 8, 2020
c793d60
handle binary suffices (for Windows); stop deleting fake binary
RalfJung Sep 8, 2020
10f58b3
fix Miri script on macOS
RalfJung Sep 9, 2020
119bf4d
forward build-time env vars to binary, and test that we do
RalfJung Sep 9, 2020
74fdb5c
patch away --error-format and --json so that errors are rendered prop…
RalfJung Sep 9, 2020
504c617
test reading from stdin
RalfJung Sep 9, 2020
ba3b354
update comment
RalfJung Sep 9, 2020
2205ed5
show proper warning about not running doctests
RalfJung Sep 11, 2020
93bedd0
fix cargo-miri-test for cross-runs
RalfJung Sep 11, 2020
174a92c
detect when the user passes Miri's flags the old way, and support thi…
RalfJung Sep 12, 2020
33c6696
test 'harness=false' tests
RalfJung Sep 12, 2020
113a335
test propagating env vars from build.rs to binary
RalfJung Sep 12, 2020
c99fb10
test 'cargo miri run' CWD, also for subcrate in a workspace
RalfJung Sep 12, 2020
b244a2d
make sure subcrate tests have the right cwd
RalfJung Sep 12, 2020
192b535
cleaner output for cargo-miri-test harness
RalfJung Sep 12, 2020
f7612f7
more consistent error capitalization
RalfJung Sep 12, 2020
18483b4
make (not yet actually used) doctest actually use the crate, and fix …
RalfJung Sep 12, 2020
05f5c3d
make sure tests pass even with RUST_TEST_NOCAPTURE set
RalfJung Sep 12, 2020
db067f4
test-cargo-miri: normalize slashes before comparing paths
RalfJung Sep 12, 2020
ae859c3
add comment mentioning alternative approach
RalfJung Sep 16, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,10 @@ 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`.
`cargo miri run/test` supports the exact same flags as `cargo run/test`. You
can pass arguments to Miri via `MIRIFLAGS`. For example,
`MIRIFLAGS="-Zmiri-disable-stacked-borrows" cargo miri run` runs the program
without checking the aliasing of references.

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`.
Expand Down Expand Up @@ -163,7 +162,8 @@ up the sysroot. If you are using `miri` (the Miri driver) directly, see the
## Miri `-Z` flags and environment variables
[miri-flags]: #miri--z-flags-and-environment-variables

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

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

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

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

* `MIRI_BE_RUSTC` when set to any value tells the Miri driver to actually not
interpret the code but compile it like rustc would. This is useful to be sure
that the compiled `rlib`s are compatible with Miri.
* `MIRI_CWD` when set to any value tells the Miri driver to change to the given
directory after loading all the source files, but before commencing
interpretation. This is useful if the interpreted program wants a different
working directory at run-time than at build-time.

## Miri `extern` functions

Expand Down
24 changes: 1 addition & 23 deletions cargo-miri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion cargo-miri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ test = false # we have no unit tests
doctest = false # and no doc tests

[dependencies]
cargo_metadata = "0.11"
directories = "2.0"
rustc_version = "0.2.3"
serde_json = "1.0.40"
Expand Down
Loading