diff options
Diffstat (limited to 'roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/roundtrip_test.sh')
-rwxr-xr-x | roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/roundtrip_test.sh | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/roundtrip_test.sh b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/roundtrip_test.sh new file mode 100755 index 000000000..90027af52 --- /dev/null +++ b/roms/edk2/BaseTools/Source/C/BrotliCompress/brotli/tests/roundtrip_test.sh @@ -0,0 +1,34 @@ +#!/usr/bin/env bash +# +# Roundtrip test for the brotli command-line tool. +# +# 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 +INPUTS=""" +tests/testdata/alice29.txt +tests/testdata/asyoulik.txt +tests/testdata/lcet10.txt +tests/testdata/plrabn12.txt +c/enc/encode.c +c/common/dictionary.h +c/dec/decode.c +""" + +for file in $INPUTS; do + for quality in 1 6 9 11; do + echo "Roundtrip testing $file at quality $quality" + compressed=${TMP_DIR}/${file##*/}.br + uncompressed=${TMP_DIR}/${file##*/}.unbr + $BROTLI -fq $quality $file -o $compressed + $BROTLI $compressed -fdo $uncompressed + diff -q $file $uncompressed + # Test the streaming version + cat $file | $BROTLI -cq $quality | $BROTLI -cd >$uncompressed + diff -q $file $uncompressed + done +done |