@@ -317,6 +317,7 @@ enum TestOutput {
317317enum WillExecute {
318318 Yes ,
319319 No ,
320+ Disabled ,
320321}
321322
322323/// Should `--emit metadata` be used?
@@ -357,13 +358,22 @@ impl<'test> TestCx<'test> {
357358 }
358359
359360 fn should_run ( & self , pm : Option < PassMode > ) -> WillExecute {
360- match self . config . mode {
361+ let test_should_run = match self . config . mode {
361362 Ui if pm == Some ( PassMode :: Run ) || self . props . fail_mode == Some ( FailMode :: Run ) => {
362- WillExecute :: Yes
363+ true
363364 }
364- MirOpt if pm == Some ( PassMode :: Run ) => WillExecute :: Yes ,
365- Ui | MirOpt => WillExecute :: No ,
365+ MirOpt if pm == Some ( PassMode :: Run ) => true ,
366+ Ui | MirOpt => false ,
366367 mode => panic ! ( "unimplemented for mode {:?}" , mode) ,
368+ } ;
369+ let enabled = self . config . run . unwrap_or_else ( || {
370+ // Auto-detect whether to run based on the platform.
371+ !self . config . target . ends_with ( "-fuchsia" )
372+ } ) ;
373+ match ( test_should_run, enabled) {
374+ ( false , _) => WillExecute :: No ,
375+ ( true , true ) => WillExecute :: Yes ,
376+ ( true , false ) => WillExecute :: Disabled ,
367377 }
368378 }
369379
@@ -1531,7 +1541,8 @@ impl<'test> TestCx<'test> {
15311541 // Only use `make_exe_name` when the test ends up being executed.
15321542 let output_file = match will_execute {
15331543 WillExecute :: Yes => TargetLocation :: ThisFile ( self . make_exe_name ( ) ) ,
1534- WillExecute :: No => TargetLocation :: ThisDirectory ( self . output_base_dir ( ) ) ,
1544+ WillExecute :: No | WillExecute :: Disabled =>
1545+ TargetLocation :: ThisDirectory ( self . output_base_dir ( ) ) ,
15351546 } ;
15361547
15371548 let allow_unused = match self . config . mode {
0 commit comments