Skip to content

Commit

Permalink
Compare run-pass outputs if check-run-results flag enabled
Browse files Browse the repository at this point in the history
Addresses rust-lang#63751
  • Loading branch information
nathanwhit committed Aug 22, 2019
1 parent 0c379df commit b9ba8f9
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions src/tools/compiletest/src/runtest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2975,7 +2975,14 @@ impl<'test> TestCx<'test> {
let modes_to_prune = vec![CompareMode::Nll];
self.prune_duplicate_outputs(&modes_to_prune);

let mut errors = self.load_compare_outputs(&proc_res, explicit);
// if the user specified to check the results of the
// run-pass test, delay loading and comparing output
// until execution of the binary
let mut errors = if !self.props.check_run_results {
self.load_compare_outputs(&proc_res, explicit)
} else {
0
};

if self.config.compare_mode.is_some() {
// don't test rustfix with nll right now
Expand Down Expand Up @@ -3054,7 +3061,17 @@ impl<'test> TestCx<'test> {

if self.should_run_successfully() {
let proc_res = self.exec_compiled_test();

let run_output_errors = if self.props.check_run_results {
self.load_compare_outputs(&proc_res, explicit)
} else {
0
};
if run_output_errors > 0 {
self.fatal_proc_rec(
&format!("{} errors occured comparing run output.", run_output_errors),
&proc_res,
);
}
if !proc_res.status.success() {
self.fatal_proc_rec("test run failed!", &proc_res);
}
Expand Down

0 comments on commit b9ba8f9

Please sign in to comment.