Skip to content

print proc res for failed case in comp test #141977

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
1 change: 1 addition & 0 deletions src/tools/compiletest/src/runtest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2815,6 +2815,7 @@ struct ProcArgs {
args: Vec<OsString>,
}

#[derive(Clone)]
pub struct ProcRes {
status: ExitStatus,
stdout: String,
Expand Down
19 changes: 11 additions & 8 deletions src/tools/compiletest/src/runtest/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ impl TestCx<'_> {
);
}

let output_to_check = if let WillExecute::Yes = should_run {
let proc_res = self.exec_compiled_test();
let (output_to_check, proc_res_to_report) = if let WillExecute::Yes = should_run {
let new_proc_res = self.exec_compiled_test();
let run_output_errors = if self.props.check_run_results {
self.load_compare_outputs(&proc_res, TestOutput::Run, explicit)
} else {
Expand All @@ -137,26 +137,29 @@ impl TestCx<'_> {
if run_output_errors > 0 {
self.fatal_proc_rec(
&format!("{} errors occurred comparing run output.", run_output_errors),
&proc_res,
&new_proc_res,
);
}
if self.should_run_successfully(pm) {
if !proc_res.status.success() {
self.fatal_proc_rec("test run failed!", &proc_res);
self.fatal_proc_rec("test run failed!", &new_proc_res);
}
} else if proc_res.status.success() {
self.fatal_proc_rec("test run succeeded!", &proc_res);
self.fatal_proc_rec("test run succeeded!", &new_proc_res);
}

self.get_output(&proc_res)
(self.get_output(&new_proc_res), new_proc_res.clone())
} else {
self.get_output(&proc_res)
(self.get_output(&proc_res), proc_res.clone())
};

debug!(
"run_ui_test: explicit={:?} config.compare_mode={:?} \
proc_res.status={:?} props.error_patterns={:?}",
explicit, self.config.compare_mode, proc_res.status, self.props.error_patterns
explicit,
self.config.compare_mode,
proc_res_to_report.status,
self.props.error_patterns
);

self.check_expected_errors(&proc_res);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why should this be using the other proc_res?

Expand Down
Loading