diff --git a/main.c b/main.c index 35038f4..79535c0 100644 --- a/main.c +++ b/main.c @@ -1163,7 +1163,6 @@ redo: compressed_chunk = tdat->compressed_chunk + CHUNK_FLAG_SZ; rbytes = tdat->rbytes; dedupe_index_sz = 0; - tdat->rctx->valid = 0; /* Perform Dedup if enabled. */ if ((enable_rabin_scan || enable_fixed_scan)) { @@ -2147,9 +2146,9 @@ main(int argc, char *argv[]) case 's': ovr = parse_numeric(&chunksize, optarg); if (ovr == 1) - err_exit(0, "Chunk size too large %s", optarg); + err_exit(0, "Chunk size too large %s\n", optarg); else if (ovr == 2) - err_exit(0, "Invalid number %s", optarg); + err_exit(0, "Invalid number %s\n", optarg); if (chunksize < MIN_CHUNK) { err_exit(0, "Minimum chunk size is %ld\n", MIN_CHUNK); diff --git a/rabin/rabin_dedup.c b/rabin/rabin_dedup.c index e3fd2fb..ca99ecf 100755 --- a/rabin/rabin_dedup.c +++ b/rabin/rabin_dedup.c @@ -258,6 +258,7 @@ reset_dedupe_context(dedupe_context_t *ctx) { memset(ctx->current_window_data, 0, RAB_POLYNOMIAL_WIN_SIZE); ctx->window_pos = 0; + ctx->valid = 0; } void diff --git a/test/t1.tst b/test/t1.tst index de7f41c..79a1614 100644 --- a/test/t1.tst +++ b/test/t1.tst @@ -24,7 +24,8 @@ do if [ $? -ne 0 ] then echo "FATAL: Compression failed." - exit 1 + rm -f ${tf}.pz + continue fi cmd="../../pcompress -d ${tf}.pz ${tf}.1" echo "Running $cmd" @@ -32,13 +33,13 @@ do if [ $? -ne 0 ] then echo "FATAL: Decompression failed." - exit 1 + rm -f ${tf}.pz ${tf}.1 + continue fi diff ${tf} ${tf}.1 > /dev/null if [ $? -ne 0 ] then echo "FATAL: Decompression was not correct" - exit 1 fi rm -f ${tf}.pz ${tf}.1 done diff --git a/test/t2.tst b/test/t2.tst index e4a50fe..ed29804 100644 --- a/test/t2.tst +++ b/test/t2.tst @@ -17,7 +17,8 @@ do if [ $? -ne 0 ] then echo "FATAL: Compression failed." - exit 1 + rm -f ${tf}.pz + continue fi cmd="../../pcompress -d ${tf}.pz ${tf}.1" echo "Running $cmd" @@ -25,14 +26,14 @@ do if [ $? -ne 0 ] then echo "FATAL: Decompression failed." - exit 1 + rm -f ${tf}.pz ${tf}.1 + continue fi diff ${tf} ${tf}.1 > /dev/null if [ $? -ne 0 ] then echo "FATAL: Decompression was not correct" - exit 1 fi rm -f ${tf}.pz ${tf}.1 done diff --git a/test/t3.tst b/test/t3.tst index 42e3917..8bc9c81 100644 --- a/test/t3.tst +++ b/test/t3.tst @@ -29,7 +29,7 @@ do eval $cmd if [ $? -ne 0 ] then - echo "FATAL: ${cmd} errored." + echo "FATAL: ${cmd} errored. Cannot continue this test suite." exit 1 fi mv ${tf}.pz ${tf}.${algo} @@ -54,8 +54,9 @@ do eval $cmd if [ $? -ne 0 ] then - echo "${cmd} errored." - exit 1 + echo "FATAL: Compression errored." + rm -f ${tf}.${algo}.pz + continue fi cmd="../../pcompress -d ${tf}.${algo}.pz ${tf}.${algo}.1" echo "Running $cmd" @@ -63,13 +64,13 @@ do if [ $? -ne 0 ] then echo "FATAL: Decompression failed." - exit 1 + rm -f ${tf}.${algo}.pz ${tf}.${algo}.1 + continue fi diff ${tf}.${algo} ${tf}.${algo}.1 > /dev/null if [ $? -ne 0 ] then echo "FATAL: Decompression was not correct" - exit 1 fi rm -f ${tf}.${algo}.pz ${tf}.${algo}.1 done diff --git a/test/t4.tst b/test/t4.tst index 18697e9..d26bec0 100644 --- a/test/t4.tst +++ b/test/t4.tst @@ -19,23 +19,24 @@ do eval $cmd if [ $? -ne 0 ] then - echo "${cmd} errored." - exit 1 + echo "FATAL: Compression errored." + rm -f ${tf}.pz + continue fi cmd="../../pcompress -d ${tf}.pz ${tf}.1" echo "Running $cmd" eval $cmd if [ $? -ne 0 ] then - echo "${cmd} errored." - exit 1 + echo "FATAL: Decompression errored." + rm -f ${tf}.pz ${tf}.1 + continue fi diff ${tf} ${tf}.1 > /dev/null if [ $? -ne 0 ] then echo "FATAL: Decompression was not correct" - exit 1 fi rm -f ${tf}.pz ${tf}.1 done diff --git a/test/t5.tst b/test/t5.tst index 6d3b5c7..f607d03 100644 --- a/test/t5.tst +++ b/test/t5.tst @@ -20,15 +20,15 @@ do eval $cmd if [ $? -ne 0 ] then - echo "${cmd} errored." - exit 1 + echo "FATAL: Compression errored." + rm -f ${tf}.pz + continue fi pw=`cat /tmp/pwf` if [ "$pw" = "sillypassword" ] then echo "FATAL: Password file /tmp/pwf not zeroed!" - exit 1 fi echo "sillypassword" > /tmp/pwf @@ -37,22 +37,23 @@ do eval $cmd if [ $? -ne 0 ] then - echo "${cmd} errored." - exit 1 + echo "FATAL: Decompression errored." + rm -f ${tf}.pz ${tf}.1 + continue fi diff ${tf} ${tf}.1 > /dev/null if [ $? -ne 0 ] then - echo "${cmd}: Decompression was not correct" - exit 1 + echo "FATAL: Decompression was not correct" + rm -f ${tf}.pz ${tf}.1 + continue fi pw=`cat /tmp/pwf` if [ "$pw" = "sillypassword" ] then echo "FATAL: Password file /tmp/pwf not zeroed!" - exit 1 fi # @@ -66,7 +67,6 @@ do if [ $? -eq 0 ] then echo "FATAL: Decompression did not fail where expected." - exit 1 fi rm -f ${tf}.pz ${tf}.1 done diff --git a/test/t6.tst b/test/t6.tst index baa86a0..2aeb924 100644 --- a/test/t6.tst +++ b/test/t6.tst @@ -23,7 +23,8 @@ do if [ $? -ne 0 ] then echo "FATAL: Compression errored." - exit 1 + rm -f ${tf}.pz + continue fi cmd="../../pcompress -d ${tf}.pz ${tf}.1" echo "Running $cmd" @@ -31,13 +32,13 @@ do if [ $? -ne 0 ] then echo "FATAL: Decompression errored." - exit 1 + rm -f ${tf}.pz ${tf}.1 + continue fi diff ${tf} ${tf}.1 > /dev/null if [ $? -ne 0 ] then echo "FATAL: Decompression was not correct" - exit 1 fi rm -f ${tf}.pz ${tf}.1 done diff --git a/test/t7.tst b/test/t7.tst index bde12bb..5931c37 100644 --- a/test/t7.tst +++ b/test/t7.tst @@ -23,14 +23,14 @@ do if [ $? -ne 0 ] then echo "FATAL: Compression errored." - exit 1 + rm -f ${tf}.pz ${tf}.1 + continue fi pw=`cat /tmp/pwf` if [ "$pw" = "sillypassword" ] then echo "FATAL: Password file /tmp/pwf not zeroed!" - exit 1 fi echo "sillypassword" > /tmp/pwf @@ -40,21 +40,20 @@ do if [ $? -ne 0 ] then echo "FATAL: Decompression errored." - exit 1 + rm -f ${tf}.pz ${tf}.1 + continue fi diff ${tf} ${tf}.1 > /dev/null if [ $? -ne 0 ] then echo "FATAL: Decompression was not correct" - exit 1 fi pw=`cat /tmp/pwf` if [ "$pw" = "sillypassword" ] then echo "FATAL: Password file /tmp/pwf not zeroed!" - exit 1 fi rm -f ${tf}.pz ${tf}.1 done diff --git a/test/t8.tst b/test/t8.tst index 4e04399..c5c5344 100644 --- a/test/t8.tst +++ b/test/t8.tst @@ -21,8 +21,9 @@ do eval $cmd if [ $? -ne 0 ] then - echo "${cmd} errored." - exit 1 + echo "FATAL: Compression errored." + rm -f ${tf}.pz ${tf}.1 + continue fi cmd="../../pcompress -d ${tf}.pz ${tf}.1" echo "Running $cmd" @@ -30,14 +31,14 @@ do if [ $? -ne 0 ] then echo "FATAL: Decompression errored." - exit 1 + rm -f ${tf}.pz ${tf}.1 + continue fi diff ${tf} ${tf}.1 > /dev/null if [ $? -ne 0 ] then echo "FATAL: Decompression was not correct" - exit 1 fi rm -f ${tf}.pz ${tf}.1 done diff --git a/test/t9.tst b/test/t9.tst index 4e2c703..8b03204 100644 --- a/test/t9.tst +++ b/test/t9.tst @@ -30,7 +30,6 @@ do then echo "FATAL: Compression DID NOT ERROR where expected" rm -f ${tstf}.pz - exit 1 fi rm -f ${tstf}.pz break @@ -47,7 +46,6 @@ do then echo "FATAL: Compression DID NOT ERROR where expected" rm -f ${tstf}.pz - exit 1 fi rm -f ${tstf}.pz break @@ -67,7 +65,7 @@ do rm -f ${tstf}.pz d=`dirname ${tstf}` rm -f ${d}/.pc* - exit 1 + continue fi echo "Corrupting file header ..." @@ -77,9 +75,6 @@ do if [ $? -eq 0 ] then echo "FATAL: Decompression DID NOT ERROR where expected." - rm -f ${tstf}.pz - rm -f ${tstf}.1 - exit 1 fi rm -f ${tstf}.pz @@ -91,8 +86,8 @@ do if [ $? -ne 0 ] then echo "FATAL: Compression errored." - rm -f ${tstf}.pz - exit 1 + rm -f ${tstf}.pz ${tstf}.1 + continue fi cp ${tstf}.pz ${tstf}.1.pz @@ -104,9 +99,6 @@ do then echo "FATAL: Decompression DID NOT ERROR where expected." rm -f ${tstf}.pz - rm -f ${tstf}.1 - rm -f ${tstf}.1.pz - exit 1 fi rm -f ${tstf}.1 @@ -121,7 +113,6 @@ do rm -f ${tstf}.pz rm -f ${tstf}.1 rm -f ${tstf}.1.pz - exit 1 fi rm -f ${tstf}.1 ${tstf}.1.pz ${tstf}.pz @@ -132,15 +123,14 @@ do if [ $? -ne 0 ] then echo "FATAL: Compression errored." - rm -f ${tstf}.pz - exit 1 + rm -f ${tstf}.pz ${tstf}.1 + continue fi pw=`cat /tmp/pwf` if [ "$pw" = "plainpasswd" ] then echo "FATAL: Password file was not zeroed" - rm -f /tmp/pwf ${tstf}.pz - exit 1 + rm -f /tmp/pwf fi cp ${tstf}.pz ${tstf}.1.pz @@ -154,8 +144,6 @@ do echo "FATAL: Decompression DID NOT ERROR where expected." rm -f ${tstf}.pz rm -f ${tstf}.1 - rm -f ${tstf}.1.pz - exit 1 fi cp ${tstf}.1.pz ${tstf}.pz @@ -168,10 +156,6 @@ do if [ $? -eq 0 ] then echo "FATAL: Decompression DID NOT ERROR where expected." - rm -f ${tstf}.pz - rm -f ${tstf}.1 - rm -f ${tstf}.1.pz - exit 1 fi done diff --git a/utils/utils.c b/utils/utils.c index 88a8b3e..5f6e4cb 100644 --- a/utils/utils.c +++ b/utils/utils.c @@ -117,7 +117,7 @@ raise_by_multiplier(int64_t *val, int mult, int power) { int parse_numeric(int64_t *val, const char *str) { - int ovr = 2; + int ovr = 0; char *mult; *val = strtoll(str, &mult, 0);