@@ -50,12 +50,15 @@ def test(name, cmd, stdout_ref, stderr_ref, stdin=b'', env={}):
50
50
print ("--- END stderr ---" )
51
51
fail ("exit code was {}" .format (p .returncode ))
52
52
53
- def test_no_rebuild (name , cmd ):
53
+ def test_no_rebuild (name , cmd , env = {} ):
54
54
print ("Testing {}..." .format (name ))
55
+ p_env = os .environ .copy ()
56
+ p_env .update (env )
55
57
p = subprocess .Popen (
56
58
cmd ,
57
59
stdout = subprocess .PIPE ,
58
60
stderr = subprocess .PIPE ,
61
+ env = p_env ,
59
62
)
60
63
(stdout , stderr ) = p .communicate ()
61
64
stdout = stdout .decode ("UTF-8" )
@@ -70,14 +73,20 @@ def test_no_rebuild(name, cmd):
70
73
fail ("Something was being rebuilt when it should not be (or we got no output)" );
71
74
72
75
def test_cargo_miri_run ():
76
+ default_env = {
77
+ 'MIRIFLAGS' : "-Zmiri-disable-isolation" ,
78
+ 'MIRITESTVAR' : "wrongval" , # make sure the build.rs value takes precedence
79
+ }
73
80
test ("`cargo miri run` (no isolation)" ,
74
81
cargo_miri ("run" ),
75
82
"run.default.stdout.ref" , "run.default.stderr.ref" ,
76
83
stdin = b'12\n 21\n ' ,
77
- env = {
78
- 'MIRIFLAGS' : "-Zmiri-disable-isolation" ,
79
- 'MIRITESTVAR' : "wrongval" , # make sure the build.rs value takes precedence
80
- },
84
+ env = default_env ,
85
+ )
86
+ # Special test: run it again *without* `-q` to make sure nothing is being rebuilt (Miri issue #1722)
87
+ test_no_rebuild ("`cargo miri run` (no rebuild, no isolation)" ,
88
+ cargo_miri ("run" , quiet = False ) + ["--" , "" ],
89
+ env = default_env ,
81
90
)
82
91
test ("`cargo miri run` (with arguments and target)" ,
83
92
cargo_miri ("run" ) + ["--bin" , "cargo-miri-test" , "--" , "hello world" , '"hello world"' ],
@@ -88,12 +97,6 @@ def test_cargo_miri_run():
88
97
"run.subcrate.stdout.ref" , "run.subcrate.stderr.ref" ,
89
98
env = {'MIRIFLAGS' : "-Zmiri-disable-isolation" },
90
99
)
91
- # Special test: run it again *without* `-q` to make sure nothing is being rebuilt (Miri issue #1722)
92
- # FIXME: move this test up to right after the first `test`
93
- # (currently that fails, only the 3rd and later runs are really clean... see Miri issue #1722)
94
- test_no_rebuild ("`cargo miri run` (no rebuild)" ,
95
- cargo_miri ("run" , quiet = False ) + ["--" , "" ],
96
- )
97
100
98
101
def test_cargo_miri_test ():
99
102
# rustdoc is not run on foreign targets
0 commit comments