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

Submitted by Dylan Baker on April 6, 2015, 9:30 p.m.

Details

Message ID 1428355819-12180-10-git-send-email-baker.dylan.c@gmail.com
State New, archived
Headers show

Not browsing as part of any series.

Commit Message

Dylan Baker April 6, 2015, 9:30 p.m.
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@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(-)

Patch hide | download patch | download mbox

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)