From 7702c44288240eac50577177f574673aa4326cfd Mon Sep 17 00:00:00 2001 From: Luke Wren Date: Mon, 20 Mar 2023 01:32:16 +0000 Subject: [PATCH] Handle timeout in runtests --- test/sim/sw_testcases/runtests | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/test/sim/sw_testcases/runtests b/test/sim/sw_testcases/runtests index 564cd86..4d17f44 100755 --- a/test/sim/sw_testcases/runtests +++ b/test/sim/sw_testcases/runtests @@ -50,14 +50,19 @@ for test in testlist: if generate_vcd: cmdline += ["--vcd", f"tmp/{test}.vcd"] - test_run_ret = subprocess.run( - cmdline, - stdout = subprocess.PIPE, - stderr = subprocess.PIPE, - timeout=10 - ) - with open(f"tmp/{test}.log", "wb") as f: - f.write(test_run_ret.stdout) + try: + test_run_ret = subprocess.run( + cmdline, + stdout = subprocess.PIPE, + stderr = subprocess.PIPE, + timeout=10 + ) + with open(f"tmp/{test}.log", "wb") as f: + f.write(test_run_ret.stdout) + except subprocess.TimeoutExpired: + print("\033[31m[TIMOUT]\033[39m") + all_passed = False + continue # Testbench itself should always exit successfully. if test_run_ret.returncode != 0: