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