Skip to content

compiletest: tidy up how tidy and tidy (html version) are disambiguated #131961

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was originally just me being curious, but since tidy likes it I'm just going to keep this change in and delete this.

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
Loading