Fix numeric parsing.

Fix dedupe bug introduced in last commit.
Reset valid flag when resetting dedupe context.
Cleanup test suites.
Do not abort test suite on failure of a test case.
This commit is contained in:
Moinak Ghosh 2013-01-03 00:27:18 +05:30
parent 6b756eb165
commit d9eb82e0e8
12 changed files with 52 additions and 63 deletions

5
main.c
View file

@ -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);

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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);