Skip to content

Commit

Permalink
Rollup merge of #131961 - jieyouxu:dirty, r=Zalathar
Browse files Browse the repository at this point in the history
compiletest: tidy up how `tidy` and `tidy` (html version) are disambiguated

Rename `has_tidy` -> `has_html_tidy` (`tidy` is also a bootstrap tool, but rustdoc uses a html tidy that has the same binary name). Follow-up to #131941.

Also apparently `runtest.rs` is short enough now, we can delete the `tidy` (bootstrap version) ignore for file length.
  • Loading branch information
matthiaskrgr authored Oct 20, 2024
2 parents 4aaa2ea + e32a5be commit 2515d15
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/tools/compiletest/src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -338,8 +338,8 @@ pub struct Config {
/// created in `/<build_base>/rustfix_missing_coverage.txt`
pub rustfix_coverage: bool,

/// whether to run `tidy` when a rustdoc test fails
pub has_tidy: bool,
/// whether to run `tidy` (html-tidy) when a rustdoc test fails
pub has_html_tidy: bool,

/// whether to run `enzyme` autodiff tests
pub has_enzyme: bool,
Expand Down
6 changes: 3 additions & 3 deletions src/tools/compiletest/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,14 +230,14 @@ pub fn parse_config(args: Vec<String>) -> Config {
let run_ignored = matches.opt_present("ignored");
let with_debug_assertions = matches.opt_present("with-debug-assertions");
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")
.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.
// Avoid spawning an external command when we know html-tidy won't be used.
false
};
let has_enzyme = matches.opt_present("has-enzyme");
Expand Down Expand Up @@ -336,7 +336,7 @@ pub fn parse_config(args: Vec<String>) -> Config {
.opt_str("compare-mode")
.map(|s| s.parse().expect("invalid --compare-mode provided")),
rustfix_coverage: matches.opt_present("rustfix-coverage"),
has_tidy,
has_html_tidy,
has_enzyme,
channel: matches.opt_str("channel").unwrap(),
git_hash: matches.opt_present("git-hash"),
Expand Down
2 changes: 1 addition & 1 deletion src/tools/compiletest/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ fn main() {

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");
}

Expand Down
4 changes: 1 addition & 3 deletions src/tools/compiletest/src/runtest.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// ignore-tidy-filelength

use std::borrow::Cow;
use std::collections::{HashMap, HashSet};
use std::ffi::OsString;
Expand Down Expand Up @@ -1897,7 +1895,7 @@ impl<'test> TestCx<'test> {
}

fn compare_to_default_rustdoc(&mut self, out_dir: &Path) {
if !self.config.has_tidy {
if !self.config.has_html_tidy {
return;
}
println!("info: generating a diff against nightly rustdoc");
Expand Down

0 comments on commit 2515d15

Please sign in to comment.