ci: Include stderr output in JUnit XML report

When running tests under valgrind, the valgrind summary is printed in
stderr, and the TAP output is printed in stdout. The valgrind summary is
useful to include in the GitLab test report, so append it to the
textual failure information for failed tests.

I can’t find a better XML element in the [JUnit
schema](https://github.com/windyroad/JUnit-Schema/blob/master/JUnit.xsd)
for representing it.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

Helps: #487
This commit is contained in:
Philip Withnall 2019-08-22 11:25:49 +03:00
parent 197eff3fc8
commit 0cc745f6cb

View File

@ -52,6 +52,7 @@ for line in args.infile:
duration = data['duration']
return_code = data['returncode']
log = data['stdout']
log_stderr = data.get('stderr', '')
unit = {
'suite': suite_name,
@ -59,6 +60,7 @@ for line in args.infile:
'duration': duration,
'returncode': return_code,
'stdout': log,
'stderr': log_stderr,
}
units = suites.setdefault(suite_name, [])
@ -103,7 +105,7 @@ for name, units in suites.items():
failure.set('classname', '{}/{}'.format(args.project_name, unit['suite']))
failure.set('name', unit['name'])
failure.set('type', 'error')
failure.text = unit['stdout']
failure.text = unit['stdout'] + '\n' + unit['stderr']
output = ET.tostring(testsuites, encoding='unicode')
outfile.write(output)