2012-11-24 18:23:07 +00:00
|
|
|
#
|
|
|
|
# Out of range parameters
|
|
|
|
#
|
2012-11-26 14:51:03 +00:00
|
|
|
echo "####################################################"
|
|
|
|
echo "# Test out of range parameters and error conditions."
|
|
|
|
echo "####################################################"
|
2012-11-24 18:23:07 +00:00
|
|
|
|
2013-01-02 17:26:21 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# Select a large file from the list
|
|
|
|
#
|
|
|
|
tstf=
|
|
|
|
tsz=0
|
|
|
|
for tf in `cat files.lst`
|
|
|
|
do
|
|
|
|
sz=`ls -l ${tf} | awk '{ print $5 }'`
|
|
|
|
if [ $sz -gt $tsz ]
|
|
|
|
then
|
|
|
|
tsz=$sz
|
|
|
|
tstf="$tf"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2013-05-07 17:00:36 +00:00
|
|
|
export PCOMPRESS_CHUNK_HASH_GLOBAL=CRC64
|
|
|
|
cmd="../../pcompress -G -c none -l1 -s10m $tstf"
|
|
|
|
echo "Running $cmd"
|
|
|
|
eval $cmd
|
|
|
|
if [ $? -eq 0 ]
|
|
|
|
then
|
|
|
|
echo "FATAL: Compression DID NOT ERROR where expected"
|
|
|
|
rm -f ${tstf}.pz
|
|
|
|
fi
|
|
|
|
unset PCOMPRESS_CHUNK_HASH_GLOBAL
|
2013-05-26 18:08:10 +00:00
|
|
|
if [ -f core* ]
|
|
|
|
then
|
|
|
|
echo "FATAL: Compression crashed"
|
|
|
|
rm -f ${tstf}.pz
|
|
|
|
rm -f core*
|
|
|
|
fi
|
2013-05-07 17:00:36 +00:00
|
|
|
|
2013-05-12 08:49:26 +00:00
|
|
|
for feat in "-L" "-L -D" "-L -D -E -M -C" "-L -B5" "-L -D -E -B2" "-F" "-F -L"
|
2012-11-24 18:23:07 +00:00
|
|
|
do
|
2013-01-02 17:26:21 +00:00
|
|
|
cmd="../../pcompress -c dummy -l4 -s1m $feat $tstf"
|
2012-11-24 18:23:07 +00:00
|
|
|
echo "Running $cmd"
|
|
|
|
eval $cmd
|
|
|
|
if [ $? -eq 0 ]
|
|
|
|
then
|
2012-12-08 08:49:01 +00:00
|
|
|
echo "FATAL: Compression DID NOT ERROR where expected"
|
2013-01-02 17:26:21 +00:00
|
|
|
rm -f ${tstf}.pz
|
2013-05-07 17:00:36 +00:00
|
|
|
break
|
2012-11-24 18:23:07 +00:00
|
|
|
fi
|
2013-05-12 08:49:26 +00:00
|
|
|
if [ -f core* ]
|
|
|
|
then
|
|
|
|
echo "FATAL: Compression crashed"
|
|
|
|
rm -f ${tstf}.pz
|
2013-05-26 18:08:10 +00:00
|
|
|
rm -f core*
|
2013-05-12 08:49:26 +00:00
|
|
|
break
|
|
|
|
fi
|
2013-01-02 17:26:21 +00:00
|
|
|
rm -f ${tstf}.pz
|
2012-11-24 18:23:07 +00:00
|
|
|
done
|
|
|
|
|
2013-08-30 14:21:43 +00:00
|
|
|
for feat in "-B8 -s2m -l1" "-B-1 -s2m -l1" "-D -s10k -l1" "-D -F -s2m -l1" "-p -e AES -s2m -l1" "-s2m -l15" "-e AES -k64" "-e SALSA20 -k8" "-e AES -k8" "-e SALSA20 -k64"
|
2012-11-24 18:23:07 +00:00
|
|
|
do
|
|
|
|
for algo in lzfx lz4 zlib bzip2 libbsc ppmd lzma
|
|
|
|
do
|
2013-01-02 17:26:21 +00:00
|
|
|
cmd="../../pcompress -c lzfx $feat $tstf"
|
2012-11-24 18:23:07 +00:00
|
|
|
echo "Running $cmd"
|
|
|
|
eval $cmd
|
|
|
|
if [ $? -eq 0 ]
|
|
|
|
then
|
2012-12-08 08:49:01 +00:00
|
|
|
echo "FATAL: Compression DID NOT ERROR where expected"
|
2013-01-02 17:26:21 +00:00
|
|
|
rm -f ${tstf}.pz
|
2013-05-07 17:00:36 +00:00
|
|
|
break
|
2012-11-24 18:23:07 +00:00
|
|
|
fi
|
2013-01-02 17:26:21 +00:00
|
|
|
rm -f ${tstf}.pz
|
2012-11-24 18:23:07 +00:00
|
|
|
done
|
|
|
|
done
|
|
|
|
|
2013-05-12 08:49:26 +00:00
|
|
|
#
|
|
|
|
# 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
|
|
|
|
|
2013-01-26 12:10:23 +00:00
|
|
|
for feat in "-S CRC64" "-S BLAKE256" "-S BLAKE512" "-S SHA256" "-S SHA512" "-S KECCAK256" "-S KECCAK512"
|
2012-11-24 18:23:07 +00:00
|
|
|
do
|
2013-01-02 17:26:21 +00:00
|
|
|
rm -f ${tstf}.*
|
2012-11-24 18:23:07 +00:00
|
|
|
|
2013-01-02 17:26:21 +00:00
|
|
|
cmd="../../pcompress -c lzfx -l3 -s1m $feat ${tstf}"
|
2012-11-24 18:23:07 +00:00
|
|
|
echo "Running $cmd"
|
|
|
|
eval $cmd
|
|
|
|
if [ $? -ne 0 ]
|
|
|
|
then
|
2012-12-08 08:49:01 +00:00
|
|
|
echo "FATAL: Compression errored."
|
2013-01-02 17:26:21 +00:00
|
|
|
rm -f ${tstf}.pz
|
|
|
|
d=`dirname ${tstf}`
|
|
|
|
rm -f ${d}/.pc*
|
2013-01-02 18:57:18 +00:00
|
|
|
continue
|
2012-11-24 18:23:07 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
echo "Corrupting file header ..."
|
2013-01-02 17:26:21 +00:00
|
|
|
dd if=/dev/urandom conv=notrunc of=${tstf}.pz bs=4 seek=1 count=1
|
|
|
|
cmd="../../pcompress -d ${tstf}.pz ${tstf}.1"
|
2012-11-24 18:23:07 +00:00
|
|
|
eval $cmd
|
|
|
|
if [ $? -eq 0 ]
|
|
|
|
then
|
2012-12-08 08:49:01 +00:00
|
|
|
echo "FATAL: Decompression DID NOT ERROR where expected."
|
2012-11-24 18:23:07 +00:00
|
|
|
fi
|
|
|
|
|
2013-01-02 17:26:21 +00:00
|
|
|
rm -f ${tstf}.pz
|
|
|
|
rm -f ${tstf}.1
|
2012-11-24 18:23:07 +00:00
|
|
|
|
2013-01-02 17:26:21 +00:00
|
|
|
cmd="../../pcompress -c zlib -l3 -s1m $feat ${tstf}"
|
2012-11-24 18:23:07 +00:00
|
|
|
echo "Running $cmd"
|
|
|
|
eval $cmd
|
|
|
|
if [ $? -ne 0 ]
|
|
|
|
then
|
2012-12-08 08:49:01 +00:00
|
|
|
echo "FATAL: Compression errored."
|
2013-01-02 18:57:18 +00:00
|
|
|
rm -f ${tstf}.pz ${tstf}.1
|
|
|
|
continue
|
2012-11-24 18:23:07 +00:00
|
|
|
fi
|
|
|
|
|
2013-01-02 17:26:21 +00:00
|
|
|
cp ${tstf}.pz ${tstf}.1.pz
|
2012-11-24 18:23:07 +00:00
|
|
|
echo "Corrupting file ..."
|
2013-01-02 17:26:21 +00:00
|
|
|
dd if=/dev/urandom conv=notrunc of=${tstf}.pz bs=4 seek=100 count=1
|
|
|
|
cmd="../../pcompress -d ${tstf}.pz ${tstf}.1"
|
2012-11-24 18:23:07 +00:00
|
|
|
eval $cmd
|
|
|
|
if [ $? -eq 0 ]
|
|
|
|
then
|
2012-12-08 08:49:01 +00:00
|
|
|
echo "FATAL: Decompression DID NOT ERROR where expected."
|
2013-01-02 17:26:21 +00:00
|
|
|
rm -f ${tstf}.pz
|
2012-11-25 09:42:45 +00:00
|
|
|
fi
|
|
|
|
|
2013-01-02 17:26:21 +00:00
|
|
|
rm -f ${tstf}.1
|
|
|
|
cp ${tstf}.1.pz ${tstf}.pz
|
2012-11-25 09:42:45 +00:00
|
|
|
echo "Corrupting file ..."
|
2013-01-02 17:26:21 +00:00
|
|
|
dd if=/dev/urandom conv=notrunc of=${tstf}.1.pz bs=4 seek=51 count=1
|
|
|
|
cmd="../../pcompress -d ${tstf}.1.pz ${tstf}.1"
|
2012-11-25 09:42:45 +00:00
|
|
|
eval $cmd
|
|
|
|
if [ $? -eq 0 ]
|
|
|
|
then
|
2012-12-08 08:49:01 +00:00
|
|
|
echo "FATAL: Decompression DID NOT ERROR where expected."
|
2013-01-02 17:26:21 +00:00
|
|
|
rm -f ${tstf}.pz
|
|
|
|
rm -f ${tstf}.1
|
|
|
|
rm -f ${tstf}.1.pz
|
2012-11-24 18:23:07 +00:00
|
|
|
fi
|
2012-11-26 14:51:03 +00:00
|
|
|
|
2013-01-02 17:26:21 +00:00
|
|
|
rm -f ${tstf}.1 ${tstf}.1.pz ${tstf}.pz
|
2012-11-26 14:51:03 +00:00
|
|
|
echo "plainpass" > /tmp/pwf
|
2013-03-05 15:37:54 +00:00
|
|
|
cmd="../../pcompress -c zlib -l3 -s1m -e SALSA20 -w /tmp/pwf $feat ${tstf}"
|
2012-11-26 14:51:03 +00:00
|
|
|
echo "Running $cmd"
|
|
|
|
eval $cmd
|
|
|
|
if [ $? -ne 0 ]
|
|
|
|
then
|
2012-12-08 08:49:01 +00:00
|
|
|
echo "FATAL: Compression errored."
|
2013-01-02 18:57:18 +00:00
|
|
|
rm -f ${tstf}.pz ${tstf}.1
|
|
|
|
continue
|
2012-11-26 14:51:03 +00:00
|
|
|
fi
|
|
|
|
pw=`cat /tmp/pwf`
|
|
|
|
if [ "$pw" = "plainpasswd" ]
|
|
|
|
then
|
2012-12-08 08:49:01 +00:00
|
|
|
echo "FATAL: Password file was not zeroed"
|
2013-01-02 18:57:18 +00:00
|
|
|
rm -f /tmp/pwf
|
2012-11-26 14:51:03 +00:00
|
|
|
fi
|
|
|
|
|
2013-01-02 17:26:21 +00:00
|
|
|
cp ${tstf}.pz ${tstf}.1.pz
|
2012-11-26 14:51:03 +00:00
|
|
|
echo "Corrupting file ..."
|
2013-01-02 17:26:21 +00:00
|
|
|
dd if=/dev/urandom conv=notrunc of=${tstf}.pz bs=4 seek=115 count=1
|
2012-11-26 14:51:03 +00:00
|
|
|
echo "plainpass" > /tmp/pwf
|
2013-01-02 17:26:21 +00:00
|
|
|
cmd="../../pcompress -d -w /tmp/pwf ${tstf}.pz ${tstf}.1"
|
2012-11-26 14:51:03 +00:00
|
|
|
eval $cmd
|
|
|
|
if [ $? -eq 0 ]
|
|
|
|
then
|
2012-12-08 08:49:01 +00:00
|
|
|
echo "FATAL: Decompression DID NOT ERROR where expected."
|
2013-01-02 17:26:21 +00:00
|
|
|
rm -f ${tstf}.pz
|
|
|
|
rm -f ${tstf}.1
|
2012-11-26 14:51:03 +00:00
|
|
|
fi
|
|
|
|
|
2013-01-02 17:26:21 +00:00
|
|
|
cp ${tstf}.1.pz ${tstf}.pz
|
|
|
|
rm -f ${tstf}.1
|
2012-11-26 14:51:03 +00:00
|
|
|
echo "Corrupting file header ..."
|
2013-01-02 17:26:21 +00:00
|
|
|
dd if=/dev/urandom conv=notrunc of=${tstf}.pz bs=4 seek=10 count=1
|
2012-11-26 14:51:03 +00:00
|
|
|
echo "plainpass" > /tmp/pwf
|
2013-01-02 17:26:21 +00:00
|
|
|
cmd="../../pcompress -d -w /tmp/pwf ${tstf}.pz ${tstf}.1"
|
2012-11-26 14:51:03 +00:00
|
|
|
eval $cmd
|
|
|
|
if [ $? -eq 0 ]
|
|
|
|
then
|
2012-12-08 08:49:01 +00:00
|
|
|
echo "FATAL: Decompression DID NOT ERROR where expected."
|
2012-11-26 14:51:03 +00:00
|
|
|
fi
|
2012-11-24 18:23:07 +00:00
|
|
|
done
|
|
|
|
|
2013-01-02 17:26:21 +00:00
|
|
|
rm -f ${tstf}.1.pz
|
|
|
|
rm -f ${tstf}.pz
|
|
|
|
rm -f ${tstf}.1
|
2012-11-26 14:51:03 +00:00
|
|
|
rm -f /tmp/pwf
|
2012-11-25 09:42:45 +00:00
|
|
|
|
2012-11-24 18:23:07 +00:00
|
|
|
echo "#################################################"
|
|
|
|
echo ""
|
|
|
|
|