diff options
| author | Zalathar <Zalathar@users.noreply.github.com> | 2023-06-12 18:07:04 +1000 |
|---|---|---|
| committer | Zalathar <Zalathar@users.noreply.github.com> | 2023-06-28 11:08:09 +1000 |
| commit | 75d01f8821f6da653a10fb773c18b56803ed076c (patch) | |
| tree | 2791f2afab8ca556de9d793caf7e0a89652db152 | |
| parent | a32cdee4662852eeeba64eebb35516421d330d5b (diff) | |
| download | rust-75d01f8821f6da653a10fb773c18b56803ed076c.tar.gz rust-75d01f8821f6da653a10fb773c18b56803ed076c.zip | |
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.
| -rw-r--r-- | src/tools/compiletest/src/header.rs | 11 | ||||
| -rw-r--r-- | src/tools/compiletest/src/runtest.rs | 2 |
2 files changed, 5 insertions, 8 deletions
diff --git a/src/tools/compiletest/src/header.rs b/src/tools/compiletest/src/header.rs index 8cc935e54d1..00720e1c4db 100644 --- a/src/tools/compiletest/src/header.rs +++ b/src/tools/compiletest/src/header.rs @@ -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 @@ -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, @@ -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( @@ -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 { diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index c7093c9780d..91b9f668ce5 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -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 { |
