File tree 3 files changed +27
-10
lines changed
3 files changed +27
-10
lines changed Original file line number Diff line number Diff line change @@ -93,7 +93,7 @@ reports:
93
93
image : python:3.10
94
94
95
95
script :
96
- - pip install "psycopg>=3"
96
+ - pip install junitparser "psycopg>=3"
97
97
- ./tools/ci/save_build_stats.py
98
98
99
99
Original file line number Diff line number Diff line change 79
79
{% if build.sim.result == "pass" %}
80
80
< td style ="text-align: center " class ="success "> PASS</ td >
81
81
{% elif build.sim.result == "fail" %}
82
- < td style ="text-align: center " class ="error "> FAIL</ td >
82
+ < td style ="text-align: center " class ="error ">
83
+ {% if build.sim.failed_testcases | default(None) %}
84
+ < abbr title ="Failed testcases:
{{ build.sim.failed_testcases | join( "\n ") }}"> FAIL</ abbr >
85
+ {% else %}
86
+ FAIL
87
+ {% endif %}
88
+ </ td >
83
89
{% else %}
84
90
< td style ="text-align: center "> ?</ td >
85
91
{% endif %}
Original file line number Diff line number Diff line change 17
17
import logging
18
18
import os
19
19
20
+ from junitparser import JUnitXml
20
21
import psycopg
21
22
22
23
30
31
31
32
# Results of simulation
32
33
33
- try :
34
- with open ("results.xml" , "rt" ) as f :
35
- xml = f .read ()
34
+ if os .path .exists ("results.xml" ): # ugh. fromfile() raises generic OSError
35
+ # instead of FileNotFoundError
36
+ xml = JUnitXml .fromfile ("results.xml" )
37
+
38
+ failures = []
39
+
40
+ for suite in xml :
41
+ for case in suite :
42
+ if any (r ._tag == "failure" for r in case .result ):
43
+ logger .info ("%s:%s FAIL" , case .classname , case .name )
44
+ failures .append (case .classname + ":" + case .name )
45
+ else :
46
+ logger .info ("%s:%s PASS" , case .classname , case .name )
36
47
37
- if "<failure" not in xml :
48
+ if len (failures ) > 0 :
49
+ logger .info ("cocotb FAIL" )
50
+ results ["sim" ] = dict (result = "fail" , failed_testcases = failures )
51
+ else :
38
52
logger .info ("cocotb PASS" )
39
53
results ["sim" ] = dict (result = "pass" )
40
- else :
41
- logger .info ("cocotb FAIL" )
42
- results ["sim" ] = dict (result = "fail" )
43
- except FileNotFoundError :
54
+ else :
44
55
logger .error ("results.xml not found" )
45
56
results ["sim" ] = dict (result = None )
46
57
You can’t perform that action at this time.
0 commit comments