Skip to content

Commit

Permalink
Validate error patterns and error annotation in ui tests when present
Browse files Browse the repository at this point in the history
Previously, when compilation succeeded, neither error patterns nor error
annotation would be validated. Additionally, when compilation failed,
only error patterns would be validated if both error patterns and error
annotation were present.

Now both error patterns and error annotation are validated when present,
regardless of compilation status. Furthermore, for test that should run,
the error patterns are matched against executable output, which is what
some of tests already expect to happen, and when rust-lang#65506 is merged even
more ui tests will.
  • Loading branch information
tmiasko committed Nov 3, 2019
1 parent f6c2c4d commit 2c48622
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions src/tools/compiletest/src/runtest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3137,21 +3137,24 @@ impl<'test> TestCx<'test> {
self.fatal_proc_rec("test run succeeded!", &proc_res);
}
}
if !self.props.error_patterns.is_empty() {
// "// error-pattern" comments
self.check_error_patterns(&proc_res.stderr, &proc_res);
}
}

debug!("run_ui_test: explicit={:?} config.compare_mode={:?} expected_errors={:?} \
proc_res.status={:?} props.error_patterns={:?}",
explicit, self.config.compare_mode, expected_errors, proc_res.status,
self.props.error_patterns);
if !explicit && self.config.compare_mode.is_none() {
if !proc_res.status.success() {
if !self.props.error_patterns.is_empty() {
// "// error-pattern" comments
self.check_error_patterns(&proc_res.stderr, &proc_res);
} else {
// "//~ERROR comments"
self.check_expected_errors(expected_errors, &proc_res);
}
if !self.should_run() && !self.props.error_patterns.is_empty() {
// "// error-pattern" comments
self.check_error_patterns(&proc_res.stderr, &proc_res);
}
if !expected_errors.is_empty() {
// "//~ERROR comments"
self.check_expected_errors(expected_errors, &proc_res);
}
}

Expand Down

0 comments on commit 2c48622

Please sign in to comment.