about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPietro Albini <pietro@pietroalbini.org>2020-08-28 10:24:12 +0200
committerGitHub <noreply@github.com>2020-08-28 10:24:12 +0200
commit0106ad4e27389671bbf411ab6cdf8faa926ce0ae (patch)
tree46b2381c5f2cfd4296693402036037193d5654a2
parent35496c266713a8fa00f17df7d14bb85bc4e933e7 (diff)
parent55cd2433dc2f5025137a96d65bf681dd64b6f7f7 (diff)
downloadrust-0106ad4e27389671bbf411ab6cdf8faa926ce0ae.tar.gz
rust-0106ad4e27389671bbf411ab6cdf8faa926ce0ae.zip
Rollup merge of #76000 - richkadel:llvm-coverage-map-gen-6b.2, r=wesleywiser
Adds --bless support to test/run-make-fulldeps

The ability to "bless" output for some of these tests is critical to
making it practical to adapt tests to unrelated changes.

This is needed for new coverage tests, as shown in PR #76004 .

r? @tmandry
FYI: @wesleywiser
-rw-r--r--src/tools/compiletest/src/runtest.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs
index 124a9adcab9..965b20f5202 100644
--- a/src/tools/compiletest/src/runtest.rs
+++ b/src/tools/compiletest/src/runtest.rs
@@ -2782,6 +2782,18 @@ impl<'test> TestCx<'test> {
             cmd.env("RUSTFLAGS", "-Ctarget-feature=-crt-static").env("IS_MUSL_HOST", "1");
         }
 
+        if self.config.bless {
+            cmd.env("RUSTC_BLESS_TEST", "--bless");
+            // Assume this option is active if the environment variable is "defined", with _any_ value.
+            // As an example, a `Makefile` can use this option by:
+            //
+            //   ifdef RUSTC_BLESS_TEST
+            //       cp "$(TMPDIR)"/actual_something.ext expected_something.ext
+            //   else
+            //       $(DIFF) expected_something.ext "$(TMPDIR)"/actual_something.ext
+            //   endif
+        }
+
         if self.config.target.contains("msvc") && self.config.cc != "" {
             // We need to pass a path to `lib.exe`, so assume that `cc` is `cl.exe`
             // and that `lib.exe` lives next to it.