Only look for tidy when running rustdoc tests

This avoids printing lots of unnecessary errors, as well as making the
test suite slightly faster.
This commit is contained in:
Joshua Nelson 2021-02-24 18:13:47 -05:00
parent a8486b64b0
commit 97ab01219c

View File

@ -195,11 +195,17 @@ fn make_absolute(path: PathBuf) -> PathBuf {
let src_base = opt_path(matches, "src-base");
let run_ignored = matches.opt_present("ignored");
let has_tidy = Command::new("tidy")
.arg("--version")
.stdout(Stdio::null())
.status()
.map_or(false, |status| status.success());
let mode = matches.opt_str("mode").unwrap().parse().expect("invalid mode");
let has_tidy = if mode == Mode::Rustdoc {
Command::new("tidy")
.arg("--version")
.stdout(Stdio::null())
.status()
.map_or(false, |status| status.success())
} else {
// Avoid spawning an external command when we know tidy won't be used.
false
};
Config {
bless: matches.opt_present("bless"),
compile_lib_path: make_absolute(opt_path(matches, "compile-lib-path")),
@ -218,7 +224,7 @@ fn make_absolute(path: PathBuf) -> PathBuf {
src_base,
build_base: opt_path(matches, "build-base"),
stage_id: matches.opt_str("stage-id").unwrap(),
mode: matches.opt_str("mode").unwrap().parse().expect("invalid mode"),
mode,
suite: matches.opt_str("suite").unwrap(),
debugger: None,
run_ignored,