From 546d2319052e0d3eebc5f42c07fe688e87b599f0 Mon Sep 17 00:00:00 2001 From: Jordan Yates Date: Sat, 11 May 2024 15:31:46 +1000 Subject: [PATCH] scripts: twisterlib: handlers: early QEMU timeout Terminate QEMU earlier if the test finishes and no output data is received for 1 second. This new timeout operates in parallel with the global test timeout. For coverage testing, this can reduce the time spent running individual tests by up to 29 seconds, while still giving the full 30 extra seconds to dump gcov data if needed. Signed-off-by: Jordan Yates --- scripts/pylib/twister/twisterlib/handlers.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/pylib/twister/twisterlib/handlers.py b/scripts/pylib/twister/twisterlib/handlers.py index eaef473af71d74..9a378a567a54b9 100755 --- a/scripts/pylib/twister/twisterlib/handlers.py +++ b/scripts/pylib/twister/twisterlib/handlers.py @@ -879,6 +879,9 @@ def _thread(handler, timeout, outdir, logfile, fifo_fn, pid_fn, while True: this_timeout = int((timeout_time - time.time()) * 1000) + if timeout_extended: + # Quit early after timeout extension if no more data is being received + this_timeout = min(this_timeout, 1000) if this_timeout < 0 or not p.poll(this_timeout): try: if pid and this_timeout > 0: