55and the working directory to contain the cargo-miri-test project.
66'''
77
8- import sys , subprocess
8+ import sys , subprocess , os
99
1010def fail (msg ):
1111 print ("TEST FAIL: {}" .format (msg ))
1212 sys .exit (1 )
1313
14+ def cargo_miri (cmd ):
15+ args = ["cargo" , "miri" , cmd , "-q" ]
16+ if 'MIRI_TEST_TARGET' in os .environ :
17+ args += ["--target" , os .environ ['MIRI_TEST_TARGET' ]]
18+ return args
19+
1420def test (name , cmd , stdout_ref , stderr_ref ):
1521 print ("==> Testing `{}` <==" .format (name ))
1622 ## Call `cargo miri`, capture all output
@@ -36,16 +42,22 @@ def test(name, cmd, stdout_ref, stderr_ref):
3642 fail ("stderr does not match reference" )
3743
3844def test_cargo_miri_run ():
39- test ("cargo miri run" , ["cargo" , "miri" , "run" , "-q" ], "stdout.ref" , "stderr.ref" )
45+ test ("cargo miri run" ,
46+ cargo_miri ("run" ),
47+ "stdout.ref" , "stderr.ref"
48+ )
4049 test ("cargo miri run (with arguments)" ,
41- [ "cargo" , "miri" , " run", "-q" , "--" , "--" , "hello world" , '"hello world"' ],
50+ cargo_miri ( " run") + [ "--" , "--" , "hello world" , '"hello world"' ],
4251 "stdout.ref" , "stderr.ref2"
4352 )
4453
4554def test_cargo_miri_test ():
46- test ("cargo miri test" , ["cargo" , "miri" , "test" , "-q" , "--" , "-Zmiri-seed=feed" ], "test.stdout.ref" , "test.stderr.ref" )
55+ test ("cargo miri test" ,
56+ cargo_miri ("test" ) + ["--" , "-Zmiri-seed=feed" ],
57+ "test.stdout.ref" , "test.stderr.ref"
58+ )
4759 test ("cargo miri test (with filter)" ,
48- [ "cargo" , "miri" , " test", "-q" , "--" , "--" , "impl" ],
60+ cargo_miri ( " test") + [ "--" , "--" , "impl" ],
4961 "test.stdout.ref2" , "test.stderr.ref"
5062 )
5163
0 commit comments