Skip to content

Commit

Permalink
bless cargo-miri output
Browse files Browse the repository at this point in the history
I think cargo has a bug here: rust-lang/cargo#11191
but for now we bless its output so that we can keep CI green
  • Loading branch information
RalfJung committed Oct 8, 2022
1 parent dc0faf3 commit 3ef7f91
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 11 deletions.
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -435,11 +435,10 @@ Moreover, Miri recognizes some environment variables:
purpose.
* `MIRI_NO_STD` (recognized by `cargo miri` and the test suite) makes sure that the target's
sysroot is built without libstd. This allows testing and running no_std programs.
* `MIRI_BLESS` (recognized by the test suite) overwrite all `stderr` and `stdout` files
instead of checking whether the output matches.
* `MIRI_SKIP_UI_CHECKS` (recognized by the test suite) don't check whether the
`stderr` or `stdout` files match the actual output. Useful for the rustc test suite
which has subtle differences that we don't care about.
* `MIRI_BLESS` (recognized by the test suite and `cargo-miri-test/run-test.py`): overwrite all
`stderr` and `stdout` files instead of checking whether the output matches.
* `MIRI_SKIP_UI_CHECKS` (recognized by the test suite): don't check whether the
`stderr` or `stdout` files match the actual output.

The following environment variables are *internal* and must not be used by
anyone but Miri itself. They are used to communicate between different Miri
Expand Down
5 changes: 4 additions & 1 deletion test-cargo-miri/run-test.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,13 @@ def normalize_stderr(str):
return str

def check_output(actual, path, name):
if 'MIRI_BLESS' in os.environ:
open(path, mode='w').write(actual)
return True
expected = open(path).read()
if expected == actual:
return True
print(f"{path} did not match reference!")
print(f"{name} output did not match reference in {path}!")
print(f"--- BEGIN diff {name} ---")
for text in difflib.unified_diff(expected.split("\n"), actual.split("\n")):
print(text)
Expand Down
5 changes: 5 additions & 0 deletions test-cargo-miri/test.filter.cross-target.stdout.ref
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@

running 0 tests

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


running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 2 filtered out
Expand Down
10 changes: 5 additions & 5 deletions test-cargo-miri/test.filter.stdout.ref
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@

running 0 tests

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


running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 2 filtered out
Expand All @@ -10,8 +15,3 @@ test simple ... ok

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


running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 4 filtered out; finished in $TIME

0 comments on commit 3ef7f91

Please sign in to comment.