[dv] Handle missing paths when producing regression log

It's possible for a TestRunResult to contain an entry that has a path to
a build/run artifact but for that to be None rather than an actual path.
This causes the collect_results.py script to fail.

With this change such paths will be described as 'MISSING' in the
regression log instead.
This commit is contained in:
Greg Chadwick 2024-02-01 16:25:54 +00:00
parent 63fa98537e
commit 15945049b2

View file

@ -38,10 +38,12 @@ def gen_test_run_result_text(trr: TestRunResult) -> str:
test_underline = '-' * len(test_name_idx)
info_lines: List[str] = [test_name_idx, test_underline]
# Filter out relevant fields, and print as relative to the dir_test for readability
lesskeys = {k: str(v.relative_to(trr.dir_test)) # Improve readability
for k, v in dataclasses.asdict(trr).items()
if k in ['binary', 'rtl_log', 'rtl_trace', 'iss_cosim_trace']}
# Filter out relevant fields, and print as relative to the dir_test for
# readability.
lesskeys = \
{k: str(v.relative_to(trr.dir_test) if v is not None else 'MISSING')
for k, v in dataclasses.asdict(trr).items()
if k in ['binary', 'rtl_log', 'rtl_trace', 'iss_cosim_trace']}
strdict = ibex_lib.format_dict_to_printable_dict(lesskeys)
trr_yaml = io.StringIO()