Commit 52d95486 authored by Martin Cejp's avatar Martin Cejp
Browse files

Display specific failing cocotb testcases

parent 411be651
Pipeline #567493728 passed with stages
in 4 minutes and 46 seconds
......@@ -93,7 +93,7 @@ reports:
image: python:3.10
script:
- pip install "psycopg>=3"
- pip install junitparser "psycopg>=3"
- ./tools/ci/save_build_stats.py
......
......@@ -79,7 +79,13 @@ td.success { background-color: rgb(25, 135, 84); color: #fff; font-weight: 600 }
{% if build.sim.result == "pass" %}
<td style="text-align: center" class="success">PASS</td>
{% elif build.sim.result == "fail" %}
<td style="text-align: center" class="error">FAIL</td>
<td style="text-align: center" class="error">
{% if build.sim.failed_testcases | default(None) %}
<abbr title="Failed testcases:&#x0A;{{ build.sim.failed_testcases | join("\n") }}">FAIL</abbr>
{% else %}
FAIL
{% endif %}
</td>
{% else %}
<td style="text-align: center">?</td>
{% endif %}
......
......@@ -17,6 +17,7 @@ import json
import logging
import os
from junitparser import JUnitXml
import psycopg
......@@ -30,17 +31,27 @@ results["commit_title"] = os.environ["CI_COMMIT_TITLE"]
# Results of simulation
try:
with open("results.xml", "rt") as f:
xml = f.read()
if os.path.exists("results.xml"): # ugh. fromfile() raises generic OSError
# instead of FileNotFoundError
xml = JUnitXml.fromfile("results.xml")
failures = []
for suite in xml:
for case in suite:
if any(r._tag == "failure" for r in case.result):
logger.info("%s:%s FAIL", case.classname, case.name)
failures.append(case.classname + ":" + case.name)
else:
logger.info("%s:%s PASS", case.classname, case.name)
if "<failure" not in xml:
if len(failures) > 0:
logger.info("cocotb FAIL")
results["sim"] = dict(result="fail", failed_testcases=failures)
else:
logger.info("cocotb PASS")
results["sim"] = dict(result="pass")
else:
logger.info("cocotb FAIL")
results["sim"] = dict(result="fail")
except FileNotFoundError:
else:
logger.error("results.xml not found")
results["sim"] = dict(result=None)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment