about summary refs log tree commit diff
diff options
context:
space:
mode:
authorStuart Cook <Zalathar@users.noreply.github.com>2025-08-26 14:19:19 +1000
committerGitHub <noreply@github.com>2025-08-26 14:19:19 +1000
commitcf0df7355cded00cb6a8364fb3735368e04ecf70 (patch)
tree80be3e4be9791946c74f841675d2ad9297f84e4a
parent6c310bab917e327710dfa41b6cde2f59c4b216ce (diff)
parent9567812592d435a7160071081d150b8146ca4625 (diff)
downloadrust-cf0df7355cded00cb6a8364fb3735368e04ecf70.tar.gz
rust-cf0df7355cded00cb6a8364fb3735368e04ecf70.zip
Rollup merge of #145821 - lolbinarycat:compiletest-error-show, r=clubby789
compiletest: if a compiler fails, show its output

Before, when working on something like a `rustdoc-js` test, if you made a syntax error in a rust file, you would not get that error output unless you ran with `--verbose`, which would also cause an enormous amount of other output to be printed as well.  This can also lead to frustration in new contributors who don't think to run with `--verbose`.

Now, if rustc or rustdoc is run by compiletest and produces an non-zero exit code, its output will be printed.
-rw-r--r--src/tools/compiletest/src/runtest.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs
index 739db8fa095..c533293e791 100644
--- a/src/tools/compiletest/src/runtest.rs
+++ b/src/tools/compiletest/src/runtest.rs
@@ -412,7 +412,7 @@ impl<'test> TestCx<'test> {
             cmdline: format!("{cmd:?}"),
         };
         self.dump_output(
-            self.config.verbose,
+            self.config.verbose || !proc_res.status.success(),
             &cmd.get_program().to_string_lossy(),
             &proc_res.stdout,
             &proc_res.stderr,
@@ -1486,7 +1486,7 @@ impl<'test> TestCx<'test> {
         };
 
         self.dump_output(
-            self.config.verbose,
+            self.config.verbose || (!result.status.success() && self.config.mode != TestMode::Ui),
             &command.get_program().to_string_lossy(),
             &result.stdout,
             &result.stderr,
@@ -2987,6 +2987,7 @@ struct ProcArgs {
     args: Vec<OsString>,
 }
 
+#[derive(Debug)]
 pub struct ProcRes {
     status: ExitStatus,
     stdout: String,