run-tests: add information about skipped tests to XUnit output
The XUnit spec supports skipped tests.
--- a/tests/run-tests.py Wed Jun 07 15:47:06 2017 -0700
+++ b/tests/run-tests.py Wed Jun 07 15:47:06 2017 -0700
@@ -2061,6 +2061,17 @@
failelem.appendChild(cd)
t.appendChild(failelem)
s.appendChild(t)
+ for tc, message in result.skipped:
+ # According to the schema, 'skipped' has no attributes. So store
+ # the skip message as a text node instead.
+ t = doc.createElement('testcase')
+ t.setAttribute('name', tc.name)
+ message = cdatasafe(message).decode('utf-8', 'replace')
+ cd = doc.createCDATASection(message)
+ skipelem = doc.createElement('skipped')
+ skipelem.appendChild(cd)
+ t.appendChild(skipelem)
+ s.appendChild(t)
outf.write(doc.toprettyxml(indent=' ', encoding='utf-8'))
@staticmethod
--- a/tests/test-run-tests.t Wed Jun 07 15:47:06 2017 -0700
+++ b/tests/test-run-tests.t Wed Jun 07 15:47:06 2017 -0700
@@ -676,6 +676,10 @@
<?xml version="1.0" encoding="utf-8"?>
<testsuite errors="0" failures="0" name="run-tests" skipped="2" tests="2">
<testcase name="test-success.t" time="*"/> (glob)
+ <testcase name="test-skip.t">
+ <skipped>
+ <![CDATA[missing feature: nail clipper]]> </skipped>
+ </testcase>
</testsuite>
Missing skips or blacklisted skips don't count as executed: