summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDylan Baker <baker.dylan.c@gmail.com>2015-07-22 18:01:26 -0700
committerDylan Baker <baker.dylan.c@gmail.com>2015-07-23 11:43:34 -0700
commitb3a62ede64887faa5806ddc85f90231e692ae4a1 (patch)
tree9bc49e9ced2f7cea22c1f226a3b468db971ac52c
parent450067218d2fb3ebf64afe18dc20b9c8ff336b86 (diff)
framework: Don't add extra '.' to xz compressed files on shell path
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@intel.com> Tested-by: Michel Dänzer <michel.daenzer@amd.com>
-rw-r--r--framework/backends/compression.py2
-rw-r--r--framework/tests/compressed_backend_tests.py5
2 files changed, 5 insertions, 2 deletions
diff --git a/framework/backends/compression.py b/framework/backends/compression.py
index 55cabe6b3..88bde2a63 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 5d9678e2c..b345ef213 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')