summaryrefslogtreecommitdiffstats
path: root/testsuite/check.sh
diff options
context:
space:
mode:
authorDaniel Baumann <mail@daniel-baumann.ch>2015-11-07 05:06:05 +0000
committerDaniel Baumann <mail@daniel-baumann.ch>2015-11-07 05:06:05 +0000
commita3c37bf807e8bcf3682987c2ab984053e7940a5c (patch)
treee739a4f5a6645fa64c4e66954a485bdf98d3bb61 /testsuite/check.sh
parentAdding upstream version 1.5~rc2. (diff)
downloadlunzip-a3c37bf807e8bcf3682987c2ab984053e7940a5c.tar.xz
lunzip-a3c37bf807e8bcf3682987c2ab984053e7940a5c.zip
Adding upstream version 1.5.upstream/1.5
Signed-off-by: Daniel Baumann <mail@daniel-baumann.ch>
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."