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.
This commit is contained in:
Zoltan Szabadka 2015-05-07 20:43:01 +02:00
parent 7ee6449b83
commit 10a2f3745a
29 changed files with 27 additions and 45 deletions

View File

@ -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)

View File

@ -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

1
tests/testdata/empty.compressed.00 vendored Normal file
View File

@ -0,0 +1 @@


1
tests/testdata/empty.compressed.01 vendored Normal file
View File

@ -0,0 +1 @@
<EFBFBD>

1
tests/testdata/empty.compressed.02 vendored Normal file
View File

@ -0,0 +1 @@
<EFBFBD>

1
tests/testdata/empty.compressed.03 vendored Normal file
View File

@ -0,0 +1 @@
<EFBFBD>

1
tests/testdata/empty.compressed.04 vendored Normal file
View File

@ -0,0 +1 @@
<EFBFBD>

1
tests/testdata/empty.compressed.05 vendored Normal file
View File

@ -0,0 +1 @@
<EFBFBD>

1
tests/testdata/empty.compressed.06 vendored Normal file
View File

@ -0,0 +1 @@
<EFBFBD>

1
tests/testdata/empty.compressed.07 vendored Normal file
View File

@ -0,0 +1 @@
<EFBFBD>

1
tests/testdata/empty.compressed.08 vendored Normal file
View File

@ -0,0 +1 @@
3

1
tests/testdata/empty.compressed.09 vendored Normal file
View File

@ -0,0 +1 @@
5

1
tests/testdata/empty.compressed.10 vendored Normal file
View File

@ -0,0 +1 @@
7

1
tests/testdata/empty.compressed.11 vendored Normal file
View File

@ -0,0 +1 @@
9

1
tests/testdata/empty.compressed.12 vendored Normal file
View File

@ -0,0 +1 @@
;

1
tests/testdata/empty.compressed.13 vendored Normal file
View File

@ -0,0 +1 @@
=

1
tests/testdata/empty.compressed.14 vendored Normal file
View File

@ -0,0 +1 @@
?

1
tests/testdata/empty.compressed.15 vendored Normal file
View File

@ -0,0 +1 @@


BIN
tests/testdata/empty.compressed.16 vendored Normal file

Binary file not shown.

1
tests/testdata/empty.compressed.17 vendored Normal file

File diff suppressed because one or more lines are too long

BIN
tests/testdata/empty.compressed.18 vendored Normal file

Binary file not shown.

BIN
tests/testdata/mapsdatazrh vendored Normal file

Binary file not shown.

BIN
tests/testdata/mapsdatazrh.compressed vendored Normal file

Binary file not shown.

BIN
tests/testdata/random_org_10k.bin vendored Normal file

Binary file not shown.

Binary file not shown.

BIN
tests/testdata/x.compressed.00 vendored Normal file

Binary file not shown.

BIN
tests/testdata/x.compressed.01 vendored Normal file

Binary file not shown.

BIN
tests/testdata/x.compressed.02 vendored Normal file

Binary file not shown.

BIN
tests/testdata/x.compressed.03 vendored Normal file

Binary file not shown.