about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJoshua Nelson <jyn514@gmail.com>2020-11-23 20:50:02 -0500
committerJoshua Nelson <jyn514@gmail.com>2020-12-12 08:38:13 -0500
commit409382dd3cd9113757c11d3af2c509dac2edf8f2 (patch)
tree4686ab89de1a56a388eb2f1f59407c412ad23f68
parentc3ed6681ff8d446e68ce272be4bf66f4145f6e29 (diff)
downloadrust-409382dd3cd9113757c11d3af2c509dac2edf8f2.tar.gz
rust-409382dd3cd9113757c11d3af2c509dac2edf8f2.zip
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`
```
-rw-r--r--src/tools/compiletest/src/runtest.rs27
1 files changed, 16 insertions, 11 deletions
diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs
index ccef005173d..398f3e31c6a 100644
--- a/src/tools/compiletest/src/runtest.rs
+++ b/src/tools/compiletest/src/runtest.rs
@@ -2394,7 +2394,8 @@ impl<'test> TestCx<'test> {
 
         let proc_res = new_rustdoc.document(&compare_dir);
         if !proc_res.status.success() {
-            proc_res.fatal(Some("failed to run nightly rustdoc"), || ());
+            eprintln!("failed to run nightly rustdoc");
+            return;
         }
 
         #[rustfmt::skip]
@@ -2409,22 +2410,26 @@ impl<'test> TestCx<'test> {
         ];
         let tidy_dir = |dir| {
             let tidy = |file: &_| {
-                Command::new("tidy")
-                    .args(&tidy_args)
-                    .arg(file)
-                    .spawn()
-                    .unwrap_or_else(|err| {
-                        self.fatal(&format!("failed to run tidy - is it installed? - {}", err))
-                    })
-                    .wait()
-                    .unwrap()
+                let tidy_proc = Command::new("tidy").args(&tidy_args).arg(file).spawn();
+                match tidy_proc {
+                    Ok(mut proc) => {
+                        proc.wait().unwrap();
+                        true
+                    }
+                    Err(err) => {
+                        eprintln!("failed to run tidy - is it installed? - {}", err);
+                        false
+                    }
+                }
             };
             for entry in walkdir::WalkDir::new(dir) {
                 let entry = entry.expect("failed to read file");
                 if entry.file_type().is_file()
                     && entry.path().extension().and_then(|p| p.to_str()) == Some("html".into())
                 {
-                    tidy(entry.path());
+                    if !tidy(entry.path()) {
+                        return;
+                    }
                 }
             }
         };