Skip to content

Commit ddb1a2a

Browse files
committed
Make src/test/run-pass/ act like an alternative ui test suite.
1 parent 1002e40 commit ddb1a2a

File tree

1 file changed

+22
-6
lines changed

1 file changed

+22
-6
lines changed

src/tools/compiletest/src/runtest.rs

+22-6
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,6 @@ impl<'test> TestCx<'test> {
247247
match self.config.mode {
248248
CompileFail | ParseFail => self.run_cfail_test(),
249249
RunFail => self.run_rfail_test(),
250-
RunPass => self.run_rpass_test(),
251250
RunPassValgrind => self.run_valgrind_test(),
252251
Pretty => self.run_pretty_test(),
253252
DebugInfoGdb => self.run_debuginfo_gdb_test(),
@@ -257,13 +256,30 @@ impl<'test> TestCx<'test> {
257256
CodegenUnits => self.run_codegen_units_test(),
258257
Incremental => self.run_incremental_test(),
259258
RunMake => self.run_rmake_test(),
260-
Ui => self.run_ui_test(),
259+
RunPass | Ui => self.run_ui_test(),
261260
MirOpt => self.run_mir_opt_test(),
262261
}
263262
}
264263

264+
fn should_run_successfully(&self) -> bool {
265+
match self.config.mode {
266+
RunPass => true,
267+
Ui => self.props.run_pass,
268+
_ => unimplemented!(),
269+
}
270+
}
271+
272+
fn should_compile_successfully(&self) -> bool {
273+
match self.config.mode {
274+
CompileFail => false,
275+
RunPass => true,
276+
Ui => self.props.compile_pass,
277+
mode => panic!("unimplemented for mode {:?}", mode),
278+
}
279+
}
280+
265281
fn check_if_test_should_compile(&self, proc_res: &ProcRes) {
266-
if self.props.compile_pass {
282+
if self.should_compile_successfully() {
267283
if !proc_res.status.success() {
268284
self.fatal_proc_rec("test compilation failed although it shouldn't!", proc_res);
269285
}
@@ -1677,7 +1693,7 @@ impl<'test> TestCx<'test> {
16771693
rustc.arg("-Zui-testing");
16781694
}
16791695
}
1680-
Ui => {
1696+
RunPass | Ui => {
16811697
if !self
16821698
.props
16831699
.compile_flags
@@ -1706,7 +1722,7 @@ impl<'test> TestCx<'test> {
17061722

17071723
rustc.arg(dir_opt);
17081724
}
1709-
RunPass | RunFail | RunPassValgrind | Pretty | DebugInfoGdb | DebugInfoLldb
1725+
RunFail | RunPassValgrind | Pretty | DebugInfoGdb | DebugInfoLldb
17101726
| Codegen | Rustdoc | RunMake | CodegenUnits => {
17111727
// do not use JSON output
17121728
}
@@ -2691,7 +2707,7 @@ impl<'test> TestCx<'test> {
26912707

26922708
let expected_errors = errors::load_errors(&self.testpaths.file, self.revision);
26932709

2694-
if self.props.run_pass {
2710+
if self.should_run_successfully() {
26952711
let proc_res = self.exec_compiled_test();
26962712

26972713
if !proc_res.status.success() {

0 commit comments

Comments
 (0)