@@ -326,6 +326,14 @@ impl<'test> TestCx<'test> {
326
326
self . props . pass_mode ( self . config )
327
327
}
328
328
329
+ fn should_run ( & self ) -> bool {
330
+ let pass_mode = self . pass_mode ( ) ;
331
+ match self . config . mode {
332
+ Ui => pass_mode == Some ( PassMode :: Run ) || pass_mode == Some ( PassMode :: RunFail ) ,
333
+ mode => panic ! ( "unimplemented for mode {:?}" , mode) ,
334
+ }
335
+ }
336
+
329
337
fn should_run_successfully ( & self ) -> bool {
330
338
let pass_mode = self . pass_mode ( ) ;
331
339
match self . config . mode {
@@ -1534,7 +1542,7 @@ impl<'test> TestCx<'test> {
1534
1542
fn compile_test ( & self ) -> ProcRes {
1535
1543
// Only use `make_exe_name` when the test ends up being executed.
1536
1544
let will_execute = match self . config . mode {
1537
- Ui => self . should_run_successfully ( ) ,
1545
+ Ui => self . should_run ( ) ,
1538
1546
Incremental => self . revision . unwrap ( ) . starts_with ( "r" ) ,
1539
1547
RunFail | RunPassValgrind | MirOpt |
1540
1548
DebugInfoCdb | DebugInfoGdbLldb | DebugInfoGdb | DebugInfoLldb => true ,
@@ -3107,7 +3115,7 @@ impl<'test> TestCx<'test> {
3107
3115
3108
3116
let expected_errors = errors:: load_errors ( & self . testpaths . file , self . revision ) ;
3109
3117
3110
- if self . should_run_successfully ( ) {
3118
+ if self . should_run ( ) {
3111
3119
let proc_res = self . exec_compiled_test ( ) ;
3112
3120
let run_output_errors = if self . props . check_run_results {
3113
3121
self . load_compare_outputs ( & proc_res, TestOutput :: Run , explicit)
@@ -3120,8 +3128,14 @@ impl<'test> TestCx<'test> {
3120
3128
& proc_res,
3121
3129
) ;
3122
3130
}
3123
- if !proc_res. status . success ( ) {
3124
- self . fatal_proc_rec ( "test run failed!" , & proc_res) ;
3131
+ if self . should_run_successfully ( ) {
3132
+ if !proc_res. status . success ( ) {
3133
+ self . fatal_proc_rec ( "test run failed!" , & proc_res) ;
3134
+ }
3135
+ } else {
3136
+ if proc_res. status . success ( ) {
3137
+ self . fatal_proc_rec ( "test run succeeded!" , & proc_res) ;
3138
+ }
3125
3139
}
3126
3140
}
3127
3141
0 commit comments