1 #!/usr/bin/env bash 2 # 3 # Roundtrip test for the brotli command-line tool. 4 5 set -o errexit 6 7 BRO=bin/bro 8 TMP_DIR=bin/tmp 9 INPUTS=""" 10 tests/testdata/alice29.txt 11 tests/testdata/asyoulik.txt 12 tests/testdata/lcet10.txt 13 tests/testdata/plrabn12.txt 14 enc/encode.c 15 common/dictionary.h 16 dec/decode.c 17 $BRO 18 """ 19 20 for file in $INPUTS; do 21 for quality in 1 6 9 11; do 22 echo "Roundtrip testing $file at quality $quality" 23 compressed=${TMP_DIR}/${file##*/}.bro 24 uncompressed=${TMP_DIR}/${file##*/}.unbro 25 $BRO -f -q $quality -i $file -o $compressed 26 $BRO -f -d -i $compressed -o $uncompressed 27 diff -q $file $uncompressed 28 # Test the streaming version 29 cat $file | $BRO -q $quality | $BRO -d >$uncompressed 30 diff -q $file $uncompressed 31 done 32 done 33