From 44f5a5d5d4d29f7db8df8ed3193f43046829e7ff 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 970e6b2717e..414f89f207a 100755 --- a/scripts/pylib/twister/twisterlib/handlers.py +++ b/scripts/pylib/twister/twisterlib/handlers.py @@ -882,6 +882,9 @@ class QEMUHandler(Handler): 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: