[Piglit] [PATCH 4/7] results.py: use posixpath instead of grouptools

Dylan Baker baker.dylan.c at gmail.com
Thu Mar 12 15:42:07 PDT 2015


On the surface this looks like a step backwards. But it's not. Because
posixpath doesn't change, while grouptools might (will) change it's
separator in the future, but v4 results never will. Since we use an
incremental approach to updating (ie, 1 -> 2 -> 3 -> 4 -> inf) we need
to be sure that results of v4 are correct always, even when grouptools
changes.

Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
---
 framework/results.py | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/framework/results.py b/framework/results.py
index 961376f..5807be4 100644
--- a/framework/results.py
+++ b/framework/results.py
@@ -24,6 +24,7 @@
 from __future__ import print_function, absolute_import
 import os
 import sys
+import posixpath
 
 try:
     import simplejson as json
@@ -31,7 +32,6 @@ except ImportError:
     import json
 
 import framework.status as status
-from framework import grouptools
 from framework.backends import (CURRENT_JSON_VERSION, piglit_encoder,
                                 JSONBackend)
 
@@ -450,10 +450,12 @@ def _update_three_to_four(results):
             results.tests[new] = results.tests[original]
             del results.tests[original]
 
+    # This needs to use posixpath rather than grouptools because version 4 uses
+    # / as a separator, but grouptools isn't guaranteed to do so forever.
     for test, result in results.tests.items():
-        if grouptools.groupname(test) == 'glslparsertest':
-            group = grouptools.join('glslparsertest/shaders',
-                                    grouptools.testname(test))
+        if posixpath.dirname(test) == 'glslparsertest':
+            group = posixpath.join('glslparsertest/shaders',
+                                   posixpath.basename(test))
             results.tests[group] = result
             del results.tests[test]
 
-- 
2.3.1



More information about the Piglit mailing list