[Piglit] [PATCH] junit.py: Fix handling of special test names.

Mark Janes mark.a.janes at intel.com
Fri Feb 20 17:51:34 PST 2015


In junit.py, the testname variable is used by a closure within the
write_test() scope.  Modifying it breaks the filtering of expected
failures.
---
 framework/backends/junit.py | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/framework/backends/junit.py b/framework/backends/junit.py
index ddaf826..d4b5041 100644
--- a/framework/backends/junit.py
+++ b/framework/backends/junit.py
@@ -166,16 +166,17 @@ class JUnitBackend(FileBackend):
         # set different root names.
         classname = 'piglit.' + classname
 
-        testname += self._test_suffix
-
         # Jenkins will display special pages when the test has certain names.
         # https://jenkins-ci.org/issue/18062
         # https://jenkins-ci.org/issue/19810
-        if testname in ('api', 'search'):
+        # If there is a suffix, then the test link will not be one of
+        # the reserved names.  Don't modify testname, as it is used in
+        # the calculate_result closure.
+        if not self._test_suffix and testname in ('api', 'search'):
             testname += '_'
 
         # Create the root element
-        element = etree.Element('testcase', name=testname,
+        element = etree.Element('testcase', name=testname + self._test_suffix,
                                 classname=classname,
                                 time=str(data['time']),
                                 status=str(data['result']))
-- 
2.1.4



More information about the Piglit mailing list