aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2020-11-25 11:50:22 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2021-01-07 19:20:12 +0100
commit35d3baaa2fab0feb9e66a7603bb1dfa2178f2de4 (patch)
tree7afe5d8cc10a37042591d9367e0442af42f99363
parent723c4c9fefade3a806e8ece73126c8c0e21477b2 (diff)
downloadmeson-35d3baaa2fab0feb9e66a7603bb1dfa2178f2de4.zip
meson-35d3baaa2fab0feb9e66a7603bb1dfa2178f2de4.tar.gz
meson-35d3baaa2fab0feb9e66a7603bb1dfa2178f2de4.tar.bz2
mtest: improvements to JUnit XML generation
Omit the classname attribute, as it is optional, and add the duration. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r--mesonbuild/mtest.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/mesonbuild/mtest.py b/mesonbuild/mtest.py
index fe91040..d59bb3f 100644
--- a/mesonbuild/mtest.py
+++ b/mesonbuild/mtest.py
@@ -620,12 +620,13 @@ class JunitBuilder(TestLogger):
failures=str(sum(1 for r in test.results.values() if r in
{TestResult.FAIL, TestResult.UNEXPECTEDPASS, TestResult.TIMEOUT})),
skipped=str(sum(1 for r in test.results.values() if r is TestResult.SKIP)),
+ time=str(test.duration),
)
- for i, result in test.results.items():
- # Both name and classname are required. Set them both to the
- # number of the test in a TAP test, as TAP doesn't give names.
- testcase = et.SubElement(suite, 'testcase', name=i, classname=i)
+ for i, result in enumerate(test.results):
+ # Set the name to the number of the test in a TAP test, as we cannot
+ # access the name yet.
+ testcase = et.SubElement(suite, 'testcase', name=str(i))
if result is TestResult.SKIP:
et.SubElement(testcase, 'skipped')
elif result is TestResult.ERROR:
@@ -651,12 +652,13 @@ class JunitBuilder(TestLogger):
if test.project not in self.suites:
suite = self.suites[test.project] = et.Element(
'testsuite', name=test.project, tests='1', errors='0',
- failures='0', skipped='0')
+ failures='0', skipped='0', time=str(test.duration))
else:
suite = self.suites[test.project]
suite.attrib['tests'] = str(int(suite.attrib['tests']) + 1)
- testcase = et.SubElement(suite, 'testcase', name=test.name, classname=test.name)
+ testcase = et.SubElement(suite, 'testcase', name=test.name,
+ time=str(test.duration))
if test.res is TestResult.SKIP:
et.SubElement(testcase, 'skipped')
suite.attrib['skipped'] = str(int(suite.attrib['skipped']) + 1)