test cargo miri test output when testing cargo miri
This commit is contained in:
parent
9417b28de5
commit
3fda8294bd
4 changed files with 26 additions and 9 deletions
|
|
@ -7,11 +7,11 @@ and the working directory to contain the cargo-miri-test project.
|
|||
|
||||
import sys, subprocess
|
||||
|
||||
def test_cargo_miri():
|
||||
print("==> Testing `cargo miri run` <==")
|
||||
def test(name, cmd, stdout_ref, stderr_ref):
|
||||
print("==> Testing `{}` <==".format(name))
|
||||
## Call `cargo miri`, capture all output
|
||||
p = subprocess.Popen(
|
||||
["cargo", "miri", "run", "-q"],
|
||||
cmd,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE
|
||||
)
|
||||
|
|
@ -26,17 +26,20 @@ def test_cargo_miri():
|
|||
# Test for failures
|
||||
if p.returncode != 0:
|
||||
sys.exit(1)
|
||||
if stdout != open('stdout.ref').read():
|
||||
if stdout != open(stdout_ref).read():
|
||||
print("stdout does not match reference")
|
||||
sys.exit(1)
|
||||
if stderr != open('stderr.ref').read():
|
||||
if stderr != open(stderr_ref).read():
|
||||
print("stderr does not match reference")
|
||||
sys.exit(1)
|
||||
|
||||
def test_cargo_miri_test():
|
||||
print("==> Testing `cargo miri test` <==")
|
||||
subprocess.check_call(["cargo", "miri", "test"])
|
||||
def test_cargo_miri_run():
|
||||
test("cargo miri run", ["cargo", "miri", "run", "-q"], "stout.ref", "stderr.ref")
|
||||
|
||||
test_cargo_miri()
|
||||
def test_cargo_miri_test():
|
||||
# FIXME: validation disabled for now because of https://github.com/rust-lang/rust/issues/54957
|
||||
test("cargo miri test", ["cargo", "miri", "test", "-q", "--", "-Zmiri-disable-validation"], "stout.ref", "stderr.ref")
|
||||
|
||||
test_cargo_miri_run()
|
||||
test_cargo_miri_test()
|
||||
sys.exit(0)
|
||||
|
|
|
|||
0
test-cargo-miri/test.stderr.ref
Normal file
0
test-cargo-miri/test.stderr.ref
Normal file
7
test-cargo-miri/test.stdout.ref
Normal file
7
test-cargo-miri/test.stdout.ref
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
|
||||
running 2 tests
|
||||
test bar ... ok
|
||||
test baz ... ok
|
||||
|
||||
test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
|
||||
|
||||
|
|
@ -2,3 +2,10 @@
|
|||
fn bar() {
|
||||
assert_eq!(4, 4);
|
||||
}
|
||||
|
||||
// Having more than 1 test does seem to make a difference
|
||||
// (i.e., this calls ptr::swap which having just one test does not).
|
||||
#[test]
|
||||
fn baz() {
|
||||
assert_eq!(5, 5);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue