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

git at git.haskell.org git at git.haskell.org
Mon Jul 31 18:11:35 UTC 2017


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

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

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

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

    testsuite/junit: Properly escape strings


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

7a3622aea1dfccc397ed6868d1625b5a283aa38c
 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..237212d 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 = escape(reason),
+                                   message = escape(result))
 
     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