brotli/tests/compatibility_test.sh

26 lines
672 B
Bash
Raw Normal View History

#!/usr/bin/env bash
2014-10-30 20:59:37 +08:00
#
# Test that the brotli command-line tool can decompress old brotli-compressed
# files.
#
# The first argument may be a wrapper for brotli, such as 'qemu-arm'.
2014-10-30 20:59:37 +08:00
set -o errexit
BROTLI_WRAPPER=$1
BROTLI="${BROTLI_WRAPPER} bin/brotli"
2016-06-24 21:32:51 +08:00
TMP_DIR=bin/tmp
2014-10-30 20:59:37 +08:00
2016-06-24 21:32:51 +08:00
for file in tests/testdata/*.compressed*; do
2014-10-30 20:59:37 +08:00
echo "Testing decompression of file $file"
expected=${file%.compressed*}
2016-06-24 21:32:51 +08:00
uncompressed=${TMP_DIR}/${expected##*/}.uncompressed
echo $uncompressed
$BROTLI $file -fdo $uncompressed
2014-10-30 20:59:37 +08:00
diff -q $uncompressed $expected
# Test the streaming version
cat $file | $BROTLI -dc > $uncompressed
diff -q $uncompressed $expected
rm -f $uncompressed
2014-10-30 20:59:37 +08:00
done