compiletest: disambiguate between tidy and tidy (html version)

This commit is contained in:
许杰友 Jieyou Xu (Joe) 2024-10-20 11:36:46 +08:00
parent d68c327796
commit e32a5be3b0
4 changed files with 7 additions and 9 deletions

View File

@ -338,8 +338,8 @@ pub struct Config {
/// created in `/<build_base>/rustfix_missing_coverage.txt` /// created in `/<build_base>/rustfix_missing_coverage.txt`
pub rustfix_coverage: bool, pub rustfix_coverage: bool,
/// whether to run `tidy` when a rustdoc test fails /// whether to run `tidy` (html-tidy) when a rustdoc test fails
pub has_tidy: bool, pub has_html_tidy: bool,
/// whether to run `enzyme` autodiff tests /// whether to run `enzyme` autodiff tests
pub has_enzyme: bool, pub has_enzyme: bool,

View File

@ -230,14 +230,14 @@ fn make_absolute(path: PathBuf) -> PathBuf {
let run_ignored = matches.opt_present("ignored"); let run_ignored = matches.opt_present("ignored");
let with_debug_assertions = matches.opt_present("with-debug-assertions"); let with_debug_assertions = matches.opt_present("with-debug-assertions");
let mode = matches.opt_str("mode").unwrap().parse().expect("invalid mode"); let mode = matches.opt_str("mode").unwrap().parse().expect("invalid mode");
let has_tidy = if mode == Mode::Rustdoc { let has_html_tidy = if mode == Mode::Rustdoc {
Command::new("tidy") Command::new("tidy")
.arg("--version") .arg("--version")
.stdout(Stdio::null()) .stdout(Stdio::null())
.status() .status()
.map_or(false, |status| status.success()) .map_or(false, |status| status.success())
} else { } else {
// Avoid spawning an external command when we know tidy won't be used. // Avoid spawning an external command when we know html-tidy won't be used.
false false
}; };
let has_enzyme = matches.opt_present("has-enzyme"); let has_enzyme = matches.opt_present("has-enzyme");
@ -336,7 +336,7 @@ fn make_absolute(path: PathBuf) -> PathBuf {
.opt_str("compare-mode") .opt_str("compare-mode")
.map(|s| s.parse().expect("invalid --compare-mode provided")), .map(|s| s.parse().expect("invalid --compare-mode provided")),
rustfix_coverage: matches.opt_present("rustfix-coverage"), rustfix_coverage: matches.opt_present("rustfix-coverage"),
has_tidy, has_html_tidy,
has_enzyme, has_enzyme,
channel: matches.opt_str("channel").unwrap(), channel: matches.opt_str("channel").unwrap(),
git_hash: matches.opt_present("git-hash"), git_hash: matches.opt_present("git-hash"),

View File

@ -18,7 +18,7 @@ fn main() {
let config = Arc::new(parse_config(env::args().collect())); let config = Arc::new(parse_config(env::args().collect()));
if !config.has_tidy && config.mode == Mode::Rustdoc { if !config.has_html_tidy && config.mode == Mode::Rustdoc {
eprintln!("warning: `tidy` (html-tidy.org) is not installed; diffs will not be generated"); eprintln!("warning: `tidy` (html-tidy.org) is not installed; diffs will not be generated");
} }

View File

@ -1,5 +1,3 @@
// ignore-tidy-filelength
use std::borrow::Cow; use std::borrow::Cow;
use std::collections::{HashMap, HashSet}; use std::collections::{HashMap, HashSet};
use std::ffi::OsString; use std::ffi::OsString;
@ -1897,7 +1895,7 @@ fn charset() -> &'static str {
} }
fn compare_to_default_rustdoc(&mut self, out_dir: &Path) { fn compare_to_default_rustdoc(&mut self, out_dir: &Path) {
if !self.config.has_tidy { if !self.config.has_html_tidy {
return; return;
} }
println!("info: generating a diff against nightly rustdoc"); println!("info: generating a diff against nightly rustdoc");