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 <jordan@embeint.com>
This commit is contained in:
Jordan Yates 2024-05-11 15:31:46 +10:00 committed by Carles Cufí
commit 44f5a5d5d4

View file

@ -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: