@@ -488,11 +488,12 @@ def interrupt_process(process: subprocess.Popen):
488
488
489
489
490
490
class ParallelTestRunner (TestRunner ):
491
- def __init__ (self , * , num_processes , subprocess_args , separate_workers , ** kwargs ):
491
+ def __init__ (self , * , num_processes , subprocess_args , separate_workers , timeout_factor , ** kwargs ):
492
492
super ().__init__ (** kwargs )
493
493
self .num_processes = num_processes
494
494
self .subprocess_args = subprocess_args
495
495
self .separate_workers = separate_workers
496
+ self .timeout_factor = timeout_factor
496
497
self .stop_event = threading .Event ()
497
498
self .crashes = []
498
499
self .default_test_timeout = 600
@@ -741,10 +742,13 @@ def run_in_subprocess_and_watch(self):
741
742
break
742
743
if self .last_started_test_id :
743
744
last_started_test = self .tests_by_id .get (self .last_started_test_id )
744
- timeout = last_started_test .test_file .test_config .per_test_timeout
745
+ timeout = (
746
+ last_started_test .test_file .test_config .per_test_timeout
747
+ or self .runner .default_test_timeout
748
+ )
745
749
else :
746
750
timeout = self .runner .default_test_timeout
747
-
751
+ timeout *= self . runner . timeout_factor
748
752
if time .time () - self .last_started_time >= timeout :
749
753
interrupt_process (self .process )
750
754
timed_out = timeout
@@ -789,6 +793,7 @@ def run_in_subprocess_and_watch(self):
789
793
status = TestStatus .ERROR ,
790
794
param = message ,
791
795
output = output ,
796
+ duration = (time .time () - self .last_started_time ),
792
797
))
793
798
if blame_id is not self .last_started_test_id :
794
799
# If we're here, it means we didn't know exactly which test we were executing, we were
@@ -804,7 +809,7 @@ def run_in_subprocess_and_watch(self):
804
809
del self .remaining_test_ids [0 ]
805
810
self .last_started_test_id = None
806
811
if last_remaining_count == len (self .remaining_test_ids ):
807
- raise RuntimeError ( "Worker is not making progress" )
812
+ log ( f "Worker is not making progress, remaining: { self . remaining_test_ids } " )
808
813
809
814
810
815
def platform_keys_match (items : typing .Iterable [str ]):
@@ -813,9 +818,9 @@ def platform_keys_match(items: typing.Iterable[str]):
813
818
814
819
@dataclass
815
820
class TestFileConfig :
816
- serial : bool = False
817
- partial_splits : bool = False
818
- per_test_timeout : float = 300
821
+ serial : bool | None = None
822
+ partial_splits : bool | None = None
823
+ per_test_timeout : float | None = None
819
824
exclude : bool = False
820
825
821
826
@classmethod
@@ -829,9 +834,9 @@ def from_dict(cls, config: dict):
829
834
830
835
def combine (self , other : 'TestFileConfig' ):
831
836
return TestFileConfig (
832
- serial = self .serial or other .serial ,
833
- partial_splits = self .partial_splits or other .partial_splits ,
834
- per_test_timeout = max (self .per_test_timeout , other .per_test_timeout ),
837
+ serial = ( self .serial if other .serial is None else other . serial ) ,
838
+ partial_splits = ( self .partial_splits if other .partial_splits is None else other . partial_splits ) ,
839
+ per_test_timeout = (self .per_test_timeout if other . per_test_timeout is None else other .per_test_timeout ),
835
840
exclude = self .exclude or other .exclude ,
836
841
)
837
842
@@ -1211,6 +1216,8 @@ def main():
1211
1216
help = "Produce a json report file in format expected by mx_gate.make_test_report" )
1212
1217
parser .add_argument ('--untag-unmatched' , action = 'store_true' ,
1213
1218
help = "Remove tests that were not collected from tags. Useful for pruning removed tests" )
1219
+ parser .add_argument ('--timeout-factor' , type = float , default = 1.0 ,
1220
+ help = "Multiply all timeouts by this number" )
1214
1221
parser .add_argument (
1215
1222
'--subprocess-args' ,
1216
1223
type = shlex .split ,
@@ -1315,6 +1322,7 @@ def main():
1315
1322
num_processes = args .num_processes ,
1316
1323
subprocess_args = args .subprocess_args ,
1317
1324
separate_workers = args .separate_workers ,
1325
+ timeout_factor = args .timeout_factor ,
1318
1326
)
1319
1327
1320
1328
runner .run_tests (tests )
0 commit comments