@@ -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" )
@@ -79,6 +82,12 @@ def test_cargo_miri_run():
79
82
'MIRITESTVAR' : "wrongval" , # make sure the build.rs value takes precedence
80
83
},
81
84
)
85
+ # Special test: run it again *without* `-q` to make sure nothing is being rebuilt (Miri issue #1722)
86
+ test_no_rebuild ("`cargo miri run` (no rebuild)" ,
87
+ cargo_miri ("run" , quiet = False ) + ["--" , "" ],
88
+ env = {'MIRITESTVAR' : "wrongval" }, # changing the env var causes a rebuild (re-runs build.rs),
89
+ # so keep it set
90
+ )
82
91
test ("`cargo miri run` (with arguments and target)" ,
83
92
cargo_miri ("run" ) + ["--bin" , "cargo-miri-test" , "--" , "hello world" , '"hello world"' ],
84
93
"run.args.stdout.ref" , "run.args.stderr.ref" ,
@@ -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