Skip to content

Commit

Permalink
Update test-cargo-miri
Browse files Browse the repository at this point in the history
  • Loading branch information
teryror committed Jan 16, 2021
1 parent 680df39 commit c06cc6e
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
7 changes: 5 additions & 2 deletions test-cargo-miri/run-test.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
and the working directory to contain the cargo-miri-test project.
'''

import sys, subprocess, os
import sys, subprocess, os, re

CGREEN = '\33[32m'
CBOLD = '\33[1m'
Expand All @@ -21,6 +21,9 @@ def cargo_miri(cmd):
args += ["--target", os.environ['MIRI_TEST_TARGET']]
return args

def scrub_timing_info(str):
return re.sub("finished in \d+\.\d\ds", "", str)

def test(name, cmd, stdout_ref, stderr_ref, stdin=b'', env={}):
print("Testing {}...".format(name))
## Call `cargo miri`, capture all output
Expand All @@ -36,7 +39,7 @@ def test(name, cmd, stdout_ref, stderr_ref, stdin=b'', env={}):
(stdout, stderr) = p.communicate(input=stdin)
stdout = stdout.decode("UTF-8")
stderr = stderr.decode("UTF-8")
if p.returncode == 0 and stdout == open(stdout_ref).read() and stderr == open(stderr_ref).read():
if p.returncode == 0 and scrub_timing_info(stdout) == scrub_timing_info(open(stdout_ref).read()) and stderr == open(stderr_ref).read():
# All good!
return
# Show output
Expand Down
6 changes: 6 additions & 0 deletions test-cargo-miri/test.default.stdout.ref
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,9 @@ running 7 tests
..i....
test result: ok. 6 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out


running 1 test
test src/lib.rs - make_true (line 2) ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.11s

5 changes: 5 additions & 0 deletions test-cargo-miri/test.filter.stdout.ref
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,8 @@ test simple1 ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 6 filtered out


running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 1 filtered out; finished in 0.00s

1 change: 0 additions & 1 deletion test-cargo-miri/test.stderr-rustdoc.ref
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
Running doctests is not currently supported by Miri.

0 comments on commit c06cc6e

Please sign in to comment.