1#!/usr/bin/env bash 2# 3# Test that the brotli command-line tool can decompress old brotli-compressed 4# files. 5# 6# The first argument may be a wrapper for brotli, such as 'qemu-arm'. 7 8set -o errexit 9 10BROTLI_WRAPPER=$1 11BROTLI="${BROTLI_WRAPPER} bin/brotli" 12TMP_DIR=bin/tmp 13 14for file in tests/testdata/*.compressed*; do 15 echo "Testing decompression of file $file" 16 expected=${file%.compressed*} 17 uncompressed=${TMP_DIR}/${expected##*/}.uncompressed 18 echo $uncompressed 19 $BROTLI $file -fdo $uncompressed 20 diff -q $uncompressed $expected 21 # Test the streaming version 22 cat $file | $BROTLI -dc > $uncompressed 23 diff -q $uncompressed $expected 24 rm -f $uncompressed 25done 26