1#/usr/bin/env sh 2set -e 3 4LZ4=../lz4 5CHECKFRAME=./checkFrame 6DATAGEN=./datagen 7 8failures="" 9 10TMPFILE=/tmp/test_custom_block_sizes.$$ 11TMPFILE1=/tmp/test_custom_block_sizes1.$$ 12TMPFILE2=/tmp/test_custom_block_sizes2.$$ 13$DATAGEN -g12345678 > $TMPFILE1 14$DATAGEN -g12345678 > $TMPFILE2 15 16echo Testing -B31 17$LZ4 -f -B31 $TMPFILE1 && failures="31 (should fail) " 18 19for blocksize in 32 65535 65536 20do 21 echo Testing -B$blocksize 22 $LZ4 -f -B$blocksize $TMPFILE1 23 $LZ4 -f -B$blocksize $TMPFILE2 24 cat $TMPFILE1.lz4 $TMPFILE2.lz4 > $TMPFILE.lz4 25 $CHECKFRAME -B$blocksize -b4 $TMPFILE.lz4 || failures="$failures $blocksize " 26done 27 28for blocksize in 65537 262143 262144 29do 30 echo Testing -B$blocksize 31 $LZ4 -f -B$blocksize $TMPFILE1 32 $LZ4 -f -B$blocksize $TMPFILE2 33 cat $TMPFILE1.lz4 $TMPFILE2.lz4 > $TMPFILE.lz4 34 $CHECKFRAME -B$blocksize -b5 $TMPFILE.lz4 || failures="$failures $blocksize " 35done 36 37for blocksize in 262145 1048575 1048576 38do 39 echo Testing -B$blocksize 40 $LZ4 -f -B$blocksize $TMPFILE1 41 $LZ4 -f -B$blocksize $TMPFILE2 42 cat $TMPFILE1.lz4 $TMPFILE2.lz4 > $TMPFILE.lz4 43 $CHECKFRAME -B$blocksize -b6 $TMPFILE.lz4 || failures="$failures $blocksize " 44done 45 46for blocksize in 1048577 4194303 4194304 47do 48 echo Testing -B$blocksize 49 $LZ4 -f -B$blocksize $TMPFILE1 50 $LZ4 -f -B$blocksize $TMPFILE2 51 cat $TMPFILE1.lz4 $TMPFILE2.lz4 > $TMPFILE.lz4 52 $CHECKFRAME -B$blocksize -b7 $TMPFILE.lz4 || failures="$failures $blocksize " 53done 54 55for blocksize in 4194305 10485760 56do 57 echo Testing -B$blocksize 58 $LZ4 -f -B$blocksize $TMPFILE1 59 $LZ4 -f -B$blocksize $TMPFILE2 60 cat $TMPFILE1.lz4 $TMPFILE2.lz4 > $TMPFILE.lz4 61 $CHECKFRAME -B4194304 -b7 $TMPFILE.lz4 || failures="$failures $blocksize " 62done 63 64rm $TMPFILE.lz4 $TMPFILE1 $TMPFILE1.lz4 $TMPFILE2 $TMPFILE2.lz4 65if [ "$failures" == "" ] 66then 67 echo ---- All tests passed 68 exit 0 69else 70 echo ---- The following tests had failures: $failures 71 exit 1 72fi 73