126fa459cSmrg#!/usr/bin/env bash 226fa459cSmrg# 326fa459cSmrg# Test that the brotli command-line tool can decompress old brotli-compressed 426fa459cSmrg# files. 526fa459cSmrg# 626fa459cSmrg# The first argument may be a wrapper for brotli, such as 'qemu-arm'. 726fa459cSmrg 826fa459cSmrgset -o errexit 926fa459cSmrg 1026fa459cSmrgBROTLI_WRAPPER=$1 1126fa459cSmrgBROTLI="${BROTLI_WRAPPER} bin/brotli" 1226fa459cSmrgTMP_DIR=bin/tmp 1326fa459cSmrg 1426fa459cSmrgfor file in tests/testdata/*.compressed*; do 1526fa459cSmrg echo "Testing decompression of file $file" 1626fa459cSmrg expected=${file%.compressed*} 1726fa459cSmrg uncompressed=${TMP_DIR}/${expected##*/}.uncompressed 1826fa459cSmrg echo $uncompressed 1926fa459cSmrg $BROTLI $file -fdo $uncompressed 2026fa459cSmrg diff -q $uncompressed $expected 2126fa459cSmrg # Test the streaming version 2226fa459cSmrg cat $file | $BROTLI -dc > $uncompressed 2326fa459cSmrg diff -q $uncompressed $expected 2426fa459cSmrg rm -f $uncompressed 2526fa459cSmrgdone 26