Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Remember whether failure-status was explicitly specified
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
commit 75d01f8821f6da653a10fb773c18b56803ed076c
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