[commit: ghc] wip/jenkins: testsuite/junit: Properly escape strings (7cf2b89)

git at git.haskell.org git at git.haskell.org
Wed Aug 16 23:03:14 UTC 2017


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

On branch  : wip/jenkins
Link       : http://ghc.haskell.org/trac/ghc/changeset/7cf2b89d84584fb09df3a0822a9c1a82960ad806/ghc

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

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

    testsuite/junit: Properly escape strings


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

7cf2b89d84584fb09df3a0822a9c1a82960ad806
 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