]> git.lizzy.rs Git - rust.git/commitdiff
Only look for `tidy` when running rustdoc tests
authorJoshua Nelson <jyn514@gmail.com>
Wed, 24 Feb 2021 23:13:47 +0000 (18:13 -0500)
committerJoshua Nelson <jyn514@gmail.com>
Wed, 24 Feb 2021 23:14:43 +0000 (18:14 -0500)
This avoids printing lots of unnecessary errors, as well as making the
test suite slightly faster.

src/tools/compiletest/src/main.rs

index 5f263ea87db1804796faf0fb9986f4a372d0fade..b32a6f08638cc028ee9ddaead485e0fb0ba240e1 100644 (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,