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.
This commit is contained in:
Stuart Cook 2025-08-26 14:19:19 +10:00 committed by GitHub
commit cf0df7355c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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,