aboutsummaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorZoltan Szabadka <szabadka@google.com>2015-05-07 20:43:01 +0200
committerZoltan Szabadka <szabadka@google.com>2015-05-07 20:43:01 +0200
commit10a2f3745a6817d452d317718ab9e782b97984c7 (patch)
tree5f6eb307a635ddf40197691b66af8c81d205a05a /python
parent7ee6449b83facedc2b11a50062df1fdeaca1d145 (diff)
downloadbrotli-10a2f3745a6817d452d317718ab9e782b97984c7.zip
brotli-10a2f3745a6817d452d317718ab9e782b97984c7.tar.gz
brotli-10a2f3745a6817d452d317718ab9e782b97984c7.tar.bz2
Handle multiple compressed files per original in the test.
Add some more test cases that decompress to the empty file or a one byte long file. These test cases have examples for the updated stream header and meta-block header formats.
Diffstat (limited to 'python')
-rwxr-xr-xpython/tests/compatibility_test.py29
1 files changed, 6 insertions, 23 deletions
diff --git a/python/tests/compatibility_test.py b/python/tests/compatibility_test.py
index 68886be..dd1d10b 100755
--- a/python/tests/compatibility_test.py
+++ b/python/tests/compatibility_test.py
@@ -1,5 +1,7 @@
#!/usr/bin/env python
from __future__ import print_function
+import glob
+import string
import sys
import os
from subprocess import check_call
@@ -7,32 +9,12 @@ from subprocess import check_call
from test_utils import PYTHON, BRO, TEST_ENV, diff_q
-INPUTS = """\
-testdata/empty.compressed
-testdata/x.compressed
-testdata/64x.compressed
-testdata/10x10y.compressed
-testdata/xyzzy.compressed
-testdata/quickfox.compressed
-testdata/ukkonooa.compressed
-testdata/monkey.compressed
-testdata/backward65536.compressed
-testdata/zeros.compressed
-testdata/quickfox_repeated.compressed
-testdata/compressed_file.compressed
-testdata/compressed_repeated.compressed
-testdata/alice29.txt.compressed
-testdata/asyoulik.txt.compressed
-testdata/lcet10.txt.compressed
-testdata/plrabn12.txt.compressed
-"""
-
os.chdir(os.path.abspath("../../tests"))
-for filename in INPUTS.splitlines():
+for filename in glob.glob("testdata/*.compressed*"):
filename = os.path.abspath(filename)
print('Testing decompression of file "%s"' % os.path.basename(filename))
- uncompressed = os.path.splitext(filename)[0] + ".uncompressed"
- expected = os.path.splitext(filename)[0]
+ expected = string.split(filename, ".compressed")[0]
+ uncompressed = expected + ".uncompressed"
check_call([PYTHON, BRO, "-f", "-d", "-i", filename, "-o", uncompressed],
env=TEST_ENV)
if diff_q(uncompressed, expected) != 0:
@@ -43,3 +25,4 @@ for filename in INPUTS.splitlines():
env=TEST_ENV)
if diff_q(uncompressed, expected) != 0:
sys.exit(1)
+ os.unlink(uncompressed)