mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-27 01:04:03 +00:00
make env/var test deterministic
This commit is contained in:
parent
a200d38ce9
commit
daeb68a579
3
src/tools/miri/tests/pass/shims/env/var.rs
vendored
3
src/tools/miri/tests/pass/shims/env/var.rs
vendored
@ -1,3 +1,4 @@
|
|||||||
|
//@compile-flags: -Zmiri-preemption-rate=0
|
||||||
use std::env;
|
use std::env;
|
||||||
use std::thread;
|
use std::thread;
|
||||||
|
|
||||||
@ -26,6 +27,8 @@ fn main() {
|
|||||||
println!("{:#?}", env::vars().collect::<Vec<_>>());
|
println!("{:#?}", env::vars().collect::<Vec<_>>());
|
||||||
|
|
||||||
// Do things concurrently, to make sure there's no data race.
|
// Do things concurrently, to make sure there's no data race.
|
||||||
|
// We disable preemption to make sure the lock is not contended;
|
||||||
|
// that means we don't hit e.g. the futex codepath on Android (which we don't support).
|
||||||
let t = thread::spawn(|| {
|
let t = thread::spawn(|| {
|
||||||
env::set_var("MIRI_TEST", "42");
|
env::set_var("MIRI_TEST", "42");
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user