@@ -259,6 +259,7 @@ pub fn run(config: Config, testpaths: &TestPaths, revision: Option<&str>) {
259259pub fn compute_stamp_hash ( config : & Config ) -> String {
260260 let mut hash = DefaultHasher :: new ( ) ;
261261 config. stage_id . hash ( & mut hash) ;
262+ config. run . hash ( & mut hash) ;
262263
263264 match config. debugger {
264265 Some ( Debugger :: Cdb ) => {
@@ -317,6 +318,7 @@ enum TestOutput {
317318enum WillExecute {
318319 Yes ,
319320 No ,
321+ Disabled ,
320322}
321323
322324/// Should `--emit metadata` be used?
@@ -357,14 +359,17 @@ impl<'test> TestCx<'test> {
357359 }
358360
359361 fn should_run ( & self , pm : Option < PassMode > ) -> WillExecute {
360- match self . config . mode {
361- Ui if pm == Some ( PassMode :: Run ) || self . props . fail_mode == Some ( FailMode :: Run ) => {
362- WillExecute :: Yes
363- }
364- MirOpt if pm == Some ( PassMode :: Run ) => WillExecute :: Yes ,
365- Ui | MirOpt => WillExecute :: No ,
362+ let test_should_run = match self . config . mode {
363+ Ui if pm == Some ( PassMode :: Run ) || self . props . fail_mode == Some ( FailMode :: Run ) => true ,
364+ MirOpt if pm == Some ( PassMode :: Run ) => true ,
365+ Ui | MirOpt => false ,
366366 mode => panic ! ( "unimplemented for mode {:?}" , mode) ,
367- }
367+ } ;
368+ if test_should_run { self . run_if_enabled ( ) } else { WillExecute :: No }
369+ }
370+
371+ fn run_if_enabled ( & self ) -> WillExecute {
372+ if self . config . run_enabled ( ) { WillExecute :: Yes } else { WillExecute :: Disabled }
368373 }
369374
370375 fn should_run_successfully ( & self , pm : Option < PassMode > ) -> bool {
@@ -439,12 +444,17 @@ impl<'test> TestCx<'test> {
439444
440445 fn run_rfail_test ( & self ) {
441446 let pm = self . pass_mode ( ) ;
442- let proc_res = self . compile_test ( WillExecute :: Yes , self . should_emit_metadata ( pm) ) ;
447+ let should_run = self . run_if_enabled ( ) ;
448+ let proc_res = self . compile_test ( should_run, self . should_emit_metadata ( pm) ) ;
443449
444450 if !proc_res. status . success ( ) {
445451 self . fatal_proc_rec ( "compilation failed!" , & proc_res) ;
446452 }
447453
454+ if let WillExecute :: Disabled = should_run {
455+ return ;
456+ }
457+
448458 let proc_res = self . exec_compiled_test ( ) ;
449459
450460 // The value our Makefile configures valgrind to return on failure
@@ -483,12 +493,17 @@ impl<'test> TestCx<'test> {
483493
484494 fn run_rpass_test ( & self ) {
485495 let emit_metadata = self . should_emit_metadata ( self . pass_mode ( ) ) ;
486- let proc_res = self . compile_test ( WillExecute :: Yes , emit_metadata) ;
496+ let should_run = self . run_if_enabled ( ) ;
497+ let proc_res = self . compile_test ( should_run, emit_metadata) ;
487498
488499 if !proc_res. status . success ( ) {
489500 self . fatal_proc_rec ( "compilation failed!" , & proc_res) ;
490501 }
491502
503+ if let WillExecute :: Disabled = should_run {
504+ return ;
505+ }
506+
492507 // FIXME(#41968): Move this check to tidy?
493508 let expected_errors = errors:: load_errors ( & self . testpaths . file , self . revision ) ;
494509 assert ! (
@@ -510,12 +525,17 @@ impl<'test> TestCx<'test> {
510525 return self . run_rpass_test ( ) ;
511526 }
512527
513- let mut proc_res = self . compile_test ( WillExecute :: Yes , EmitMetadata :: No ) ;
528+ let should_run = self . run_if_enabled ( ) ;
529+ let mut proc_res = self . compile_test ( should_run, EmitMetadata :: No ) ;
514530
515531 if !proc_res. status . success ( ) {
516532 self . fatal_proc_rec ( "compilation failed!" , & proc_res) ;
517533 }
518534
535+ if let WillExecute :: Disabled = should_run {
536+ return ;
537+ }
538+
519539 let mut new_config = self . config . clone ( ) ;
520540 new_config. runtool = new_config. valgrind_path . clone ( ) ;
521541 let new_cx = TestCx { config : & new_config, ..* self } ;
@@ -732,10 +752,14 @@ impl<'test> TestCx<'test> {
732752
733753 fn run_debuginfo_cdb_test_no_opt ( & self ) {
734754 // compile test file (it should have 'compile-flags:-g' in the header)
735- let compile_result = self . compile_test ( WillExecute :: Yes , EmitMetadata :: No ) ;
755+ let should_run = self . run_if_enabled ( ) ;
756+ let compile_result = self . compile_test ( should_run, EmitMetadata :: No ) ;
736757 if !compile_result. status . success ( ) {
737758 self . fatal_proc_rec ( "compilation failed!" , & compile_result) ;
738759 }
760+ if let WillExecute :: Disabled = should_run {
761+ return ;
762+ }
739763
740764 let exe_file = self . make_exe_name ( ) ;
741765
@@ -826,10 +850,14 @@ impl<'test> TestCx<'test> {
826850 let mut cmds = commands. join ( "\n " ) ;
827851
828852 // compile test file (it should have 'compile-flags:-g' in the header)
829- let compiler_run_result = self . compile_test ( WillExecute :: Yes , EmitMetadata :: No ) ;
853+ let should_run = self . run_if_enabled ( ) ;
854+ let compiler_run_result = self . compile_test ( should_run, EmitMetadata :: No ) ;
830855 if !compiler_run_result. status . success ( ) {
831856 self . fatal_proc_rec ( "compilation failed!" , & compiler_run_result) ;
832857 }
858+ if let WillExecute :: Disabled = should_run {
859+ return ;
860+ }
833861
834862 let exe_file = self . make_exe_name ( ) ;
835863
@@ -1044,10 +1072,14 @@ impl<'test> TestCx<'test> {
10441072
10451073 fn run_debuginfo_lldb_test_no_opt ( & self ) {
10461074 // compile test file (it should have 'compile-flags:-g' in the header)
1047- let compile_result = self . compile_test ( WillExecute :: Yes , EmitMetadata :: No ) ;
1075+ let should_run = self . run_if_enabled ( ) ;
1076+ let compile_result = self . compile_test ( should_run, EmitMetadata :: No ) ;
10481077 if !compile_result. status . success ( ) {
10491078 self . fatal_proc_rec ( "compilation failed!" , & compile_result) ;
10501079 }
1080+ if let WillExecute :: Disabled = should_run {
1081+ return ;
1082+ }
10511083
10521084 let exe_file = self . make_exe_name ( ) ;
10531085
@@ -1531,7 +1563,9 @@ impl<'test> TestCx<'test> {
15311563 // Only use `make_exe_name` when the test ends up being executed.
15321564 let output_file = match will_execute {
15331565 WillExecute :: Yes => TargetLocation :: ThisFile ( self . make_exe_name ( ) ) ,
1534- WillExecute :: No => TargetLocation :: ThisDirectory ( self . output_base_dir ( ) ) ,
1566+ WillExecute :: No | WillExecute :: Disabled => {
1567+ TargetLocation :: ThisDirectory ( self . output_base_dir ( ) )
1568+ }
15351569 } ;
15361570
15371571 let allow_unused = match self . config . mode {
0 commit comments