aboutsummaryrefslogtreecommitdiffstats
path: root/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/compatibility_test.sh
blob: c5af8bf1a850b7025f69f3ba04e00762460b0054 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/usr/bin/env bash
#
# Test that the brotli command-line tool can decompress old brotli-compressed
# files.
#
# The first argument may be a wrapper for brotli, such as 'qemu-arm'.

set -o errexit

BROTLI_WRAPPER=$1
BROTLI="${BROTLI_WRAPPER} bin/brotli"
TMP_DIR=bin/tmp

for file in tests/testdata/*.compressed*; do
  echo "Testing decompression of file $file"
  expected=${file%.compressed*}
  uncompressed=${TMP_DIR}/${expected##*/}.uncompressed
  echo $uncompressed
  $BROTLI $file -fdo $uncompressed
  diff -q $uncompressed $expected
  # Test the streaming version
  cat $file | $BROTLI -dc > $uncompressed
  diff -q $uncompressed $expected
  rm -f $uncompressed
done