2016-12-09 07:58:13 +00:00
|
|
|
#!/usr/bin/env bash
|
2014-10-30 12:59:37 +00:00
|
|
|
#
|
|
|
|
# Roundtrip test for the brotli command-line tool.
|
|
|
|
|
|
|
|
set -o errexit
|
|
|
|
|
2017-05-29 15:55:14 +00:00
|
|
|
BROTLI=bin/brotli
|
2016-06-24 13:32:51 +00:00
|
|
|
TMP_DIR=bin/tmp
|
2014-10-30 12:59:37 +00:00
|
|
|
INPUTS="""
|
2016-06-24 13:32:51 +00:00
|
|
|
tests/testdata/alice29.txt
|
|
|
|
tests/testdata/asyoulik.txt
|
|
|
|
tests/testdata/lcet10.txt
|
|
|
|
tests/testdata/plrabn12.txt
|
2017-04-23 12:07:08 +00:00
|
|
|
c/enc/encode.c
|
|
|
|
c/common/dictionary.h
|
|
|
|
c/dec/decode.c
|
2017-05-29 15:55:14 +00:00
|
|
|
$BROTLI
|
2014-10-30 12:59:37 +00:00
|
|
|
"""
|
|
|
|
|
|
|
|
for file in $INPUTS; do
|
2015-05-11 12:14:05 +00:00
|
|
|
for quality in 1 6 9 11; do
|
|
|
|
echo "Roundtrip testing $file at quality $quality"
|
2017-05-29 15:55:14 +00:00
|
|
|
compressed=${TMP_DIR}/${file##*/}.br
|
|
|
|
uncompressed=${TMP_DIR}/${file##*/}.unbr
|
|
|
|
$BROTLI -fq $quality $file -o $compressed
|
|
|
|
$BROTLI $compressed -fdo $uncompressed
|
2015-05-11 12:14:05 +00:00
|
|
|
diff -q $file $uncompressed
|
|
|
|
# Test the streaming version
|
2017-05-29 15:55:14 +00:00
|
|
|
cat $file | $BROTLI -cq $quality | $BROTLI -cd >$uncompressed
|
2015-05-11 12:14:05 +00:00
|
|
|
diff -q $file $uncompressed
|
|
|
|
done
|
2014-10-30 12:59:37 +00:00
|
|
|
done
|