regrtest: log timeout at startup (GH-19514) · python/cpython@4cf65a6

2 files changed

lines changed

Original file line numberDiff line numberDiff line change

@@ -394,7 +394,10 @@ def run_tests_sequential(self):

394394
395395

save_modules = sys.modules.keys()

396396
397-

self.log("Run tests sequentially")

397+

msg = "Run tests sequentially"

398+

if self.ns.timeout:

399+

msg += " (timeout: %s)" % format_duration(self.ns.timeout)

400+

self.log(msg)

398401
399402

previous_test = None

400403

for test_index, test_name in enumerate(self.tests, 1):

Original file line numberDiff line numberDiff line change

@@ -352,16 +352,24 @@ def __init__(self, regrtest):

352352

self.output = queue.Queue()

353353

self.pending = MultiprocessIterator(self.regrtest.tests)

354354

if self.ns.timeout is not None:

355-

self.worker_timeout = self.ns.timeout * 1.5

355+

# Rely on faulthandler to kill a worker process. This timouet is

356+

# when faulthandler fails to kill a worker process. Give a maximum

357+

# of 5 minutes to faulthandler to kill the worker.

358+

self.worker_timeout = min(self.ns.timeout * 1.5,

359+

self.ns.timeout + 5 * 60)

356360

else:

357361

self.worker_timeout = None

358362

self.workers = None

359363
360364

def start_workers(self):

361365

self.workers = [TestWorkerProcess(index, self)

362366

for index in range(1, self.ns.use_mp + 1)]

363-

self.log("Run tests in parallel using %s child processes"

364-

% len(self.workers))

367+

msg = f"Run tests in parallel using {len(self.workers)} child processes"

368+

if self.ns.timeout:

369+

msg += (" (timeout: %s, worker timeout: %s)"

370+

% (format_duration(self.ns.timeout),

371+

format_duration(self.worker_timeout)))

372+

self.log(msg)

365373

for worker in self.workers:

366374

worker.start()

367375