From 6c919f4871887294b36784941274a4e44b30920b Mon Sep 17 00:00:00 2001 From: jpike Date: Fri, 19 Sep 2025 14:07:01 -0400 Subject: [PATCH] Fix for hanging test execution If exit does not occur with 10 seconds of the last line executing, the main thread will get killed. Change-Id: I799a418b07e01b228c539b81ca4a8f334d71e002 Signed-off-by: jpike --- framework/runner/scripts/test_executor.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/framework/runner/scripts/test_executor.py b/framework/runner/scripts/test_executor.py index 5501a995..89d0bfb3 100644 --- a/framework/runner/scripts/test_executor.py +++ b/framework/runner/scripts/test_executor.py @@ -1,3 +1,6 @@ +import os +import threading +import time from optparse import OptionParser from typing import Optional @@ -117,6 +120,15 @@ def main(): log_summary(test_executor_summary) + # Force exit after 10 seconds if process doesn't terminate naturally + def force_exit_timer(): + time.sleep(10) + get_logger().log_warning("Process did not exit naturally, forcing exit...") + os._exit(0) + + timer_thread = threading.Thread(target=force_exit_timer, daemon=True) + timer_thread.start() + return 0