Skip to content

Commit 75d01f8

Browse files
committed
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.
1 parent a32cdee commit 75d01f8

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

src/tools/compiletest/src/header.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ pub struct TestProps {
161161
// customized normalization rules
162162
pub normalize_stdout: Vec<(String, String)>,
163163
pub normalize_stderr: Vec<(String, String)>,
164-
pub failure_status: i32,
164+
pub failure_status: Option<i32>,
165165
// For UI tests, allows compiler to exit with arbitrary failure status
166166
pub dont_check_failure_status: bool,
167167
// Whether or not `rustfix` should apply the `CodeSuggestion`s of this test and compile the
@@ -257,7 +257,7 @@ impl TestProps {
257257
check_test_line_numbers_match: false,
258258
normalize_stdout: vec![],
259259
normalize_stderr: vec![],
260-
failure_status: -1,
260+
failure_status: None,
261261
dont_check_failure_status: false,
262262
run_rustfix: false,
263263
rustfix_only_machine_applicable: false,
@@ -428,7 +428,7 @@ impl TestProps {
428428
.parse_name_value_directive(ln, FAILURE_STATUS)
429429
.and_then(|code| code.trim().parse::<i32>().ok())
430430
{
431-
self.failure_status = code;
431+
self.failure_status = Some(code);
432432
}
433433

434434
config.set_name_directive(
@@ -491,11 +491,8 @@ impl TestProps {
491491
});
492492
}
493493

494-
if self.failure_status == -1 {
495-
self.failure_status = 1;
496-
}
497494
if self.should_ice {
498-
self.failure_status = 101;
495+
self.failure_status = Some(101);
499496
}
500497

501498
if config.mode == Mode::Incremental {

src/tools/compiletest/src/runtest.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ impl<'test> TestCx<'test> {
384384
}
385385

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

390390
if expected_status != received_status {

0 commit comments

Comments
 (0)