Skip to content

Commit 7650bd1

Browse files
author
Lukas Markeffsky
committed
Add cpass to incremental tests
1 parent 14c54b6 commit 7650bd1

File tree

1 file changed

+35
-15
lines changed

1 file changed

+35
-15
lines changed

src/tools/compiletest/src/runtest.rs

+35-15
Original file line numberDiff line numberDiff line change
@@ -278,13 +278,15 @@ impl<'test> TestCx<'test> {
278278
Incremental => {
279279
let revision =
280280
self.revision.expect("incremental tests require a list of revisions");
281-
if revision.starts_with("rpass") || revision.starts_with("rfail") {
281+
if revision.starts_with("cpass")
282+
|| revision.starts_with("rpass")
283+
|| revision.starts_with("rfail")
284+
{
282285
true
283286
} else if revision.starts_with("cfail") {
284-
// FIXME: would be nice if incremental revs could start with "cpass"
285287
pm.is_some()
286288
} else {
287-
panic!("revision name must begin with rpass, rfail, or cfail");
289+
panic!("revision name must begin with cpass, rpass, rfail, or cfail");
288290
}
289291
}
290292
mode => panic!("unimplemented for mode {:?}", mode),
@@ -384,6 +386,20 @@ impl<'test> TestCx<'test> {
384386
}
385387
}
386388

389+
fn run_cpass_test(&self) {
390+
let emit_metadata = self.should_emit_metadata(self.pass_mode());
391+
let proc_res = self.compile_test(WillExecute::No, emit_metadata);
392+
393+
if !proc_res.status.success() {
394+
self.fatal_proc_rec("compilation failed!", &proc_res);
395+
}
396+
397+
// FIXME(#41968): Move this check to tidy?
398+
if !errors::load_errors(&self.testpaths.file, self.revision).is_empty() {
399+
self.fatal("compile-pass tests with expected warnings should be moved to ui/");
400+
}
401+
}
402+
387403
fn run_rpass_test(&self) {
388404
let emit_metadata = self.should_emit_metadata(self.pass_mode());
389405
let should_run = self.run_if_enabled();
@@ -393,17 +409,15 @@ impl<'test> TestCx<'test> {
393409
self.fatal_proc_rec("compilation failed!", &proc_res);
394410
}
395411

412+
// FIXME(#41968): Move this check to tidy?
413+
if !errors::load_errors(&self.testpaths.file, self.revision).is_empty() {
414+
self.fatal("run-pass tests with expected warnings should be moved to ui/");
415+
}
416+
396417
if let WillExecute::Disabled = should_run {
397418
return;
398419
}
399420

400-
// FIXME(#41968): Move this check to tidy?
401-
let expected_errors = errors::load_errors(&self.testpaths.file, self.revision);
402-
assert!(
403-
expected_errors.is_empty(),
404-
"run-pass tests with expected warnings should be moved to ui/"
405-
);
406-
407421
let proc_res = self.exec_compiled_test();
408422
if !proc_res.status.success() {
409423
self.fatal_proc_rec("test run failed!", &proc_res);
@@ -2903,10 +2917,11 @@ impl<'test> TestCx<'test> {
29032917
fn run_incremental_test(&self) {
29042918
// Basic plan for a test incremental/foo/bar.rs:
29052919
// - load list of revisions rpass1, cfail2, rpass3
2906-
// - each should begin with `rpass`, `cfail`, or `rfail`
2907-
// - if `rpass`, expect compile and execution to succeed
2920+
// - each should begin with `cpass`, `rpass`, `cfail`, or `rfail`
2921+
// - if `cpass`, expect compilation to succeed, don't execute
2922+
// - if `rpass`, expect compilation and execution to succeed
29082923
// - if `cfail`, expect compilation to fail
2909-
// - if `rfail`, expect execution to fail
2924+
// - if `rfail`, expect compilation to succeed and execution to fail
29102925
// - create a directory build/foo/bar.incremental
29112926
// - compile foo/bar.rs with -C incremental=.../foo/bar.incremental and -C rpass1
29122927
// - because name of revision starts with "rpass", expect success
@@ -2930,7 +2945,12 @@ impl<'test> TestCx<'test> {
29302945
print!("revision={:?} props={:#?}", revision, self.props);
29312946
}
29322947

2933-
if revision.starts_with("rpass") {
2948+
if revision.starts_with("cpass") {
2949+
if self.props.should_ice {
2950+
self.fatal("can only use should-ice in cfail tests");
2951+
}
2952+
self.run_cpass_test();
2953+
} else if revision.starts_with("rpass") {
29342954
if self.props.should_ice {
29352955
self.fatal("can only use should-ice in cfail tests");
29362956
}
@@ -2943,7 +2963,7 @@ impl<'test> TestCx<'test> {
29432963
} else if revision.starts_with("cfail") {
29442964
self.run_cfail_test();
29452965
} else {
2946-
self.fatal("revision name must begin with rpass, rfail, or cfail");
2966+
self.fatal("revision name must begin with cpass, rpass, rfail, or cfail");
29472967
}
29482968
}
29492969

0 commit comments

Comments
 (0)