@@ -21,18 +21,19 @@ def cargo_miri(cmd):
2121 args += ["--target" , os .environ ['MIRI_TEST_TARGET' ]]
2222 return args
2323
24- def test (name , cmd , stdout_ref , stderr_ref , env = {}):
24+ def test (name , cmd , stdout_ref , stderr_ref , stdin = b'' , env = {}):
2525 print ("==> Testing `{}` <==" .format (name ))
2626 ## Call `cargo miri`, capture all output
2727 p_env = os .environ .copy ()
2828 p_env .update (env )
2929 p = subprocess .Popen (
3030 cmd ,
31+ stdin = subprocess .PIPE ,
3132 stdout = subprocess .PIPE ,
3233 stderr = subprocess .PIPE ,
3334 env = p_env ,
3435 )
35- (stdout , stderr ) = p .communicate ()
36+ (stdout , stderr ) = p .communicate (input = stdin )
3637 stdout = stdout .decode ("UTF-8" )
3738 stderr = stderr .decode ("UTF-8" )
3839 # Show output
@@ -51,15 +52,13 @@ def test(name, cmd, stdout_ref, stderr_ref, env={}):
5152def test_cargo_miri_run ():
5253 test ("cargo miri run" ,
5354 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" },
5958 )
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"
6362 )
6463
6564def test_cargo_miri_test ():
0 commit comments