@@ -21,18 +21,19 @@ def cargo_miri(cmd):
21
21
args += ["--target" , os .environ ['MIRI_TEST_TARGET' ]]
22
22
return args
23
23
24
- def test (name , cmd , stdout_ref , stderr_ref , env = {}):
24
+ def test (name , cmd , stdout_ref , stderr_ref , stdin = b'' , env = {}):
25
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 )
29
29
p = subprocess .Popen (
30
30
cmd ,
31
+ stdin = subprocess .PIPE ,
31
32
stdout = subprocess .PIPE ,
32
33
stderr = subprocess .PIPE ,
33
34
env = p_env ,
34
35
)
35
- (stdout , stderr ) = p .communicate ()
36
+ (stdout , stderr ) = p .communicate (input = stdin )
36
37
stdout = stdout .decode ("UTF-8" )
37
38
stderr = stderr .decode ("UTF-8" )
38
39
# Show output
@@ -51,15 +52,13 @@ def test(name, cmd, stdout_ref, stderr_ref, env={}):
51
52
def test_cargo_miri_run ():
52
53
test ("cargo miri run" ,
53
54
cargo_miri ("run" ),
54
- "stdout.ref" , "stderr.ref"
55
- )
56
- test ("cargo miri run (with target)" ,
57
- cargo_miri ("run" ) + ["--bin" , "cargo-miri-test" ],
58
- "stdout.ref" , "stderr.ref"
55
+ "stdout.ref" , "stderr.ref" ,
56
+ stdin = b'12\n 21\n ' ,
57
+ env = {'MIRIFLAGS' : "-Zmiri-disable-isolation" },
59
58
)
60
- test ("cargo miri run (with arguments)" ,
61
- cargo_miri ("run" ) + ["--" , "hello world" , '"hello world"' ],
62
- "stdout.ref " , "stderr.ref2"
59
+ test ("cargo miri run (with arguments and target )" ,
60
+ cargo_miri ("run" ) + ["--bin" , "cargo-miri-test" , "-- " , "hello world" , '"hello world"' ],
61
+ "stdout.ref2 " , "stderr.ref2"
63
62
)
64
63
65
64
def test_cargo_miri_test ():
0 commit comments