summaryrefslogtreecommitdiffstats
path: root/testsuite
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2018-02-13 06:58:53 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2018-02-13 06:59:21 +0000
commit7dd21df678aafaba8614ffe90188712f13b3bfc3 (patch)
treebbfc9eedb166e5e3e154b4ad28f4212bdb239d03 /testsuite
parentReleasing debian version 1.9-4. (diff)
downloadlunzip-7dd21df678aafaba8614ffe90188712f13b3bfc3.tar.xz
lunzip-7dd21df678aafaba8614ffe90188712f13b3bfc3.zip
Merging upstream version 1.10.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rwxr-xr-xtestsuite/check.sh43
1 files changed, 41 insertions, 2 deletions
diff --git a/testsuite/check.sh b/testsuite/check.sh
index 334cb71..728c7c6 100755
--- a/testsuite/check.sh
+++ b/testsuite/check.sh
@@ -1,6 +1,6 @@
#! /bin/sh
# check script for Lunzip - Decompressor for the lzip format
-# Copyright (C) 2010-2017 Antonio Diaz Diaz.
+# Copyright (C) 2010-2018 Antonio Diaz Diaz.
#
# This script is free software: you have unlimited permission
# to copy, distribute and modify it.
@@ -51,6 +51,8 @@ rm -f uin.lz
[ $? = 2 ] || test_failed $LINENO
"${LZIP}" -cdq < in
[ $? = 2 ] || test_failed $LINENO
+"${LZIP}" -dq -o in < "${in_lz}"
+[ $? = 1 ] || test_failed $LINENO
# these are for code coverage
"${LZIP}" -lt "${in_lz}" 2> /dev/null
[ $? = 1 ] || test_failed $LINENO
@@ -169,6 +171,41 @@ done
printf "\ntesting bad input..."
+headers='LZIp LZiP LZip LzIP LzIp LziP lZIP lZIp lZiP lzIP'
+body='\001\014\000\203\377\373\377\377\300\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000$\000\000\000\000\000\000\000'
+cat "${in_lz}" > in0.lz
+printf "LZIP${body}" >> in0.lz
+if "${LZIP}" -tq in0.lz ; then
+ for header in ${headers} ; do
+ printf "${header}${body}" > in0.lz # first member
+ "${LZIP}" -lq in0.lz
+ [ $? = 2 ] || test_failed $LINENO ${header}
+ "${LZIP}" -tq in0.lz
+ [ $? = 2 ] || test_failed $LINENO ${header}
+ "${LZIP}" -lq --loose-trailing in0.lz
+ [ $? = 2 ] || test_failed $LINENO ${header}
+ "${LZIP}" -tq --loose-trailing in0.lz
+ [ $? = 2 ] || test_failed $LINENO ${header}
+ cat "${in_lz}" > in0.lz
+ printf "${header}${body}" >> in0.lz # trailing data
+ "${LZIP}" -lq in0.lz
+ [ $? = 2 ] || test_failed $LINENO ${header}
+ "${LZIP}" -tq in0.lz
+ [ $? = 2 ] || test_failed $LINENO ${header}
+ "${LZIP}" -lq --loose-trailing in0.lz
+ [ $? = 0 ] || test_failed $LINENO ${header}
+ "${LZIP}" -t --loose-trailing in0.lz
+ [ $? = 0 ] || test_failed $LINENO ${header}
+ "${LZIP}" -lq --loose-trailing --trailing-error in0.lz
+ [ $? = 2 ] || test_failed $LINENO ${header}
+ "${LZIP}" -tq --loose-trailing --trailing-error in0.lz
+ [ $? = 2 ] || test_failed $LINENO ${header}
+ done
+else
+ printf "\nwarning: skipping header test: 'printf' does not work on your system."
+fi
+rm -f in0.lz
+
cat "${in_lz}" "${in_lz}" "${in_lz}" > in3.lz || framework_failure
if dd if=in3.lz of=trunc.lz bs=14752 count=1 2> /dev/null &&
[ -e trunc.lz ] && cmp in2.lz trunc.lz > /dev/null 2>&1 ; then
@@ -176,7 +213,7 @@ if dd if=in3.lz of=trunc.lz bs=14752 count=1 2> /dev/null &&
dd if=in3.lz of=trunc.lz bs=$i count=1 2> /dev/null
"${LZIP}" -lq trunc.lz
[ $? = 2 ] || test_failed $LINENO $i
- "${LZIP}" -t trunc.lz 2> /dev/null
+ "${LZIP}" -tq trunc.lz
[ $? = 2 ] || test_failed $LINENO $i
"${LZIP}" -tq < trunc.lz
[ $? = 2 ] || test_failed $LINENO $i
@@ -188,6 +225,7 @@ if dd if=in3.lz of=trunc.lz bs=14752 count=1 2> /dev/null &&
else
printf "\nwarning: skipping truncation test: 'dd' does not work on your system."
fi
+rm -f in3.lz trunc.lz
cat "${in_lz}" > ingin.lz || framework_failure
printf "g" >> ingin.lz || framework_failure
@@ -200,6 +238,7 @@ cmp in copy || test_failed $LINENO
"${LZIP}" -t < ingin.lz || test_failed $LINENO
"${LZIP}" -d < ingin.lz > copy || test_failed $LINENO
cmp in copy || test_failed $LINENO
+rm -f ingin.lz
echo
if [ ${fail} = 0 ] ; then