about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2022-10-08 09:04:54 +0200
committerRalf Jung <post@ralfj.de>2022-10-08 10:16:59 +0200
commit5243ae96fe6e82a6a03041d798fae59b5c0c3886 (patch)
treedacc22d30607e6b9d91d7dabccb16cfa77881e2c
parent58b13b7b882da8785fbadada06a2c5dc714cf6e8 (diff)
downloadrust-5243ae96fe6e82a6a03041d798fae59b5c0c3886.tar.gz
rust-5243ae96fe6e82a6a03041d798fae59b5c0c3886.zip
bless cargo-miri output
I think cargo has a bug here: https://github.com/rust-lang/cargo/issues/11191
but for now we bless its output so that we can keep CI green
-rw-r--r--src/tools/miri/README.md9
-rwxr-xr-xsrc/tools/miri/test-cargo-miri/run-test.py5
-rw-r--r--src/tools/miri/test-cargo-miri/test.filter.cross-target.stdout.ref5
-rw-r--r--src/tools/miri/test-cargo-miri/test.filter.stdout.ref10
4 files changed, 18 insertions, 11 deletions
diff --git a/src/tools/miri/README.md b/src/tools/miri/README.md
index d75f0cc1e80..7ad51520a42 100644
--- a/src/tools/miri/README.md
+++ b/src/tools/miri/README.md
@@ -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
diff --git a/src/tools/miri/test-cargo-miri/run-test.py b/src/tools/miri/test-cargo-miri/run-test.py
index 4485d3252cc..c611b9c44be 100755
--- a/src/tools/miri/test-cargo-miri/run-test.py
+++ b/src/tools/miri/test-cargo-miri/run-test.py
@@ -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)
diff --git a/src/tools/miri/test-cargo-miri/test.filter.cross-target.stdout.ref b/src/tools/miri/test-cargo-miri/test.filter.cross-target.stdout.ref
index bb0282d6c91..39e1857060d 100644
--- a/src/tools/miri/test-cargo-miri/test.filter.cross-target.stdout.ref
+++ b/src/tools/miri/test-cargo-miri/test.filter.cross-target.stdout.ref
@@ -1,6 +1,11 @@
 
 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
 
 imported main
diff --git a/src/tools/miri/test-cargo-miri/test.filter.stdout.ref b/src/tools/miri/test-cargo-miri/test.filter.stdout.ref
index c618956656a..39e1857060d 100644
--- a/src/tools/miri/test-cargo-miri/test.filter.stdout.ref
+++ b/src/tools/miri/test-cargo-miri/test.filter.stdout.ref
@@ -1,6 +1,11 @@
 
 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
 
 imported main
@@ -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
-