|
20 | 20 |
|
21 | 21 | # Display the running tests if nothing happened last N seconds |
22 | 22 | PROGRESS_UPDATE = 30.0 # seconds |
| 23 | +assert PROGRESS_UPDATE >= PROGRESS_MIN_TIME |
23 | 24 |
|
24 | 25 | # Time to wait until a worker completes: should be immediate |
25 | 26 | JOIN_TIMEOUT = 30.0 # seconds |
@@ -305,10 +306,8 @@ def __init__(self, regrtest): |
305 | 306 | self.pending = MultiprocessIterator(self.regrtest.tests) |
306 | 307 | if self.ns.timeout is not None: |
307 | 308 | self.worker_timeout = self.ns.timeout * 1.5 |
308 | | - self.main_timeout = self.ns.timeout * 2.0 |
309 | 309 | else: |
310 | 310 | self.worker_timeout = None |
311 | | - self.main_timeout = None |
312 | 311 | self.workers = None |
313 | 312 |
|
314 | 313 | def start_workers(self): |
@@ -345,12 +344,13 @@ def _get_result(self): |
345 | 344 | except queue.Empty: |
346 | 345 | return None |
347 | 346 |
|
| 347 | + use_faulthandler = (self.ns.timeout is not None) |
| 348 | + timeout = PROGRESS_UPDATE |
348 | 349 | while True: |
349 | | - if self.main_timeout is not None: |
350 | | - faulthandler.dump_traceback_later(self.main_timeout, exit=True) |
| 350 | + if use_faulthandler: |
| 351 | + faulthandler.dump_traceback_later(timeout * 2.0, exit=True) |
351 | 352 |
|
352 | 353 | # wait for a thread |
353 | | - timeout = max(PROGRESS_UPDATE, PROGRESS_MIN_TIME) |
354 | 354 | try: |
355 | 355 | return self.output.get(timeout=timeout) |
356 | 356 | except queue.Empty: |
@@ -415,7 +415,7 @@ def run_tests(self): |
415 | 415 | print() |
416 | 416 | self.regrtest.interrupted = True |
417 | 417 | finally: |
418 | | - if self.main_timeout is not None: |
| 418 | + if self.ns.timeout is not None: |
419 | 419 | faulthandler.cancel_dump_traceback_later() |
420 | 420 |
|
421 | 421 | # a test failed (and --failfast is set) or all tests completed |
|
0 commit comments