Skip to content

Commit b9ba8f9

Browse files
committed
Compare run-pass outputs if check-run-results flag enabled
Addresses rust-lang#63751
1 parent 0c379df commit b9ba8f9

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

src/tools/compiletest/src/runtest.rs

+19-2
Original file line numberDiff line numberDiff line change
@@ -2975,7 +2975,14 @@ impl<'test> TestCx<'test> {
29752975
let modes_to_prune = vec![CompareMode::Nll];
29762976
self.prune_duplicate_outputs(&modes_to_prune);
29772977

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

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

30553062
if self.should_run_successfully() {
30563063
let proc_res = self.exec_compiled_test();
3057-
3064+
let run_output_errors = if self.props.check_run_results {
3065+
self.load_compare_outputs(&proc_res, explicit)
3066+
} else {
3067+
0
3068+
};
3069+
if run_output_errors > 0 {
3070+
self.fatal_proc_rec(
3071+
&format!("{} errors occured comparing run output.", run_output_errors),
3072+
&proc_res,
3073+
);
3074+
}
30583075
if !proc_res.status.success() {
30593076
self.fatal_proc_rec("test run failed!", &proc_res);
30603077
}

0 commit comments

Comments
 (0)