2016-12-09 15:58:13 +08:00
|
|
|
#!/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.
|
2018-09-27 17:00:33 +08:00
|
|
|
#
|
|
|
|
# The first argument may be a wrapper for brotli, such as 'qemu-arm'.
|
2014-10-30 20:59:37 +08:00
|
|
|
|
|
|
|
set -o errexit
|
|
|
|
|
2018-09-27 17:00:33 +08:00
|
|
|
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"
|
2015-05-08 02:43:01 +08:00
|
|
|
expected=${file%.compressed*}
|
2016-06-24 21:32:51 +08:00
|
|
|
uncompressed=${TMP_DIR}/${expected##*/}.uncompressed
|
|
|
|
echo $uncompressed
|
2017-05-29 23:55:14 +08:00
|
|
|
$BROTLI $file -fdo $uncompressed
|
2014-10-30 20:59:37 +08:00
|
|
|
diff -q $uncompressed $expected
|
2014-11-17 22:31:00 +08:00
|
|
|
# Test the streaming version
|
2017-05-29 23:55:14 +08:00
|
|
|
cat $file | $BROTLI -dc > $uncompressed
|
2014-11-17 22:31:00 +08:00
|
|
|
diff -q $uncompressed $expected
|
2015-05-08 02:43:01 +08:00
|
|
|
rm -f $uncompressed
|
2014-10-30 20:59:37 +08:00
|
|
|
done
|