fpga: tools: Fix CSV reporting in run_testbenches.py
Original-commit: 1c719bc0a6ff8ceba7da74ee42bcceb43d164d2b
This commit is contained in:
committed by
Jörg Hofrichter
parent
7566014c96
commit
ef9b86ec03
@@ -434,31 +434,35 @@ def do_cleanup(args):
|
|||||||
|
|
||||||
def do_report_csv(args, results):
|
def do_report_csv(args, results):
|
||||||
"""Generate report file (.csv)"""
|
"""Generate report file (.csv)"""
|
||||||
keys = [
|
template = {
|
||||||
"module",
|
"module": "<unknown>",
|
||||||
"status",
|
"status": "NOT_RUN",
|
||||||
"retcode",
|
"retcode": "<unknown>",
|
||||||
"start_time",
|
"start_time": "<unknown>",
|
||||||
"wall_time",
|
"wall_time": "<unknown>",
|
||||||
"sim_time_ns",
|
"sim_time_ns": 0,
|
||||||
"tc_expected",
|
"tc_expected": 0,
|
||||||
"tc_run",
|
"tc_run": 0,
|
||||||
"tc_passed",
|
"tc_passed": 0,
|
||||||
]
|
}
|
||||||
with open(args.report, "w") as repfile:
|
with open(args.report, "w") as repfile:
|
||||||
repfile.write((",".join([x.upper() for x in keys])) + "\n")
|
repfile.write((",".join([x.upper() for x in template.keys()])) + "\n")
|
||||||
for name in sorted(results):
|
for name in sorted(results):
|
||||||
r = results[name]
|
line = template.copy()
|
||||||
if r["retcode"] != RETCODE_SUCCESS:
|
result = results[name]
|
||||||
results["retcode"] = retcode_to_str(r["retcode"])
|
if result["retcode"] != RETCODE_SUCCESS:
|
||||||
results["status"] = "ERROR"
|
line["module"] = str(name)
|
||||||
results["start_time"] = r["start_time"]
|
line["retcode"] = retcode_to_str(result["retcode"])
|
||||||
|
line["status"] = "ERROR"
|
||||||
|
line["start_time"] = result["start_time"]
|
||||||
else:
|
else:
|
||||||
results = r
|
line = result
|
||||||
results["module"] = name
|
line["module"] = name
|
||||||
results["status"] = "PASSED" if r["passed"] else "FAILED"
|
line["status"] = "PASSED" if result["passed"] else "FAILED"
|
||||||
results["retcode"] = retcode_to_str(r["retcode"])
|
line["retcode"] = retcode_to_str(result["retcode"])
|
||||||
repfile.write((",".join([str(results[x]) for x in keys])) + "\n")
|
repfile.write(
|
||||||
|
(",".join([str(line[x]).replace(",", " ") for x in template.keys()])) + "\n"
|
||||||
|
)
|
||||||
_LOG.info("Testbench report (CSV format) written to " + args.report)
|
_LOG.info("Testbench report (CSV format) written to " + args.report)
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
@@ -486,7 +490,7 @@ def do_report_junit(args, results):
|
|||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
|
||||||
def do_report(args, results):
|
def do_report(args, results=None):
|
||||||
"""Generate report file (either .csv or .xml)"""
|
"""Generate report file (either .csv or .xml)"""
|
||||||
|
|
||||||
def _load_results(args):
|
def _load_results(args):
|
||||||
|
|||||||
Reference in New Issue
Block a user