@@ -259,6 +259,7 @@ pub fn run(config: Config, testpaths: &TestPaths, revision: Option<&str>) {
259
259
pub fn compute_stamp_hash ( config : & Config ) -> String {
260
260
let mut hash = DefaultHasher :: new ( ) ;
261
261
config. stage_id . hash ( & mut hash) ;
262
+ config. run . hash ( & mut hash) ;
262
263
263
264
match config. debugger {
264
265
Some ( Debugger :: Cdb ) => {
@@ -317,6 +318,7 @@ enum TestOutput {
317
318
enum WillExecute {
318
319
Yes ,
319
320
No ,
321
+ Disabled ,
320
322
}
321
323
322
324
/// Should `--emit metadata` be used?
@@ -357,14 +359,17 @@ impl<'test> TestCx<'test> {
357
359
}
358
360
359
361
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 ,
366
366
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 }
368
373
}
369
374
370
375
fn should_run_successfully ( & self , pm : Option < PassMode > ) -> bool {
@@ -439,12 +444,17 @@ impl<'test> TestCx<'test> {
439
444
440
445
fn run_rfail_test ( & self ) {
441
446
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) ) ;
443
449
444
450
if !proc_res. status . success ( ) {
445
451
self . fatal_proc_rec ( "compilation failed!" , & proc_res) ;
446
452
}
447
453
454
+ if let WillExecute :: Disabled = should_run {
455
+ return ;
456
+ }
457
+
448
458
let proc_res = self . exec_compiled_test ( ) ;
449
459
450
460
// The value our Makefile configures valgrind to return on failure
@@ -483,12 +493,17 @@ impl<'test> TestCx<'test> {
483
493
484
494
fn run_rpass_test ( & self ) {
485
495
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) ;
487
498
488
499
if !proc_res. status . success ( ) {
489
500
self . fatal_proc_rec ( "compilation failed!" , & proc_res) ;
490
501
}
491
502
503
+ if let WillExecute :: Disabled = should_run {
504
+ return ;
505
+ }
506
+
492
507
// FIXME(#41968): Move this check to tidy?
493
508
let expected_errors = errors:: load_errors ( & self . testpaths . file , self . revision ) ;
494
509
assert ! (
@@ -510,12 +525,17 @@ impl<'test> TestCx<'test> {
510
525
return self . run_rpass_test ( ) ;
511
526
}
512
527
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 ) ;
514
530
515
531
if !proc_res. status . success ( ) {
516
532
self . fatal_proc_rec ( "compilation failed!" , & proc_res) ;
517
533
}
518
534
535
+ if let WillExecute :: Disabled = should_run {
536
+ return ;
537
+ }
538
+
519
539
let mut new_config = self . config . clone ( ) ;
520
540
new_config. runtool = new_config. valgrind_path . clone ( ) ;
521
541
let new_cx = TestCx { config : & new_config, ..* self } ;
@@ -732,10 +752,14 @@ impl<'test> TestCx<'test> {
732
752
733
753
fn run_debuginfo_cdb_test_no_opt ( & self ) {
734
754
// 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 ) ;
736
757
if !compile_result. status . success ( ) {
737
758
self . fatal_proc_rec ( "compilation failed!" , & compile_result) ;
738
759
}
760
+ if let WillExecute :: Disabled = should_run {
761
+ return ;
762
+ }
739
763
740
764
let exe_file = self . make_exe_name ( ) ;
741
765
@@ -826,10 +850,14 @@ impl<'test> TestCx<'test> {
826
850
let mut cmds = commands. join ( "\n " ) ;
827
851
828
852
// 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 ) ;
830
855
if !compiler_run_result. status . success ( ) {
831
856
self . fatal_proc_rec ( "compilation failed!" , & compiler_run_result) ;
832
857
}
858
+ if let WillExecute :: Disabled = should_run {
859
+ return ;
860
+ }
833
861
834
862
let exe_file = self . make_exe_name ( ) ;
835
863
@@ -1044,10 +1072,14 @@ impl<'test> TestCx<'test> {
1044
1072
1045
1073
fn run_debuginfo_lldb_test_no_opt ( & self ) {
1046
1074
// 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 ) ;
1048
1077
if !compile_result. status . success ( ) {
1049
1078
self . fatal_proc_rec ( "compilation failed!" , & compile_result) ;
1050
1079
}
1080
+ if let WillExecute :: Disabled = should_run {
1081
+ return ;
1082
+ }
1051
1083
1052
1084
let exe_file = self . make_exe_name ( ) ;
1053
1085
@@ -1531,7 +1563,9 @@ impl<'test> TestCx<'test> {
1531
1563
// Only use `make_exe_name` when the test ends up being executed.
1532
1564
let output_file = match will_execute {
1533
1565
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
+ }
1535
1569
} ;
1536
1570
1537
1571
let allow_unused = match self . config . mode {
0 commit comments