Skip to content

Commit aec4781

Browse files
authored
Rollup merge of #149911 - Zalathar:no-color, r=jieyouxu
bootstrap: Don't pass an unused `--color` to compiletest - Follow-up to #149850 --- This flag was an artifact of compiletest's old libtest-based test executor, and currently doesn't influence compiletest's output at all. A follow-up commit also inlines `force_coloring_in_ci` into its only remaining caller, and updates its comment.
2 parents 6b29f18 + 0e7dc32 commit aec4781

File tree

4 files changed

+9
-17
lines changed

4 files changed

+9
-17
lines changed

src/bootstrap/src/core/build_steps/test.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2401,7 +2401,6 @@ Please disable assertions with `rust.debug-assertions = false`.
24012401
let git_config = builder.config.git_config();
24022402
cmd.arg("--nightly-branch").arg(git_config.nightly_branch);
24032403
cmd.arg("--git-merge-commit-email").arg(git_config.git_merge_commit_email);
2404-
cmd.force_coloring_in_ci();
24052404

24062405
#[cfg(feature = "build-metrics")]
24072406
builder.metrics.begin_test_suite(

src/bootstrap/src/core/builder/cargo.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ use std::env;
22
use std::ffi::{OsStr, OsString};
33
use std::path::{Path, PathBuf};
44

5+
use build_helper::ci::CiEnv;
6+
57
use super::{Builder, Kind};
68
use crate::core::build_steps::test;
79
use crate::core::build_steps::tool::SourceType;
@@ -1334,7 +1336,13 @@ impl Builder<'_> {
13341336
// Try to use a sysroot-relative bindir, in case it was configured absolutely.
13351337
cargo.env("RUSTC_INSTALL_BINDIR", self.config.bindir_relative());
13361338

1337-
cargo.force_coloring_in_ci();
1339+
if CiEnv::is_ci() {
1340+
// Tell cargo to use colored output for nicer logs in CI, even
1341+
// though CI isn't printing to a terminal.
1342+
// Also set an explicit `TERM=xterm` so that cargo doesn't warn
1343+
// about TERM not being set.
1344+
cargo.env("TERM", "xterm").args(["--color=always"]);
1345+
};
13381346

13391347
// When we build Rust dylibs they're all intended for intermediate
13401348
// usage, so make sure we pass the -Cprefer-dynamic flag instead of

src/bootstrap/src/utils/exec.rs

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ use std::process::{
2121
use std::sync::{Arc, Mutex};
2222
use std::time::{Duration, Instant};
2323

24-
use build_helper::ci::CiEnv;
2524
use build_helper::drop_bomb::DropBomb;
2625
use build_helper::exit;
2726

@@ -390,18 +389,6 @@ impl<'a> BootstrapCommand {
390389
self.drop_bomb.get_created_location()
391390
}
392391

393-
/// If in a CI environment, forces the command to run with colors.
394-
pub fn force_coloring_in_ci(&mut self) {
395-
if CiEnv::is_ci() {
396-
// Due to use of stamp/docker, the output stream of bootstrap is not
397-
// a TTY in CI, so coloring is by-default turned off.
398-
// The explicit `TERM=xterm` environment is needed for
399-
// `--color always` to actually work. This env var was lost when
400-
// compiling through the Makefile. Very strange.
401-
self.env("TERM", "xterm").args(["--color", "always"]);
402-
}
403-
}
404-
405392
pub fn fingerprint(&self) -> CommandFingerprint {
406393
let command = &self.command;
407394
CommandFingerprint {

src/tools/compiletest/src/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,6 @@ fn parse_config(args: Vec<String>) -> Config {
136136
)
137137
.optflag("", "fail-fast", "stop as soon as possible after any test fails")
138138
.optopt("", "target", "the target to build for", "TARGET")
139-
// FIXME: Should be removed once `bootstrap` will be updated to not use this option.
140-
.optopt("", "color", "coloring: auto, always, never", "WHEN")
141139
.optopt("", "host", "the host to build for", "HOST")
142140
.optopt("", "cdb", "path to CDB to use for CDB debuginfo tests", "PATH")
143141
.optopt("", "gdb", "path to GDB to use for GDB debuginfo tests", "PATH")

0 commit comments

Comments
 (0)