summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2020-04-14 16:29:44 (GMT)
committerGitHub <noreply@github.com>2020-04-14 16:29:44 (GMT)
commit4cf65a630a8d45bad3fe5cdc4c2632ec64e7ba27 (patch)
tree1ce736c5729eb79c8c94ef6b19bb5bc664879dca
parent62f75fe3dd138f72303814d27183aa469eefcca6 (diff)
downloadcpython-4cf65a630a8d45bad3fe5cdc4c2632ec64e7ba27.zip
cpython-4cf65a630a8d45bad3fe5cdc4c2632ec64e7ba27.tar.gz
cpython-4cf65a630a8d45bad3fe5cdc4c2632ec64e7ba27.tar.bz2
regrtest: log timeout at startup (GH-19514)
Reduce also worker timeout.
-rw-r--r--Lib/test/libregrtest/main.py5
-rw-r--r--Lib/test/libregrtest/runtest_mp.py14
2 files changed, 15 insertions, 4 deletions
diff --git a/Lib/test/libregrtest/main.py b/Lib/test/libregrtest/main.py
index 1de51b7..95b4856 100644
--- a/Lib/test/libregrtest/main.py
+++ b/Lib/test/libregrtest/main.py
@@ -394,7 +394,10 @@ class Regrtest:
save_modules = sys.modules.keys()
- self.log("Run tests sequentially")
+ msg = "Run tests sequentially"
+ if self.ns.timeout:
+ msg += " (timeout: %s)" % format_duration(self.ns.timeout)
+ self.log(msg)
previous_test = None
for test_index, test_name in enumerate(self.tests, 1):
diff --git a/Lib/test/libregrtest/runtest_mp.py b/Lib/test/libregrtest/runtest_mp.py
index fc12ea7..7a18e45 100644
--- a/Lib/test/libregrtest/runtest_mp.py
+++ b/Lib/test/libregrtest/runtest_mp.py
@@ -352,7 +352,11 @@ class MultiprocessTestRunner:
self.output = queue.Queue()
self.pending = MultiprocessIterator(self.regrtest.tests)
if self.ns.timeout is not None:
- self.worker_timeout = self.ns.timeout * 1.5
+ # Rely on faulthandler to kill a worker process. This timouet is
+ # when faulthandler fails to kill a worker process. Give a maximum
+ # of 5 minutes to faulthandler to kill the worker.
+ self.worker_timeout = min(self.ns.timeout * 1.5,
+ self.ns.timeout + 5 * 60)
else:
self.worker_timeout = None
self.workers = None
@@ -360,8 +364,12 @@ class MultiprocessTestRunner:
def start_workers(self):
self.workers = [TestWorkerProcess(index, self)
for index in range(1, self.ns.use_mp + 1)]
- self.log("Run tests in parallel using %s child processes"
- % len(self.workers))
+ msg = f"Run tests in parallel using {len(self.workers)} child processes"
+ if self.ns.timeout:
+ msg += (" (timeout: %s, worker timeout: %s)"
+ % (format_duration(self.ns.timeout),
+ format_duration(self.worker_timeout)))
+ self.log(msg)
for worker in self.workers:
worker.start()