[Piglit] [PATCH 4/4] framework: Don't add extra '.' to xz compressed files on shell path

Dylan Baker baker.dylan.c at gmail.com
Wed Jul 22 18:11:23 PDT 2015


This modifies a unit test to catch that a test name ends with '.' when
it shouldn't, which in turn demonstrates a bug in the xz shell path,
where it adds an extra '.' to the end of a filename. This patch fixes
that bug as well.

Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
---
 framework/backends/compression.py           | 2 +-
 framework/tests/compressed_backend_tests.py | 5 ++++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/framework/backends/compression.py b/framework/backends/compression.py
index 55cabe6..88bde2a 100644
--- a/framework/backends/compression.py
+++ b/framework/backends/compression.py
@@ -119,7 +119,7 @@ except ImportError:
 
                 """
                 if filename.endswith('.xz'):
-                    filename = filename[:-2]
+                    filename = filename[:-3]
 
                 with open(filename, 'w') as f:
                     yield f
diff --git a/framework/tests/compressed_backend_tests.py b/framework/tests/compressed_backend_tests.py
index 5d9678e..b345ef2 100644
--- a/framework/tests/compressed_backend_tests.py
+++ b/framework/tests/compressed_backend_tests.py
@@ -117,7 +117,10 @@ def _test_extension():
 
         for each in os.listdir(d):
             if each.startswith('results.txt'):
-                ext = os.path.splitext(each)[1]
+                name, ext = os.path.splitext(each)
+                if name.endswith('.'):
+                    raise utils.TestFailure(
+                        'extra trailing "." in name "{}"'.format(name))
                 break
         else:
             raise utils.TestFailure('No results file generated')
-- 
2.4.6



More information about the Piglit mailing list