[Piglit] [RFC 9/9] backends/junit.py; use a unique replacement character for '.'

Dylan Baker baker.dylan.c at gmail.com
Mon Apr 6 14:30:19 PDT 2015


The problem with using '_' is that a lot of test names have '_' in them
(arb_ham_sandwich). By using something more unique ('?') we can
convert it back to '.' when transforming the junit result back into a
TestrunResult, which allows junit and json results to be compared in a
single summary.

Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
---

I don't care at all what character we use. The only requirement is that
it must be unique (never show up in a single test). I originally
considered using "___", but was concerned that this might cause problems
with using the . regex to account for a single character, which ? would
solve.

 framework/backends/junit.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/framework/backends/junit.py b/framework/backends/junit.py
index 3602f9e..bcd38fe 100644
--- a/framework/backends/junit.py
+++ b/framework/backends/junit.py
@@ -161,7 +161,7 @@ class JUnitBackend(FileBackend):
         # classname), and replace piglits '/' separated groups with '.', after
         # replacing any '.' with '_' (so we don't get false groups).
         classname, testname = grouptools.splitname(name)
-        classname = classname.replace('.', '_')
+        classname = classname.replace('.', '?')
         classname = classname.replace(grouptools.SEPARATOR, '.')
 
         # Add the test to the piglit group rather than directly to the root
@@ -234,6 +234,7 @@ def _load(results_file):
         # separator with piglit's separator, and join the group and test names
         name = test.attrib['classname'].split('.', 1)[1]
         name = name.replace('.', grouptools.SEPARATOR)
+        name = name.replace('?', '.')
         name = grouptools.join(name, test.attrib['name'])
 
         # Remove the trailing _ if they were added (such as to api and search)
-- 
2.3.5



More information about the Piglit mailing list