Home | History | Annotate | Download | only in tests
      1 #!/usr/bin/env bash
      2 #
      3 # Test that the brotli command-line tool can decompress old brotli-compressed
      4 # files.
      5 
      6 set -o errexit
      7 
      8 BROTLI=bin/brotli
      9 TMP_DIR=bin/tmp
     10 
     11 for file in tests/testdata/*.compressed*; do
     12   echo "Testing decompression of file $file"
     13   expected=${file%.compressed*}
     14   uncompressed=${TMP_DIR}/${expected##*/}.uncompressed
     15   echo $uncompressed
     16   $BROTLI $file -fdo $uncompressed
     17   diff -q $uncompressed $expected
     18   # Test the streaming version
     19   cat $file | $BROTLI -dc > $uncompressed
     20   diff -q $uncompressed $expected
     21   rm -f $uncompressed
     22 done
     23