2022 cuser, csys, real, start, end = tdata[1:6] |
2022 cuser, csys, real, start, end = tdata[1:6] |
2023 self.stream.writeln(cols % (start, end, cuser, csys, real, test)) |
2023 self.stream.writeln(cols % (start, end, cuser, csys, real, test)) |
2024 |
2024 |
2025 @staticmethod |
2025 @staticmethod |
2026 def _writexunit(result, outf): |
2026 def _writexunit(result, outf): |
|
2027 # See http://llg.cubic.org/docs/junit/ for a reference. |
2027 timesd = dict((t[0], t[3]) for t in result.times) |
2028 timesd = dict((t[0], t[3]) for t in result.times) |
2028 doc = minidom.Document() |
2029 doc = minidom.Document() |
2029 s = doc.createElement('testsuite') |
2030 s = doc.createElement('testsuite') |
2030 s.setAttribute('name', 'run-tests') |
2031 s.setAttribute('name', 'run-tests') |
2031 s.setAttribute('tests', str(result.testsRun)) |
2032 s.setAttribute('tests', str(result.testsRun)) |
2050 # createCDATASection expects a unicode or it will |
2051 # createCDATASection expects a unicode or it will |
2051 # convert using default conversion rules, which will |
2052 # convert using default conversion rules, which will |
2052 # fail if string isn't ASCII. |
2053 # fail if string isn't ASCII. |
2053 err = cdatasafe(err).decode('utf-8', 'replace') |
2054 err = cdatasafe(err).decode('utf-8', 'replace') |
2054 cd = doc.createCDATASection(err) |
2055 cd = doc.createCDATASection(err) |
2055 t.appendChild(cd) |
2056 # Use 'failure' here instead of 'error' to match errors = 0, |
|
2057 # failures = len(result.failures) in the testsuite element. |
|
2058 failelem = doc.createElement('failure') |
|
2059 failelem.setAttribute('message', 'output changed') |
|
2060 failelem.setAttribute('type', 'output-mismatch') |
|
2061 failelem.appendChild(cd) |
|
2062 t.appendChild(failelem) |
2056 s.appendChild(t) |
2063 s.appendChild(t) |
2057 outf.write(doc.toprettyxml(indent=' ', encoding='utf-8')) |
2064 outf.write(doc.toprettyxml(indent=' ', encoding='utf-8')) |
2058 |
2065 |
2059 @staticmethod |
2066 @staticmethod |
2060 def _writejson(result, outf): |
2067 def _writejson(result, outf): |