summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2019-06-23 10:39:57 -0400
committerMarge Bot <ben+marge-bot@smart-cactus.org>2019-06-25 08:37:46 -0400
commitbb40bd37ebf4fee0c2c06f9e8545f3b34c7fa4a5 (patch)
treeab60772aa9c7bf313b9911e2c8b6113c0c31635e
parentc346585b5f5054a85e48dc546e198c5be124340f (diff)
downloadhaskell-bb40bd37ebf4fee0c2c06f9e8545f3b34c7fa4a5.tar.gz
testsuite: Fix a few issues in JUnit output
* Make it pass mypy * Fix a typo in test name field * Report more stderr output * Report stdout output
-rw-r--r--testsuite/driver/junit.py19
1 files changed, 14 insertions, 5 deletions
diff --git a/testsuite/driver/junit.py b/testsuite/driver/junit.py
index d376a061c8..9ff00ec1cb 100644
--- a/testsuite/driver/junit.py
+++ b/testsuite/driver/junit.py
@@ -1,7 +1,10 @@
+from my_typing import *
from datetime import datetime
import xml.etree.ElementTree as ET
-def junit(t):
+from testglobals import TestRun
+
+def junit(t: TestRun) -> ET.ElementTree:
testsuites = ET.Element('testsuites')
testsuite = ET.SubElement(testsuites, 'testsuite',
id = "0",
@@ -15,15 +18,21 @@ def junit(t):
for res_type, group in [('stat failure', t.unexpected_stat_failures),
('unexpected failure', t.unexpected_failures),
- ('unexpected_passes', t.unexpected_passes)]:
+ ('unexpected pass', t.unexpected_passes)]:
for tr in group:
testcase = ET.SubElement(testsuite, 'testcase',
classname = tr.way,
- name = '%s(%sb)' % (tr.testname, tr.way))
- new_reason = "\n".join([tr.reason, "STDERR:", tr.stderr.decode("utf-8")]) if tr.stderr else tr.reason
+ name = '%s(%s)' % (tr.testname, tr.way))
+ message = [] # type: List[str]
+ if tr.stdout:
+ message += ['', 'stdout:', '==========', tr.stdout]
+ if tr.stderr:
+ message += ['', 'stderr:', '==========', tr.stderr]
+
result = ET.SubElement(testcase, 'failure',
type = res_type,
- message = new_reason)
+ message = tr.reason)
+ result.text = '\n'.join(message)
for tr in t.framework_failures:
testcase = ET.SubElement(testsuite, 'testcase',