diff options
author | Zoltan Szabadka <szabadka@google.com> | 2015-05-07 20:43:01 +0200 |
---|---|---|
committer | Zoltan Szabadka <szabadka@google.com> | 2015-05-07 20:43:01 +0200 |
commit | 10a2f3745a6817d452d317718ab9e782b97984c7 (patch) | |
tree | 5f6eb307a635ddf40197691b66af8c81d205a05a | |
parent | 7ee6449b83facedc2b11a50062df1fdeaca1d145 (diff) | |
download | brotli-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.
29 files changed, 27 insertions, 45 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) diff --git a/tests/compatibility_test.sh b/tests/compatibility_test.sh index cf72662..e907485 100755 --- a/tests/compatibility_test.sh +++ b/tests/compatibility_test.sh @@ -6,34 +6,16 @@ set -o errexit BRO=../tools/bro -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 -""" -for file in $INPUTS; do +for file in testdata/*.compressed*; do echo "Testing decompression of file $file" - uncompressed=${file%.compressed}.uncompressed - expected=${file%.compressed} + expected=${file%.compressed*} + uncompressed=${expected}.uncompressed $BRO -f -d -i $file -o $uncompressed diff -q $uncompressed $expected # Test the streaming version cat $file | $BRO -d > $uncompressed diff -q $uncompressed $expected + rm -f $uncompressed done diff --git a/tests/testdata/empty.compressed.00 b/tests/testdata/empty.compressed.00 new file mode 100644 index 0000000..f8fa5a2 --- /dev/null +++ b/tests/testdata/empty.compressed.00 @@ -0,0 +1 @@ +
\ No newline at end of file diff --git a/tests/testdata/empty.compressed.01 b/tests/testdata/empty.compressed.01 new file mode 100644 index 0000000..17bb347 --- /dev/null +++ b/tests/testdata/empty.compressed.01 @@ -0,0 +1 @@ +
\ No newline at end of file diff --git a/tests/testdata/empty.compressed.02 b/tests/testdata/empty.compressed.02 new file mode 100644 index 0000000..c183df6 --- /dev/null +++ b/tests/testdata/empty.compressed.02 @@ -0,0 +1 @@ +
\ No newline at end of file diff --git a/tests/testdata/empty.compressed.03 b/tests/testdata/empty.compressed.03 new file mode 100644 index 0000000..ae60db8 --- /dev/null +++ b/tests/testdata/empty.compressed.03 @@ -0,0 +1 @@ +
\ No newline at end of file diff --git a/tests/testdata/empty.compressed.04 b/tests/testdata/empty.compressed.04 new file mode 100644 index 0000000..8fac034 --- /dev/null +++ b/tests/testdata/empty.compressed.04 @@ -0,0 +1 @@ +
\ No newline at end of file diff --git a/tests/testdata/empty.compressed.05 b/tests/testdata/empty.compressed.05 new file mode 100644 index 0000000..98c9dcc --- /dev/null +++ b/tests/testdata/empty.compressed.05 @@ -0,0 +1 @@ +
\ No newline at end of file diff --git a/tests/testdata/empty.compressed.06 b/tests/testdata/empty.compressed.06 new file mode 100644 index 0000000..84f606f --- /dev/null +++ b/tests/testdata/empty.compressed.06 @@ -0,0 +1 @@ +
\ No newline at end of file diff --git a/tests/testdata/empty.compressed.07 b/tests/testdata/empty.compressed.07 new file mode 100644 index 0000000..0941d53 --- /dev/null +++ b/tests/testdata/empty.compressed.07 @@ -0,0 +1 @@ +
\ No newline at end of file diff --git a/tests/testdata/empty.compressed.08 b/tests/testdata/empty.compressed.08 new file mode 100644 index 0000000..e440e5c --- /dev/null +++ b/tests/testdata/empty.compressed.08 @@ -0,0 +1 @@ +3
\ No newline at end of file diff --git a/tests/testdata/empty.compressed.09 b/tests/testdata/empty.compressed.09 new file mode 100644 index 0000000..7813681 --- /dev/null +++ b/tests/testdata/empty.compressed.09 @@ -0,0 +1 @@ +5
\ No newline at end of file diff --git a/tests/testdata/empty.compressed.10 b/tests/testdata/empty.compressed.10 new file mode 100644 index 0000000..c793025 --- /dev/null +++ b/tests/testdata/empty.compressed.10 @@ -0,0 +1 @@ +7
\ No newline at end of file diff --git a/tests/testdata/empty.compressed.11 b/tests/testdata/empty.compressed.11 new file mode 100644 index 0000000..f11c82a --- /dev/null +++ b/tests/testdata/empty.compressed.11 @@ -0,0 +1 @@ +9
\ No newline at end of file diff --git a/tests/testdata/empty.compressed.12 b/tests/testdata/empty.compressed.12 new file mode 100644 index 0000000..1c8a0e7 --- /dev/null +++ b/tests/testdata/empty.compressed.12 @@ -0,0 +1 @@ +;
\ No newline at end of file diff --git a/tests/testdata/empty.compressed.13 b/tests/testdata/empty.compressed.13 new file mode 100644 index 0000000..851c75c --- /dev/null +++ b/tests/testdata/empty.compressed.13 @@ -0,0 +1 @@ +=
\ No newline at end of file diff --git a/tests/testdata/empty.compressed.14 b/tests/testdata/empty.compressed.14 new file mode 100644 index 0000000..0d758c9 --- /dev/null +++ b/tests/testdata/empty.compressed.14 @@ -0,0 +1 @@ +?
\ No newline at end of file diff --git a/tests/testdata/empty.compressed.15 b/tests/testdata/empty.compressed.15 new file mode 100644 index 0000000..152f9ed --- /dev/null +++ b/tests/testdata/empty.compressed.15 @@ -0,0 +1 @@ +
\ No newline at end of file diff --git a/tests/testdata/empty.compressed.16 b/tests/testdata/empty.compressed.16 Binary files differnew file mode 100644 index 0000000..e136a79 --- /dev/null +++ b/tests/testdata/empty.compressed.16 diff --git a/tests/testdata/empty.compressed.17 b/tests/testdata/empty.compressed.17 new file mode 100644 index 0000000..81f0388 --- /dev/null +++ b/tests/testdata/empty.compressed.17 @@ -0,0 +1 @@ +
\ No newline at end of file diff --git a/tests/testdata/empty.compressed.18 b/tests/testdata/empty.compressed.18 Binary files differnew file mode 100644 index 0000000..524e341 --- /dev/null +++ b/tests/testdata/empty.compressed.18 diff --git a/tests/testdata/mapsdatazrh b/tests/testdata/mapsdatazrh Binary files differnew file mode 100644 index 0000000..0371183 --- /dev/null +++ b/tests/testdata/mapsdatazrh diff --git a/tests/testdata/mapsdatazrh.compressed b/tests/testdata/mapsdatazrh.compressed Binary files differnew file mode 100644 index 0000000..77bfa47 --- /dev/null +++ b/tests/testdata/mapsdatazrh.compressed diff --git a/tests/testdata/random_org_10k.bin b/tests/testdata/random_org_10k.bin Binary files differnew file mode 100644 index 0000000..faf8a3a --- /dev/null +++ b/tests/testdata/random_org_10k.bin diff --git a/tests/testdata/random_org_10k.bin.compressed b/tests/testdata/random_org_10k.bin.compressed Binary files differnew file mode 100644 index 0000000..5ffbaa0 --- /dev/null +++ b/tests/testdata/random_org_10k.bin.compressed diff --git a/tests/testdata/x.compressed.00 b/tests/testdata/x.compressed.00 Binary files differnew file mode 100644 index 0000000..33e3a98 --- /dev/null +++ b/tests/testdata/x.compressed.00 diff --git a/tests/testdata/x.compressed.01 b/tests/testdata/x.compressed.01 Binary files differnew file mode 100644 index 0000000..9c8249b --- /dev/null +++ b/tests/testdata/x.compressed.01 diff --git a/tests/testdata/x.compressed.02 b/tests/testdata/x.compressed.02 Binary files differnew file mode 100644 index 0000000..3a5890d --- /dev/null +++ b/tests/testdata/x.compressed.02 diff --git a/tests/testdata/x.compressed.03 b/tests/testdata/x.compressed.03 Binary files differnew file mode 100644 index 0000000..842e799 --- /dev/null +++ b/tests/testdata/x.compressed.03 |