Add mechanism for test-specific timeout

Adding the key 'timeout_s' to the testlist.yaml file for each test
now sets the timeout for all iterations of that test. Value in seconds.

e.g.
Set all iterations of the pmp_full_random test to have a 10s timeout.
```
- test: riscv_pmp_full_random_test
  timeout_s: 10
```
This commit is contained in:
Harry Callahan 2022-10-19 16:08:40 +01:00
parent a44d9827d7
commit 0b2a7c4f4e
3 changed files with 5 additions and 2 deletions

View file

@ -166,7 +166,7 @@ def main() -> int:
passing_tests.append(trr)
else:
if (trr.failure_mode == Failure_Modes.TIMEOUT):
trr.failure_message = f"[FAILURE] Simulation timed-out [{md.run_rtl_timeout_s}s].\n"
trr.failure_message = f"[FAILURE] Simulation timed-out [{trr.timeout_s}s].\n"
failing_tests.append(trr)
except RuntimeError as e:
failing_tests.append(

View file

@ -78,6 +78,8 @@ def _main() -> int:
user_subst_options=subst_vars_dict)
logger.info(sim_cmds)
trr.timeout_s = (testopts.get('timeout_s') if (testopts.get('timeout_s') is not None) else
md.run_rtl_timeout_s)
trr.dir_test.mkdir(exist_ok=True, parents=True)
trr.rtl_cmds = [format_to_cmd(cmd) for cmd in sim_cmds]
trr.rtl_stdout = trr.dir_test / 'rtl_sim_stdstreams.log'
@ -95,7 +97,7 @@ def _main() -> int:
sim_fd.write(f"Running run-rtl command :\n{' '.join(cmd)}\n".encode())
run_one(md.verbose, cmd,
redirect_stdstreams=sim_fd,
timeout_s=md.run_rtl_timeout_s,
timeout_s=trr.timeout_s,
reraise=True) # Allow us to catch timeout exceptions at this level
except subprocess.TimeoutExpired:
trr.failure_mode = Failure_Modes.TIMEOUT

View file

@ -41,6 +41,7 @@ class TestRunResult(scripts_lib.testdata_cls):
# Message describing failure, includes a '[FAILED]: XXXX' line at the end.
failure_mode: Optional[Failure_Modes] = None
failure_message: Optional[str] = None
timeout_s: Optional[int] = None
testdotseed: Optional[str] = None
testname: Optional[str] = None # Name of test