From d89c95225a97661df63afca2f955fd6852401026 Mon Sep 17 00:00:00 2001 From: Moinak Ghosh Date: Sun, 12 May 2013 14:19:26 +0530 Subject: [PATCH] Add a testcase for issue #10. --- test/t9.tst | 48 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-) diff --git a/test/t9.tst b/test/t9.tst index f21945b..8f50112 100644 --- a/test/t9.tst +++ b/test/t9.tst @@ -32,7 +32,7 @@ then fi unset PCOMPRESS_CHUNK_HASH_GLOBAL -for feat in "-L" "-L -D" "-L -D -E" "-L -B5" "-L -D -E -B2" "-F" "-F -L" +for feat in "-L" "-L -D" "-L -D -E -M -C" "-L -B5" "-L -D -E -B2" "-F" "-F -L" do cmd="../../pcompress -c dummy -l4 -s1m $feat $tstf" echo "Running $cmd" @@ -43,6 +43,12 @@ do rm -f ${tstf}.pz break fi + if [ -f core* ] + then + echo "FATAL: Compression crashed" + rm -f ${tstf}.pz + break + fi rm -f ${tstf}.pz done @@ -63,6 +69,46 @@ do done done +# +# Create a file larger than 2GB +# +if [ ! -f ${tstf}.1 ] +then + echo -n "Creating a file approximately 2GB in size " + cp ${tstf} ${tstf}.1 + t_sz=$tsz + while [ $t_sz -lt 2147480000 ] + do + cat ${tstf} >> ${tstf}.1 + echo -n "." + t_sz=$((t_sz + tsz)) + done + echo "" + echo "Done" +fi + +# +# Try to compress with segment sizes larger than what some compression algos allow. +# +for feat in "-E -M -C -s 2147480000" "-D -E -M -C -L -P -B 2 -s 2147480000" +do + for algo in lz4 libbsc + do + cmd="../../pcompress -c $algo $feat ${tstf}.1" + echo "Running $cmd" + eval $cmd + if [ $? -eq 0 ] + then + echo "FATAL: Compression DID NOT ERROR where expected" + rm -f ${tstf}.1.pz + break + fi + rm -f ${tstf}.1.pz + done +done +rm -f ${tstf}.1.pz +rm -f ${tstf}.1 + for feat in "-S CRC64" "-S BLAKE256" "-S BLAKE512" "-S SHA256" "-S SHA512" "-S KECCAK256" "-S KECCAK512" do rm -f ${tstf}.*