@@ -326,6 +326,14 @@ impl<'test> TestCx<'test> {
326326 self . props . pass_mode ( self . config )
327327 }
328328
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+
329337 fn should_run_successfully ( & self ) -> bool {
330338 let pass_mode = self . pass_mode ( ) ;
331339 match self . config . mode {
@@ -1534,7 +1542,7 @@ impl<'test> TestCx<'test> {
15341542 fn compile_test ( & self ) -> ProcRes {
15351543 // Only use `make_exe_name` when the test ends up being executed.
15361544 let will_execute = match self . config . mode {
1537- Ui => self . should_run_successfully ( ) ,
1545+ Ui => self . should_run ( ) ,
15381546 Incremental => self . revision . unwrap ( ) . starts_with ( "r" ) ,
15391547 RunFail | RunPassValgrind | MirOpt |
15401548 DebugInfoCdb | DebugInfoGdbLldb | DebugInfoGdb | DebugInfoLldb => true ,
@@ -3107,7 +3115,7 @@ impl<'test> TestCx<'test> {
31073115
31083116 let expected_errors = errors:: load_errors ( & self . testpaths . file , self . revision ) ;
31093117
3110- if self . should_run_successfully ( ) {
3118+ if self . should_run ( ) {
31113119 let proc_res = self . exec_compiled_test ( ) ;
31123120 let run_output_errors = if self . props . check_run_results {
31133121 self . load_compare_outputs ( & proc_res, TestOutput :: Run , explicit)
@@ -3120,8 +3128,14 @@ impl<'test> TestCx<'test> {
31203128 & proc_res,
31213129 ) ;
31223130 }
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+ }
31253139 }
31263140 }
31273141
0 commit comments