Handle timeout in runtests

This commit is contained in:
Luke Wren 2023-03-20 01:32:16 +00:00
parent 4aed15540d
commit 7702c44288
1 changed files with 13 additions and 8 deletions

View File

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