aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xtools/packaging/test262.py17
1 files changed, 14 insertions, 3 deletions
diff --git a/tools/packaging/test262.py b/tools/packaging/test262.py
index 9a5481827..b9172b067 100755
--- a/tools/packaging/test262.py
+++ b/tools/packaging/test262.py
@@ -170,6 +170,15 @@ class TestResult(object):
if len(err) > 0:
target.write("--- errors --- \n %s" % err)
+ # This is a way to make the output from the "whitespace" tests into valid XML
+ def SafeFormat(self, msg):
+ try:
+ msg = msg.encode(encoding='ascii', errors='strict')
+ msg = msg.replace('\u000Bx', '?')
+ msg = msg.replace('\u000Cx', '?')
+ except:
+ return 'Output contained invalid characters'
+
def XmlAssemble(self, result):
test_name = self.case.GetName()
test_mode = self.case.GetMode()
@@ -182,9 +191,9 @@ class TestResult(object):
out = self.stdout.strip().decode('utf-8')
err = self.stderr.strip().decode('utf-8')
if len(out) > 0:
- failureElement.text = out
+ failureElement.text = self.SafeFormat(out)
if len(err) > 0:
- failureElement.text = err
+ failureElement.text = self.SafeFormat(err)
testCaseElement.append(failureElement)
return testCaseElement
@@ -520,7 +529,9 @@ class TestSuite(object):
self.logf = open(logname, "w")
if junitfile:
self.outfile = open(junitfile, "w")
+ TestSuitesElement = xmlj.Element("testsuites")
TestSuiteElement = xmlj.Element("testsuite")
+ TestSuitesElement.append(TestSuiteElement)
TestSuiteElement.attrib["name "] = "test262"
for x in range(len(EXCLUDE_LIST)):
if self.ShouldRun (unicode(EXCLUDE_LIST[x].encode('utf-8','ignore')), tests):
@@ -538,7 +549,7 @@ class TestSuite(object):
TestCaseElement = result.XmlAssemble(result)
TestSuiteElement.append(TestCaseElement)
if case == cases[len(cases)-1]:
- xmlj.ElementTree(TestSuiteElement).write(junitfile, "UTF-8")
+ xmlj.ElementTree(TestSuitesElement).write(junitfile, "UTF-8")
if logname:
self.WriteLog(result)
progress.HasRun(result)