Skip to content

Commit 12f51bf

Browse files
authored
Rollup merge of #154751 - Zalathar:rfail, r=wesleywiser
compiletest: Remove `rfail` support from incremental tests Incremental revisions beginning with `rfail` would cause the incremental test runner to build the test program, expecting success, and then run the test program, expecting failure. Expecting incremental tests to fail at runtime is of questionable utility, because in almost all cases an equivalent test program can be made to succeed at runtime instead. Removing `rfail` support is a small step towards cleaning up compiletest's incremental test runner, and its overall handling of pass/fail expectations. There was one existing regression test using `rfail` revisions: `tests/incremental/issue-80691-bad-eval-cache.rs`. The test code is complex, and reverting the fix in #83220 does not actually cause the test to fail, suggesting that it is no longer a useful regression test. This PR therefore deletes that test. (An earlier draft of this PR ported the test to run-make, but now it has been removed entirely.)
2 parents 82bcdd1 + a5181d2 commit 12f51bf

4 files changed

Lines changed: 7 additions & 222 deletions

File tree

src/doc/rustc-dev-guide/src/tests/compiletest.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,9 @@ then runs the compiler for each revision, reusing the incremental results from p
158158

159159
The revisions should start with:
160160

161-
* `rpass` — the test should compile and run successfully
162-
* `rfail` — the test should compile successfully, but the executable should fail to run
163161
* `cfail` — the test should fail to compile
162+
* `cpass` — the test should compile successully
163+
* `rpass` — the test should compile and run successfully
164164

165165
To make the revisions unique, you should add a suffix like `rpass1` and `rpass2`.
166166

src/tools/compiletest/src/runtest.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -333,15 +333,12 @@ impl<'test> TestCx<'test> {
333333
TestMode::Incremental => {
334334
let revision =
335335
self.revision.expect("incremental tests require a list of revisions");
336-
if revision.starts_with("cpass")
337-
|| revision.starts_with("rpass")
338-
|| revision.starts_with("rfail")
339-
{
336+
if revision.starts_with("cpass") || revision.starts_with("rpass") {
340337
true
341338
} else if revision.starts_with("cfail") {
342339
pm.is_some()
343340
} else {
344-
panic!("revision name must begin with cpass, rpass, rfail, or cfail");
341+
panic!("revision name must begin with `cfail`, `cpass`, or `rpass`");
345342
}
346343
}
347344
mode => panic!("unimplemented for mode {:?}", mode),

src/tools/compiletest/src/runtest/incremental.rs

Lines changed: 3 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,16 @@ impl TestCx<'_> {
55
pub(super) fn run_incremental_test(&self) {
66
// Basic plan for a test incremental/foo/bar.rs:
77
// - load list of revisions rpass1, cfail2, rpass3
8-
// - each should begin with `cpass`, `rpass`, `cfail`, or `rfail`
8+
// - each should begin with `cfail`, `cpass`, or `rpass`
99
// - if `cpass`, expect compilation to succeed, don't execute
1010
// - if `rpass`, expect compilation and execution to succeed
1111
// - if `cfail`, expect compilation to fail
12-
// - if `rfail`, expect compilation to succeed and execution to fail
1312
// - create a directory build/foo/bar.incremental
1413
// - compile foo/bar.rs with -C incremental=.../foo/bar.incremental and -C rpass1
1514
// - because name of revision starts with "rpass", expect success
1615
// - compile foo/bar.rs with -C incremental=.../foo/bar.incremental and -C cfail2
1716
// - because name of revision starts with "cfail", expect an error
18-
// - load expected errors as usual, but filter for those that end in `[rfail2]`
17+
// - load expected errors as usual, but filter for those with `[cfail2]`
1918
// - compile foo/bar.rs with -C incremental=.../foo/bar.incremental and -C rpass3
2019
// - because name of revision starts with "rpass", expect success
2120
// - execute build/foo/bar.exe and save output
@@ -43,15 +42,10 @@ impl TestCx<'_> {
4342
self.fatal("can only use should-ice in cfail tests");
4443
}
4544
self.run_rpass_test();
46-
} else if revision.starts_with("rfail") {
47-
if self.props.should_ice {
48-
self.fatal("can only use should-ice in cfail tests");
49-
}
50-
self.run_rfail_test();
5145
} else if revision.starts_with("cfail") {
5246
self.run_cfail_test();
5347
} else {
54-
self.fatal("revision name must begin with cpass, rpass, rfail, or cfail");
48+
self.fatal("revision name must begin with `cfail`, `cpass`, or `rpass`");
5549
}
5650
}
5751

@@ -111,24 +105,4 @@ impl TestCx<'_> {
111105

112106
self.check_forbid_output(&output_to_check, &proc_res);
113107
}
114-
115-
fn run_rfail_test(&self) {
116-
let pm = self.pass_mode();
117-
let should_run = self.run_if_enabled();
118-
let proc_res = self.compile_test(should_run, self.should_emit_metadata(pm));
119-
120-
if !proc_res.status.success() {
121-
self.fatal_proc_rec("compilation failed!", &proc_res);
122-
}
123-
124-
if let WillExecute::Disabled = should_run {
125-
return;
126-
}
127-
128-
let proc_res = self.exec_compiled_test();
129-
130-
let output_to_check = self.get_output(&proc_res);
131-
self.check_correct_failure_status(&proc_res);
132-
self.check_all_error_patterns(&output_to_check, &proc_res);
133-
}
134108
}

tests/incremental/issue-80691-bad-eval-cache.rs

Lines changed: 0 additions & 186 deletions
This file was deleted.

0 commit comments

Comments
 (0)