From cf5c7abd0127c3a50b2def490a06d60106046422 Mon Sep 17 00:00:00 2001 From: Renato Alves Date: Thu, 16 Oct 2014 16:47:10 +0100 Subject: [PATCH] Unittest - Workaround race condition when killing slow processes * In some cases the process finishes normally very close to the timeout --- test/basetest/utils.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/test/basetest/utils.py b/test/basetest/utils.py index eb6b1c8bc..21fb4e653 100644 --- a/test/basetest/utils.py +++ b/test/basetest/utils.py @@ -88,7 +88,12 @@ def _get_output(proc, input): # If it does take longer than 1 second, abort it if exit is None: - proc.send_signal(signal.SIGABRT) + try: + proc.send_signal(signal.SIGABRT) + except OSError as e: + # 3 means the process finished/died between last check and now + if e.errno != 3: + raise exit = wait_process(proc) # NOTE Increase this value if tests fail with None being received as