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 <jason.pike@windriver.com>
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user