Skip to content

Commit

Permalink
Auto merge of rust-lang#134738 - clubby789:forbid-output-ui, r=jieyouxu
Browse files Browse the repository at this point in the history
compiletest: Support `forbid-output` in UI tests

The `forbid-output` directive is currently only run in incremental tests (although no incremental tests use it). There are some UI tests 'using' it, but it's doing nothing 😄 Let's fix this

Will also PR the dev guide to note this.

dev-guide PR: rust-lang/rustc-dev-guide#2171
  • Loading branch information
bors committed Dec 25, 2024
2 parents 68b9e4f + 5a8ecc9 commit a0a5c42
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/tools/compiletest/src/runtest/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,12 +145,13 @@ impl TestCx<'_> {
self.fatal_proc_rec("test run succeeded!", &proc_res);
}

let output_to_check = self.get_output(&proc_res);
if !self.props.error_patterns.is_empty() || !self.props.regex_error_patterns.is_empty()
{
// "// error-pattern" comments
let output_to_check = self.get_output(&proc_res);
self.check_all_error_patterns(&output_to_check, &proc_res, pm);
}
self.check_forbid_output(&output_to_check, &proc_res)
}

debug!(
Expand Down Expand Up @@ -181,11 +182,12 @@ impl TestCx<'_> {
);
self.fatal(&msg);
}
let output_to_check = self.get_output(&proc_res);
if check_patterns {
// "// error-pattern" comments
let output_to_check = self.get_output(&proc_res);
self.check_all_error_patterns(&output_to_check, &proc_res, pm);
}
self.check_forbid_output(&output_to_check, &proc_res);

if self.props.run_rustfix && self.config.compare_mode.is_none() {
// And finally, compile the fixed code and make sure it both
Expand Down

0 comments on commit a0a5c42

Please sign in to comment.