summaryrefslogtreecommitdiffstats
path: root/testsuite
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xtestsuite/check.sh40
1 files changed, 22 insertions, 18 deletions
diff --git a/testsuite/check.sh b/testsuite/check.sh
index 21199b7..76ab094 100755
--- a/testsuite/check.sh
+++ b/testsuite/check.sh
@@ -12,7 +12,7 @@ testdir=`cd "$1" ; pwd`
LZIP="${objdir}"/lunzip
framework_failure() { echo "failure in testing framework" ; exit 1 ; }
-if [ ! -x "${LZIP}" ] ; then
+if [ ! -f "${LZIP}" ] || [ ! -x "${LZIP}" ] ; then
echo "${LZIP}: cannot execute"
exit 1
fi
@@ -28,21 +28,24 @@ fail=0
printf "testing lunzip-%s..." "$2"
"${LZIP}" -cqu-1 "${in_lz}" > /dev/null
-if [ $? = 1 ] ; then printf . ; else fail=1 ; printf - ; fi
+if [ $? = 1 ] ; then printf . ; else printf - ; fail=1 ; fi
"${LZIP}" -cqu0 "${in_lz}" > /dev/null
-if [ $? = 1 ] ; then printf . ; else fail=1 ; printf - ; fi
+if [ $? = 1 ] ; then printf . ; else printf - ; fail=1 ; fi
"${LZIP}" -cqu4095 "${in_lz}" > /dev/null
-if [ $? = 1 ] ; then printf . ; else fail=1 ; printf - ; fi
+if [ $? = 1 ] ; then printf . ; else printf - ; fail=1 ; fi
"${LZIP}" -cqu513MiB "${in_lz}" > /dev/null
-if [ $? = 1 ] ; then printf . ; else fail=1 ; printf - ; fi
-"${LZIP}" -tq in
-if [ $? = 2 ] ; then printf . ; else fail=1 ; printf - ; fi
-"${LZIP}" -tq < in
-if [ $? = 2 ] ; then printf . ; else fail=1 ; printf - ; fi
+if [ $? = 1 ] ; then printf . ; else printf - ; fail=1 ; fi
+printf " in: Bad magic number (file not in lzip format).\n" > msg
+"${LZIP}" -t in 2> out
+if [ $? = 2 ] && cmp out msg ; then printf . ; else printf - ; fail=1 ; fi
+printf " (stdin): Bad magic number (file not in lzip format).\n" > msg
+"${LZIP}" -t < in 2> out
+if [ $? = 2 ] && cmp out msg ; then printf . ; else printf - ; fail=1 ; fi
+rm -f out msg
"${LZIP}" -cdq in
-if [ $? = 2 ] ; then printf . ; else fail=1 ; printf - ; fi
+if [ $? = 2 ] ; then printf . ; else printf - ; fail=1 ; fi
"${LZIP}" -cdq < in
-if [ $? = 2 ] ; then printf . ; else fail=1 ; printf - ; fi
+if [ $? = 2 ] ; then printf . ; else printf - ; fail=1 ; fi
dd if="${in_lz}" bs=1 count=6 2> /dev/null | "${LZIP}" -tq
if [ $? = 2 ] ; then printf . ; else printf - ; fail=1 ; fi
dd if="${in_lz}" bs=1 count=20 2> /dev/null | "${LZIP}" -tq
@@ -54,6 +57,7 @@ cmp in copy || fail=1
printf .
cat "${in_lz}" > copy.lz || framework_failure
+printf "to be overwritten" > copy || framework_failure
"${LZIP}" -df copy.lz || fail=1
cmp in copy || fail=1
printf .
@@ -63,13 +67,6 @@ printf "to be overwritten" > copy || framework_failure
cmp in copy || fail=1
printf .
-for i in 12 4096 4Ki 29 512KiB ; do
- printf "to be overwritten" > copy || framework_failure
- "${LZIP}" -df -u$i -o copy < "${in_lz}" || fail=1
- cmp in copy || fail=1
- printf .
-done
-
cat "${in_lz}" > anyothername || framework_failure
"${LZIP}" -d anyothername || fail=1
cmp in anyothername.out || fail=1
@@ -89,6 +86,13 @@ printf "to be overwritten" > copy2 || framework_failure
cmp in2 copy2 || fail=1
printf .
+for i in 12 4096 4Ki 29 512KiB ; do
+ printf "to be overwritten" > copy || framework_failure
+ "${LZIP}" -df -u$i -o copy < "${in_lz}" || fail=1
+ cmp in copy || fail=1
+ printf .
+done
+
echo
if [ ${fail} = 0 ] ; then
echo "tests completed successfully."