@@ -357,14 +357,15 @@ impl<'test> TestCx<'test> {
357357 Ui if pm == Some ( PassMode :: Run ) || self . props . fail_mode == Some ( FailMode :: Run ) => {
358358 WillExecute :: Yes
359359 }
360- Ui => WillExecute :: No ,
360+ MirOpt if pm == Some ( PassMode :: Run ) => WillExecute :: Yes ,
361+ Ui | MirOpt => WillExecute :: No ,
361362 mode => panic ! ( "unimplemented for mode {:?}" , mode) ,
362363 }
363364 }
364365
365366 fn should_run_successfully ( & self , pm : Option < PassMode > ) -> bool {
366367 match self . config . mode {
367- Ui => pm == Some ( PassMode :: Run ) ,
368+ Ui | MirOpt => pm == Some ( PassMode :: Run ) ,
368369 mode => panic ! ( "unimplemented for mode {:?}" , mode) ,
369370 }
370371 }
@@ -3057,18 +3058,24 @@ impl<'test> TestCx<'test> {
30573058 }
30583059
30593060 fn run_mir_opt_test ( & self ) {
3060- let proc_res = self . compile_test ( WillExecute :: Yes , EmitMetadata :: No ) ;
3061+ let pm = self . pass_mode ( ) ;
3062+ let should_run = self . should_run ( pm) ;
3063+ let emit_metadata = self . should_emit_metadata ( pm) ;
3064+ let proc_res = self . compile_test ( should_run, emit_metadata) ;
30613065
30623066 if !proc_res. status . success ( ) {
30633067 self . fatal_proc_rec ( "compilation failed!" , & proc_res) ;
30643068 }
30653069
3066- let proc_res = self . exec_compiled_test ( ) ;
3070+ self . check_mir_dump ( ) ;
30673071
3068- if !proc_res. status . success ( ) {
3069- self . fatal_proc_rec ( "test run failed!" , & proc_res) ;
3072+ if let WillExecute :: Yes = should_run {
3073+ let proc_res = self . exec_compiled_test ( ) ;
3074+
3075+ if !proc_res. status . success ( ) {
3076+ self . fatal_proc_rec ( "test run failed!" , & proc_res) ;
3077+ }
30703078 }
3071- self . check_mir_dump ( ) ;
30723079 }
30733080
30743081 fn check_mir_dump ( & self ) {
0 commit comments