@@ -22,7 +22,7 @@ def cargo_miri(cmd):
22
22
return args
23
23
24
24
def test (name , cmd , stdout_ref , stderr_ref , stdin = b'' , env = {}):
25
- print ("==> Testing {} <== " .format (name ))
25
+ print ("Testing {}... " .format (name ))
26
26
## Call `cargo miri`, capture all output
27
27
p_env = os .environ .copy ()
28
28
p_env .update (env )
@@ -36,18 +36,17 @@ def test(name, cmd, stdout_ref, stderr_ref, stdin=b'', env={}):
36
36
(stdout , stderr ) = p .communicate (input = stdin )
37
37
stdout = stdout .decode ("UTF-8" )
38
38
stderr = stderr .decode ("UTF-8" )
39
+ if p .returncode == 0 and stdout == open (stdout_ref ).read () and stderr == open (stderr_ref ).read ():
40
+ # All good!
41
+ return
39
42
# Show output
40
- print ("=> captured stdout <= " )
43
+ print ("--- BEGIN stdout --- " )
41
44
print (stdout , end = "" )
42
- print ("=> captured stderr <=" )
45
+ print ("--- END stdout ---" )
46
+ print ("--- BEGIN stderr ---" )
43
47
print (stderr , end = "" )
44
- # Test for failures
45
- if p .returncode != 0 :
46
- fail ("Non-zero exit status" )
47
- if stdout != open (stdout_ref ).read ():
48
- fail ("stdout does not match reference" )
49
- if stderr != open (stderr_ref ).read ():
50
- fail ("stderr does not match reference" )
48
+ print ("--- END stderr ---" )
49
+ fail ("exit code was {}" .format (p .returncode ))
51
50
52
51
def test_cargo_miri_run ():
53
52
test ("`cargo miri run` (no isolation)" ,
@@ -96,7 +95,7 @@ def test_cargo_miri_test():
96
95
cargo_miri ("test" ) + ["--bin" , "cargo-miri-test" , "--" , "--format=pretty" ],
97
96
"test.stdout.ref4" , "test.stderr.ref2" ,
98
97
)
99
- test ("`cargo miri test` (subcrate)" ,
98
+ test ("`cargo miri test` (subcrate, no isolation )" ,
100
99
cargo_miri ("test" ) + ["-p" , "subcrate" ],
101
100
"test.stdout.ref5" , "test.stderr.ref2" ,
102
101
env = {'MIRIFLAGS' : "-Zmiri-disable-isolation" },
0 commit comments