@@ -247,7 +247,6 @@ impl<'test> TestCx<'test> {
247
247
match self . config . mode {
248
248
CompileFail | ParseFail => self . run_cfail_test ( ) ,
249
249
RunFail => self . run_rfail_test ( ) ,
250
- RunPass => self . run_rpass_test ( ) ,
251
250
RunPassValgrind => self . run_valgrind_test ( ) ,
252
251
Pretty => self . run_pretty_test ( ) ,
253
252
DebugInfoGdb => self . run_debuginfo_gdb_test ( ) ,
@@ -257,13 +256,30 @@ impl<'test> TestCx<'test> {
257
256
CodegenUnits => self . run_codegen_units_test ( ) ,
258
257
Incremental => self . run_incremental_test ( ) ,
259
258
RunMake => self . run_rmake_test ( ) ,
260
- Ui => self . run_ui_test ( ) ,
259
+ RunPass | Ui => self . run_ui_test ( ) ,
261
260
MirOpt => self . run_mir_opt_test ( ) ,
262
261
}
263
262
}
264
263
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
+
265
281
fn check_if_test_should_compile ( & self , proc_res : & ProcRes ) {
266
- if self . props . compile_pass {
282
+ if self . should_compile_successfully ( ) {
267
283
if !proc_res. status . success ( ) {
268
284
self . fatal_proc_rec ( "test compilation failed although it shouldn't!" , proc_res) ;
269
285
}
@@ -1677,7 +1693,7 @@ impl<'test> TestCx<'test> {
1677
1693
rustc. arg ( "-Zui-testing" ) ;
1678
1694
}
1679
1695
}
1680
- Ui => {
1696
+ RunPass | Ui => {
1681
1697
if !self
1682
1698
. props
1683
1699
. compile_flags
@@ -1706,7 +1722,7 @@ impl<'test> TestCx<'test> {
1706
1722
1707
1723
rustc. arg ( dir_opt) ;
1708
1724
}
1709
- RunPass | RunFail | RunPassValgrind | Pretty | DebugInfoGdb | DebugInfoLldb
1725
+ RunFail | RunPassValgrind | Pretty | DebugInfoGdb | DebugInfoLldb
1710
1726
| Codegen | Rustdoc | RunMake | CodegenUnits => {
1711
1727
// do not use JSON output
1712
1728
}
@@ -2691,7 +2707,7 @@ impl<'test> TestCx<'test> {
2691
2707
2692
2708
let expected_errors = errors:: load_errors ( & self . testpaths . file , self . revision ) ;
2693
2709
2694
- if self . props . run_pass {
2710
+ if self . should_run_successfully ( ) {
2695
2711
let proc_res = self . exec_compiled_test ( ) ;
2696
2712
2697
2713
if !proc_res. status . success ( ) {
0 commit comments