[Piglit] [PATCH 1/8] framework/tests: Add tests for recompressing results

Dylan Baker baker.dylan.c at gmail.com
Fri Aug 21 17:21:13 PDT 2015


These tests demonstrate a bug that hasn't yet been exposed to users, but
will be exposed if the json version is ever bumped.

The bug results in a compression suffix being added to a result file
that already has a compression suffix, even one with the same suffix.

Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
---
 framework/tests/compressed_backend_tests.py | 33 +++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/framework/tests/compressed_backend_tests.py b/framework/tests/compressed_backend_tests.py
index b345ef2..e7cf2cb 100644
--- a/framework/tests/compressed_backend_tests.py
+++ b/framework/tests/compressed_backend_tests.py
@@ -247,3 +247,36 @@ def test_xz_shell_override():
 
     with compression.COMPRESSORS['xz']('foo.json') as f:
         f.write('foobar')
+
+
+ at utils.set_piglit_conf(('core', 'compression', 'bz2'))
+def test_write_compressed_one_suffix_bz2():
+    """backends.abstract.write_compressed: Does not duplicate compression suffixes
+    """
+    with utils.tempdir() as d:
+        with abstract.write_compressed(os.path.join(d, 'results.txt.bz2')) as f:
+            f.write('foo')
+
+        nt.eq_(os.listdir(d)[0], 'results.txt.bz2')
+
+
+ at utils.set_piglit_conf(('core', 'compression', 'gz'))
+def test_write_compressed_one_suffix_gz():
+    """backends.abstract.write_compressed: Does not duplicate compression suffixes
+    """
+    with utils.tempdir() as d:
+        with abstract.write_compressed(os.path.join(d, 'results.txt.gz')) as f:
+            f.write('foo')
+
+        nt.eq_(os.listdir(d)[0], 'results.txt.gz')
+
+
+ at utils.set_piglit_conf(('core', 'compression', 'gz'))
+def test_write_compressed_one_suffix_mixed():
+    """backends.abstract.write_compressed: Does not duplicate compression suffixes
+    """
+    with utils.tempdir() as d:
+        with abstract.write_compressed(os.path.join(d, 'results.txt.bz2')) as f:
+            f.write('foo')
+
+        nt.eq_(os.listdir(d)[0], 'results.txt.gz')
-- 
2.5.0



More information about the Piglit mailing list