Skip to content

Commit 409382d

Browse files
committed
Don't abort rustdoc tests if tidy isn't installed
Before: ``` Check compiletest suite=rustdoc mode=rustdoc (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu) running 396 tests ..................................................2020-11-23T12:12:37.735649Z ERROR compiletest::runtest: fatal error, panic: "failed to run tidy - is it installed? - No such file or directory (os error 2)" F................................................. 100/396 .................................................................................................... 200/396 .................................................................................................... 300/396 ...............................i...............2020-11-23T12:15:00.271271Z ERROR compiletest::runtest: fatal error, panic: "failed to run tidy - is it installed? - No such file or directory (os error 2)" F................................................ ``` After: ``` Check compiletest suite=rustdoc mode=rustdoc (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu) running 4 tests .FFF failures: ---- [rustdoc] rustdoc/fn-pointer-arg-name.rs stdout ---- error: htmldocck failed! status: exit code: 1 command: "/usr/bin/python" "/home/joshua/rustc/src/etc/htmldocck.py" "/home/joshua/rustc/build/x86_64-unknown-linux-gnu/test/rustdoc/fn-pointer-arg-name" "/home/joshua/rustc/src/test/rustdoc/fn-pointer-arg-name.rs" stdout: ------------------------------------------ ------------------------------------------ stderr: ------------------------------------------ 4: @Has check failed `XPATH PATTERN` did not match // @Has - '//*[@Class="rust fn"]' 'pub fn f(callback: fn(len: usize, foo: u32))' Encountered 1 errors ------------------------------------------ info: generating a diff against nightly rustdoc failed to run tidy - is it installed? - Permission denied (os error 13) failed to run tidy - is it installed? - Permission denied (os error 13) # a diff without running `tidy` ```
1 parent c3ed668 commit 409382d

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

src/tools/compiletest/src/runtest.rs

+16-11
Original file line numberDiff line numberDiff line change
@@ -2394,7 +2394,8 @@ impl<'test> TestCx<'test> {
23942394

23952395
let proc_res = new_rustdoc.document(&compare_dir);
23962396
if !proc_res.status.success() {
2397-
proc_res.fatal(Some("failed to run nightly rustdoc"), || ());
2397+
eprintln!("failed to run nightly rustdoc");
2398+
return;
23982399
}
23992400

24002401
#[rustfmt::skip]
@@ -2409,22 +2410,26 @@ impl<'test> TestCx<'test> {
24092410
];
24102411
let tidy_dir = |dir| {
24112412
let tidy = |file: &_| {
2412-
Command::new("tidy")
2413-
.args(&tidy_args)
2414-
.arg(file)
2415-
.spawn()
2416-
.unwrap_or_else(|err| {
2417-
self.fatal(&format!("failed to run tidy - is it installed? - {}", err))
2418-
})
2419-
.wait()
2420-
.unwrap()
2413+
let tidy_proc = Command::new("tidy").args(&tidy_args).arg(file).spawn();
2414+
match tidy_proc {
2415+
Ok(mut proc) => {
2416+
proc.wait().unwrap();
2417+
true
2418+
}
2419+
Err(err) => {
2420+
eprintln!("failed to run tidy - is it installed? - {}", err);
2421+
false
2422+
}
2423+
}
24212424
};
24222425
for entry in walkdir::WalkDir::new(dir) {
24232426
let entry = entry.expect("failed to read file");
24242427
if entry.file_type().is_file()
24252428
&& entry.path().extension().and_then(|p| p.to_str()) == Some("html".into())
24262429
{
2427-
tidy(entry.path());
2430+
if !tidy(entry.path()) {
2431+
return;
2432+
}
24282433
}
24292434
}
24302435
};

0 commit comments

Comments
 (0)