Skip to content

Commit

Permalink
Rollup merge of rust-lang#93508 - CraftSpider:jsondocck-runtest-outpu…
Browse files Browse the repository at this point in the history
…t, r=Mark-Simulacrum

Add rustdoc info to jsondocck output

Makes debugging issues in the generated output simpler by handling emitted logs and etc.
  • Loading branch information
matthiaskrgr authored Feb 4, 2022
2 parents 5c02582 + 71249a9 commit 19ccac8
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/tools/compiletest/src/runtest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2424,7 +2424,10 @@ impl<'test> TestCx<'test> {
);

if !res.status.success() {
self.fatal_proc_rec("jsondocck failed!", &res)
self.fatal_proc_rec_with_ctx("jsondocck failed!", &res, |_| {
println!("Rustdoc Output:");
proc_res.print_info();
})
}

let mut json_out = out_dir.join(self.testpaths.file.file_stem().unwrap());
Expand Down Expand Up @@ -3738,10 +3741,7 @@ pub struct ProcRes {
}

impl ProcRes {
pub fn fatal(&self, err: Option<&str>, on_failure: impl FnOnce()) -> ! {
if let Some(e) = err {
println!("\nerror: {}", e);
}
pub fn print_info(&self) {
print!(
"\
status: {}\n\
Expand All @@ -3760,6 +3760,13 @@ impl ProcRes {
json::extract_rendered(&self.stdout),
json::extract_rendered(&self.stderr),
);
}

pub fn fatal(&self, err: Option<&str>, on_failure: impl FnOnce()) -> ! {
if let Some(e) = err {
println!("\nerror: {}", e);
}
self.print_info();
on_failure();
// Use resume_unwind instead of panic!() to prevent a panic message + backtrace from
// compiletest, which is unnecessary noise.
Expand Down

0 comments on commit 19ccac8

Please sign in to comment.