@@ -688,23 +688,8 @@ fn run(cli: Cli) -> ExitCode {
688688
689689 let mut properties = reconcile ( subtest, preset) ;
690690
691- // "Taint timeouts by suspicion": Ensure that _both_ `TIMEOUT` and `NOTRUN`
692- // are in new expected outcomes if at least one of them are present.
693- for ( _, outcome) in properties. expectations . as_mut ( ) . unwrap ( ) . iter_mut ( ) {
694- if !outcome
695- . is_disjoint ( SubtestOutcome :: Timeout | SubtestOutcome :: NotRun )
696- {
697- static PRINTED_WARNING : AtomicBool = AtomicBool :: new ( false ) ;
698- let already_printed_warning =
699- PRINTED_WARNING . swap ( true , atomic:: Ordering :: Relaxed ) ;
700- if !already_printed_warning {
701- log:: info!( concat!(
702- "encountered at least one case where " ,
703- "taint-by-suspicion is being applied…"
704- ) )
705- }
706- * outcome |= SubtestOutcome :: Timeout | SubtestOutcome :: NotRun ;
707- }
691+ for ( _, expected) in properties. expectations . as_mut ( ) . unwrap ( ) . iter_mut ( ) {
692+ taint_subtest_timeouts_by_suspicion ( expected) ;
708693 }
709694
710695 subtests. insert ( subtest_name, Subtest { properties } ) ;
@@ -804,12 +789,24 @@ fn run(cli: Cli) -> ExitCode {
804789 fmt_err_found = true ;
805790 render_metadata_parse_errors ( & path, & file_contents, errors) ;
806791 }
807- Ok ( file) => match write_to_file ( & path, metadata:: format_file ( & file) ) {
808- Ok ( ( ) ) => ( ) ,
809- Err ( AlreadyReportedToCommandline ) => {
810- fmt_err_found = true ;
792+ Ok ( mut file) => {
793+ for test in file. tests . values_mut ( ) {
794+ for subtest in & mut test. subtests . values_mut ( ) {
795+ if let Some ( expected) = subtest. properties . expectations . as_mut ( ) {
796+ for ( _, expected) in expected. iter_mut ( ) {
797+ taint_subtest_timeouts_by_suspicion ( expected) ;
798+ }
799+ }
800+ }
811801 }
812- } ,
802+
803+ match write_to_file ( & path, metadata:: format_file ( & file) ) {
804+ Ok ( ( ) ) => ( ) ,
805+ Err ( AlreadyReportedToCommandline ) => {
806+ fmt_err_found = true ;
807+ }
808+ } ;
809+ }
813810 }
814811 }
815812
@@ -1558,3 +1555,21 @@ fn write_to_file(path: &Path, contents: impl Display) -> Result<(), AlreadyRepor
15581555 . wrap_err_with ( || format ! ( "error while writing to `{}`" , path. display( ) ) )
15591556 . map_err ( report_to_cmd_line)
15601557}
1558+
1559+ /// Ensure that _both_ `TIMEOUT` and `NOTRUN` are in outcomes if at least one of them are present.
1560+ ///
1561+ /// This transformation is desirable for reaching convergence quickly in tests where it may require
1562+ /// a high number of test runs to empirically observe all places where `TIMEOUT`s may occur. The
1563+ /// motivating example in Firefox's test runs are tests with a large matrix of subtests that are
1564+ /// deterministic if executed, but consistently exceed the timeout window offered by the test
1565+ /// runner.
1566+ fn taint_subtest_timeouts_by_suspicion ( expected : & mut Expectation < SubtestOutcome > ) {
1567+ static PRINTED_WARNING : AtomicBool = AtomicBool :: new ( false ) ;
1568+ let already_printed_warning = PRINTED_WARNING . swap ( true , atomic:: Ordering :: Relaxed ) ;
1569+ if !already_printed_warning {
1570+ log:: info!( "encountered at least one case where taint-by-suspicion is being applied…" )
1571+ }
1572+ if !expected. is_disjoint ( SubtestOutcome :: Timeout | SubtestOutcome :: NotRun ) {
1573+ * expected |= SubtestOutcome :: Timeout | SubtestOutcome :: NotRun ;
1574+ }
1575+ }
0 commit comments