[commit: ghc] wip/jenkins: testsuite/junit: Properly escape strings (526e6d7)

git at git.haskell.org git at git.haskell.org
Wed Aug 16 02:40:12 UTC 2017


Repository : ssh://git@git.haskell.org/ghc

On branch  : wip/jenkins
Link       : http://ghc.haskell.org/trac/ghc/changeset/526e6d770ce78cddeaa2747e00f16323abfa2cda/ghc

>---------------------------------------------------------------

commit 526e6d770ce78cddeaa2747e00f16323abfa2cda
Author: Ben Gamari <ben at smart-cactus.org>
Date:   Mon Jul 31 11:36:49 2017 -0400

    testsuite/junit: Properly escape strings


>---------------------------------------------------------------

526e6d770ce78cddeaa2747e00f16323abfa2cda
 testsuite/driver/junit.py | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/testsuite/driver/junit.py b/testsuite/driver/junit.py
index f9689de..4015c19 100644
--- a/testsuite/driver/junit.py
+++ b/testsuite/driver/junit.py
@@ -1,5 +1,6 @@
 from datetime import datetime
 import xml.etree.ElementTree as ET
+from xml.sax.saxutils import escape
 
 def junit(t):
     testsuites = ET.Element('testsuites')
@@ -18,21 +19,21 @@ def junit(t):
                                      classname = testname,
                                      name = way)
             result = ET.SubElement(testcase, 'failure',
-                                   type = reason,
-                                   message = result)
+                                   type = 'unexpected failure',
+                                   message = escape(reason))
 
     for (directory, testname, reason, way) in t.framework_failures:
         testcase = ET.SubElement(testsuite, 'testcase',
                                  classname = testname,
-                                 name = way)
+                                 name = escape(way))
         result = ET.SubElement(testcase, 'error',
                                type = "framework failure",
-                               message = reason)
+                               message = escape(reason))
 
     for (directory, testname, way) in t.expected_passes:
         testcase = ET.SubElement(testsuite, 'testcase',
                                  classname = testname,
-                                 name = way)
+                                 name = escape(way))
 
     return ET.ElementTree(testsuites)
 



More information about the ghc-commits mailing list