about summary refs log tree commit diff
path: root/src/bootstrap
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-07-27 17:45:11 +0000
committerbors <bors@rust-lang.org>2023-07-27 17:45:11 +0000
commit0eb5efc7ae7479367c3d4567465cb042df176e71 (patch)
tree97c55793c950d33238c9d08308389537b2a787d9 /src/bootstrap
parent9339f446a5302cd5041d3f3b5e59761f36699167 (diff)
parent9439e02fb2332d6ffed6a61f95923204faa82655 (diff)
downloadrust-0eb5efc7ae7479367c3d4567465cb042df176e71.tar.gz
rust-0eb5efc7ae7479367c3d4567465cb042df176e71.zip
Auto merge of #113298 - tgross35:update-bless-envs, r=oli-obk
Unite bless environment variables under `RUST_BLESS`

Currently, Clippy and Miri both use an environment variable to indicate that output should be blessed, but they use different variable names. In order to improve consistency, this patch applies the following changes:

- Rename the variable `MIRI_BLESS` (as used in the Miri subtree) to `RUST_BLESS`
- Rename the variable `BLESS` (as used in the Clippy subtree) to `RUST_BLESS`
- Move emitting `RUST_BLESS` into `prepare_cargo_test` so it is always available (I need this for a WIP PR)

---

I prefer something like `RUST_BLESS` to `BLESS` just for a lower chance of conflict (not super common but other tools [do use `BLESS`](https://grep.app/search?q=%22BLESS%22&case=true&words=true&filter[lang][0]=Text&filter[lang][1]=Rust&filter[lang][2]=Python&filter[lang][3]=C%2B%2B&filter[lang][4]=Markdown&filter[lang][5]=C&filter[lang][6]=JSON)), but I can change it to whatever is preferred.

Original discussion: https://rust-lang.zulipchat.com/#narrow/stream/257328-clippy/topic/BLESS.20env.20var.3A.20rename.20to.20CLIPPY_BLESS

r? `@oli-obk`
cc `@flip1995`
Diffstat (limited to 'src/bootstrap')
-rw-r--r--src/bootstrap/test.rs25
1 files changed, 7 insertions, 18 deletions
diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs
index 1fe92098fd6..820fe5e5294 100644
--- a/src/bootstrap/test.rs
+++ b/src/bootstrap/test.rs
@@ -430,10 +430,6 @@ impl Step for Rustfmt {
             &[],
         );
 
-        if builder.config.cmd.bless() {
-            cargo.env("BLESS", "1");
-        }
-
         let dir = testdir(builder, compiler.host);
         t!(fs::create_dir_all(&dir));
         cargo.env("RUSTFMT_TEST_DIR", dir);
@@ -633,10 +629,6 @@ impl Step for Miri {
         cargo.env("MIRI_SYSROOT", &miri_sysroot);
         cargo.env("MIRI_HOST_SYSROOT", sysroot);
         cargo.env("MIRI", &miri);
-        // propagate --bless
-        if builder.config.cmd.bless() {
-            cargo.env("MIRI_BLESS", "Gesundheit");
-        }
 
         // Set the target.
         cargo.env("MIRI_TEST_TARGET", target.rustc_target_arg());
@@ -654,8 +646,8 @@ impl Step for Miri {
             cargo.env("MIRIFLAGS", "-O -Zmir-opt-level=4 -Cdebug-assertions=yes");
             // Optimizations can change backtraces
             cargo.env("MIRI_SKIP_UI_CHECKS", "1");
-            // `MIRI_SKIP_UI_CHECKS` and `MIRI_BLESS` are incompatible
-            cargo.env_remove("MIRI_BLESS");
+            // `MIRI_SKIP_UI_CHECKS` and `RUSTC_BLESS` are incompatible
+            cargo.env_remove("RUSTC_BLESS");
             // Optimizations can change error locations and remove UB so don't run `fail` tests.
             cargo.args(&["tests/pass", "tests/panic"]);
 
@@ -799,11 +791,6 @@ impl Step for Clippy {
         cargo.add_rustc_lib_path(builder, compiler);
         let mut cargo = prepare_cargo_test(cargo, &[], &[], "clippy", compiler, host, builder);
 
-        // propagate --bless
-        if builder.config.cmd.bless() {
-            cargo.env("BLESS", "Gesundheit");
-        }
-
         let _guard = builder.msg_sysroot_tool(Kind::Test, compiler.stage, "clippy", host, host);
 
         #[allow(deprecated)] // Clippy reports errors if it blessed the outputs
@@ -2245,9 +2232,11 @@ fn prepare_cargo_test(
 ) -> Command {
     let mut cargo = cargo.into();
 
-    // If bless is passed, give downstream crates a way to use it
-    if builder.config.cmd.bless() {
-        cargo.env("RUSTC_BLESS", "1");
+    // Propegate `--bless` if it has not already been set/unset
+    // Any tools that want to use this should bless if `RUSTC_BLESS` is set to
+    // anything other than `0`.
+    if builder.config.cmd.bless() && !cargo.get_envs().any(|v| v.0 == "RUSTC_BLESS") {
+        cargo.env("RUSTC_BLESS", "Gesundheit");
     }
 
     // Pass in some standard flags then iterate over the graph we've discovered