-
Notifications
You must be signed in to change notification settings - Fork 349
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
-Zmiri-env-forward=RUST_BACKTRACE
hint is not very helpful
#3838
Comments
Thanks for taking the time to report this! I agree the current experience is not great.
I'm afraid I don't want to do this. This would make Miri's RNG take an entirely different route through the program when that env var is set, which is something we do not want to occur -- Miri should be deterministic.
That's #2051. I am not sure yet about this, it's not at all how cargo usually works, and the implementation would necessarily be a bit hacky, but I am not fundamentally opposed.
rust-lang/rust#129501 should help here. (The message is actually not generated by Miri.) |
On a somewhat unrelated note:
Miri doesn't even know what a test suite is. It just runs the test harness as if it was any other binary. You can use the usual means of running only a particular subset of tests, same as with |
Hmm, is that because miri relies on the environment variables to seed the RNG, or because the presence of backtraces affects the RNG? Since I would assume that backtraces wouldn't affect anything, but I guess they probably do. |
It is because putting the env var into the machine state creates an allocation to hold the env var value, which fetches a number from the RNG and just changes what is returned by every subsequent RNG query. The presence of this variable in the heap also shifts around the memory locations of subsequence heap allocations, so even the length of an env var value changes the rest of the execution. |
Huh, I hadn't even realised that miri uses RNG to do allocations; it makes a lot of sense, but I hadn't thought of it. Maybe this is an indication that there should be some external way to set |
…ratrieb panicking: improve hint for Miri's RUST_BACKTRACE behavior Should help with rust-lang/miri#3838
…ratrieb panicking: improve hint for Miri's RUST_BACKTRACE behavior Should help with rust-lang/miri#3838
Rollup merge of rust-lang#129501 - RalfJung:miri-rust-backtrace, r=Noratrieb panicking: improve hint for Miri's RUST_BACKTRACE behavior Should help with rust-lang/miri#3838
panicking: improve hint for Miri's RUST_BACKTRACE behavior Should help with #3838
rust-lang/rust#129501 merged, and #2051 tracks making these flags easier to set -- I think there's nothing else left to do here (I don't think we want to forward this env var by default), so I'll close the issue. |
Let me explain the order of operations I went through:
cargo miri test
. Realise there are no backtraces.env RUST_BACKTRACE=1 cargo miri test
.env RUST_BACKTRACE=1 cargo miri test -Zmiri-env-forward=RUST_BACKTRACE
env RUST_BACKTRACE=1 RUSTFLAGS=-Zmiri-env-forward=RUST_BACKTRACE cargo miri test
-Zmiri-env-forward
and ultimately stumble on the readme for this repo mentioning I should useMIRIFLAGS
, notRUSTFLAGS
.This is… very frustrating. Not to mention I have a particularly large test suite I was running this on, and miri was running all tests by default, and it was quite slow between each step. It would be nice if any of the following applied:
RUST_BACKTRACE
was just special and always passed to miri, at least viacargo miri
.cargo miri
accepted-Z
flags to be passed directly to miri.RUST_BACKTRACE=1
just explicitly saidRUST_BACKTRACE=1 MIRIFLAGS=-Zmiri-env-forward=RUST_BACKTRACE
.This could potentially also be a cargo change, but since this message is being generated by miri itself, I figured I'd start here first.
The text was updated successfully, but these errors were encountered: