Skip to content

Commit bf846a6

Browse files
committed
test-cargo-miri: be more clear that and why the test failed
1 parent 61c0df7 commit bf846a6

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

test-cargo-miri/run-test.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77

88
import sys, subprocess
99

10+
def fail(msg):
11+
print("TEST FAIL: {}".format(msg))
12+
sys.exit(1)
13+
1014
def test(name, cmd, stdout_ref, stderr_ref):
1115
print("==> Testing `{}` <==".format(name))
1216
## Call `cargo miri`, capture all output
@@ -25,13 +29,11 @@ def test(name, cmd, stdout_ref, stderr_ref):
2529
print(stderr, end="")
2630
# Test for failures
2731
if p.returncode != 0:
28-
sys.exit(1)
32+
fail("Non-zero exit status")
2933
if stdout != open(stdout_ref).read():
30-
print("stdout does not match reference")
31-
sys.exit(1)
34+
fail("stdout does not match reference")
3235
if stderr != open(stderr_ref).read():
33-
print("stderr does not match reference")
34-
sys.exit(1)
36+
fail("stderr does not match reference")
3537

3638
def test_cargo_miri_run():
3739
test("cargo miri run", ["cargo", "miri", "run", "-q"], "stdout.ref", "stderr.ref")

0 commit comments

Comments
 (0)