From cb448439006c2cd068b4ab667175fdcbe929f0ec Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Thu, 9 May 2024 11:21:10 +0200 Subject: [PATCH] make RUSTC_BLESS entirely an internal thing --- src/tools/miri/CONTRIBUTING.md | 2 ++ src/tools/miri/README.md | 2 -- src/tools/miri/test-cargo-miri/run-test.py | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/tools/miri/CONTRIBUTING.md b/src/tools/miri/CONTRIBUTING.md index 5a747e7935e3..092ad46a7cad 100644 --- a/src/tools/miri/CONTRIBUTING.md +++ b/src/tools/miri/CONTRIBUTING.md @@ -322,3 +322,5 @@ binaries, and as such worth documenting: perform verbose logging. * `MIRI_HOST_SYSROOT` is set by bootstrap to tell `cargo-miri` which sysroot to use for *host* operations. +* `RUSTC_BLESS` is set by `./miri test` (and `./x.py test miri`) to indicate bless-mode to the test + harness. diff --git a/src/tools/miri/README.md b/src/tools/miri/README.md index 1bdfc4ac1a78..92cb7b37820b 100644 --- a/src/tools/miri/README.md +++ b/src/tools/miri/README.md @@ -468,8 +468,6 @@ by all intended entry points, i.e. `cargo miri` and `./miri {test,run}`): * `MIRI_NO_STD` makes sure that the target's sysroot is built without libstd. This allows testing and running no_std programs. (Miri has a heuristic to detect no-std targets based on the target name; this environment variable is only needed when that heuristic fails.) -* `RUSTC_BLESS` (recognized by `./miri test` 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 `./miri test`): don't check whether the `stderr` or `stdout` files match the actual output. diff --git a/src/tools/miri/test-cargo-miri/run-test.py b/src/tools/miri/test-cargo-miri/run-test.py index 8bab66f3af9d..83f3e4c919b9 100755 --- a/src/tools/miri/test-cargo-miri/run-test.py +++ b/src/tools/miri/test-cargo-miri/run-test.py @@ -36,7 +36,7 @@ def normalize_stdout(str): return str def check_output(actual, path, name): - if os.environ.get("RUSTC_BLESS", "0") != "0": + if ARGS.bless: # Write the output only if bless is set open(path, mode='w').write(actual) return True @@ -185,6 +185,7 @@ def test_cargo_miri_test(): args_parser = argparse.ArgumentParser(description='`cargo miri` testing') args_parser.add_argument('--target', help='the target to test') +args_parser.add_argument('--bless', help='bless the reference files', action='store_true') ARGS = args_parser.parse_args() os.chdir(os.path.dirname(os.path.realpath(__file__)))