Skip to content

Commit

Permalink
Remember whether failure-status was explicitly specified
Browse files Browse the repository at this point in the history
Currently a test without a `failure-status` directive is treated as having an
expected failure-status of 1, but `run-coverage` tests will want to treat those
tests as expecting success instead.
  • Loading branch information
Zalathar committed Jun 28, 2023
1 parent a32cdee commit 75d01f8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
11 changes: 4 additions & 7 deletions src/tools/compiletest/src/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ pub struct TestProps {
// customized normalization rules
pub normalize_stdout: Vec<(String, String)>,
pub normalize_stderr: Vec<(String, String)>,
pub failure_status: i32,
pub failure_status: Option<i32>,
// For UI tests, allows compiler to exit with arbitrary failure status
pub dont_check_failure_status: bool,
// Whether or not `rustfix` should apply the `CodeSuggestion`s of this test and compile the
Expand Down Expand Up @@ -257,7 +257,7 @@ impl TestProps {
check_test_line_numbers_match: false,
normalize_stdout: vec![],
normalize_stderr: vec![],
failure_status: -1,
failure_status: None,
dont_check_failure_status: false,
run_rustfix: false,
rustfix_only_machine_applicable: false,
Expand Down Expand Up @@ -428,7 +428,7 @@ impl TestProps {
.parse_name_value_directive(ln, FAILURE_STATUS)
.and_then(|code| code.trim().parse::<i32>().ok())
{
self.failure_status = code;
self.failure_status = Some(code);
}

config.set_name_directive(
Expand Down Expand Up @@ -491,11 +491,8 @@ impl TestProps {
});
}

if self.failure_status == -1 {
self.failure_status = 1;
}
if self.should_ice {
self.failure_status = 101;
self.failure_status = Some(101);
}

if config.mode == Mode::Incremental {
Expand Down
2 changes: 1 addition & 1 deletion src/tools/compiletest/src/runtest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ impl<'test> TestCx<'test> {
}

fn check_correct_failure_status(&self, proc_res: &ProcRes) {
let expected_status = Some(self.props.failure_status);
let expected_status = Some(self.props.failure_status.unwrap_or(1));
let received_status = proc_res.status.code();

if expected_status != received_status {
Expand Down

0 comments on commit 75d01f8

Please sign in to comment.