summaryrefslogtreecommitdiffstats
path: root/testsuite/check.sh
diff options
context:
space:
mode:
authorDaniel Baumann <mail@daniel-baumann.ch>2016-05-20 06:48:30 +0000
committerDaniel Baumann <mail@daniel-baumann.ch>2016-05-20 06:49:00 +0000
commit4d364776fc785a234cebba08bc93cd06202103dd (patch)
tree90476b30bb959b780c85efc2ab546a5b5e970f2c /testsuite/check.sh
parentReleasing debian version 1.4-2. (diff)
downloadzutils-4d364776fc785a234cebba08bc93cd06202103dd.tar.xz
zutils-4d364776fc785a234cebba08bc93cd06202103dd.zip
Merging upstream version 1.5.
Signed-off-by: Daniel Baumann <mail@daniel-baumann.ch>
Diffstat (limited to 'testsuite/check.sh')
-rwxr-xr-xtestsuite/check.sh158
1 files changed, 85 insertions, 73 deletions
diff --git a/testsuite/check.sh b/testsuite/check.sh
index cbd53b3..70b49d3 100755
--- a/testsuite/check.sh
+++ b/testsuite/check.sh
@@ -1,6 +1,6 @@
#! /bin/sh
# check script for Zutils - Utilities dealing with compressed files
-# Copyright (C) 2009-2015 Antonio Diaz Diaz.
+# Copyright (C) 2009-2016 Antonio Diaz Diaz.
#
# This script is free software: you have unlimited permission
# to copy, distribute and modify it.
@@ -27,9 +27,16 @@ if [ ! -f "${ZUPDATE}" ] || [ ! -x "${ZUPDATE}" ] ; then
exit 1
fi
+if [ -e "${ZUPDATE}" ] 2> /dev/null ; then true
+else
+ echo "$0: a POSIX shell is required to run the tests"
+ echo "Try bash -c \"$0 $1 $2\""
+ exit 1
+fi
+
if [ -d tmp ] ; then rm -rf tmp ; fi
mkdir tmp
-cd "${objdir}"/tmp
+cd "${objdir}"/tmp || framework_failure
for i in ${compressors}; do
cat "${testdir}"/test.txt > in || framework_failure
@@ -75,6 +82,9 @@ printf .
"${ZCAT}" -N < in.lz > copy || fail=1
cmp in copy || fail=1
printf .
+"${ZCAT}" -N -O lz - - < in.lz > copy || fail=1
+cmp in copy || fail=1
+printf .
"${ZCAT}" -N --lz='lzip -q' < in.lz > copy || fail=1
cmp in copy || fail=1
printf .
@@ -87,25 +97,23 @@ printf .
"${ZCAT}" -N in in.gz in.bz2 in.lz -- -in- -in-.lz > copy || fail=1
cmp in6 copy || fail=1
printf .
-"${ZCAT}" -N --format= in.lz 2> /dev/null
-if [ $? = 1 ] ; then printf . ; else printf - ; fail=1 ; fi
-"${ZCAT}" -N --format=, in.lz 2> /dev/null
+"${ZCAT}" -Nq --format=, in.lz
if [ $? = 1 ] ; then printf . ; else printf - ; fail=1 ; fi
-"${ZCAT}" -N --format=,lz in.lz 2> /dev/null
+"${ZCAT}" -Nq --format=,lz in.lz
if [ $? = 1 ] ; then printf . ; else printf - ; fail=1 ; fi
-"${ZCAT}" -N --format=gz,,lz in.lz 2> /dev/null
+"${ZCAT}" -Nq --format=gz,,lz in.lz
if [ $? = 1 ] ; then printf . ; else printf - ; fail=1 ; fi
-"${ZCAT}" -N --format=lz,, in.lz 2> /dev/null
+"${ZCAT}" -Nq --format=lz,, in.lz
if [ $? = 1 ] ; then printf . ; else printf - ; fail=1 ; fi
-"${ZCAT}" -N --format=nc in.lz 2> /dev/null
+"${ZCAT}" -Nq --format=nc in.lz
if [ $? = 1 ] ; then printf . ; else printf - ; fail=1 ; fi
-"${ZCAT}" -N --lz='-lzip -q' in.lz 2> /dev/null
+"${ZCAT}" -Nq --lz='-lzip -q' in.lz
if [ $? = 1 ] ; then printf . ; else printf - ; fail=1 ; fi
"${ZCAT}" -N --force-format=gz in.bz2 2> /dev/null
if [ $? = 1 ] ; then printf . ; else printf - ; fail=1 ; fi
"${ZCAT}" -N --force-format=bz2 in.lz 2> /dev/null
if [ $? = 1 ] ; then printf . ; else printf - ; fail=1 ; fi
-"${ZCAT}" -N --force-format=lz in.gz 2> /dev/null
+"${ZCAT}" -Nq --force-format=lz in.gz
if [ $? = 1 ] ; then printf . ; else printf - ; fail=1 ; fi
"${ZCAT}" -N --bad-option 2> /dev/null
if [ $? = 1 ] ; then printf . ; else printf - ; fail=1 ; fi
@@ -130,16 +138,16 @@ for i in ${extensions}; do
printf .
done
-"${ZCMP}" -N in in6 2> /dev/null
+"${ZCMP}" -Nq in in6
if [ $? = 1 ] ; then printf . ; else printf - ; fail=1 ; fi
"${ZCMP}" -N -n 0 in in6 || fail=1
"${ZCMP}" -N -n 100 in in6 || fail=1
"${ZCMP}" -N -n 1000 in in6 || fail=1
"${ZCMP}" -N -n 10000 in in6 || fail=1
printf .
-"${ZCMP}" -N in.tar pin.tar > /dev/null
+"${ZCMP}" -Nq in.tar pin.tar
if [ $? = 1 ] ; then printf . ; else printf - ; fail=1 ; fi
-"${ZCMP}" -N -i 0,11 in.tar pin.tar 2> /dev/null
+"${ZCMP}" -Nq -i 0,11 in.tar pin.tar
if [ $? = 1 ] ; then printf . ; else printf - ; fail=1 ; fi
"${ZCMP}" -N -i 0,11 -n 0 in.tar pin.tar || fail=1
"${ZCMP}" -N -i 0,11 -n 100 in.tar pin.tar || fail=1
@@ -184,10 +192,10 @@ printf .
printf .
"${ZCMP}" -N -q --force-format=lz in.lz
if [ $? = 2 ] ; then printf . ; else printf - ; fail=1 ; fi
-"${ZCMP}" -N --force-format=lz in.gz in.lz 2> /dev/null
+"${ZCMP}" -Nq --force-format=lz in.gz in.lz
r=$?
if [ $r = 1 ] || [ $r = 2 ] ; then printf . ; else printf - ; fail=1 ; fi
-"${ZCMP}" -N -n -1 in in 2> /dev/null
+"${ZCMP}" -Nq -n -1 in in
if [ $? = 2 ] ; then printf . ; else printf - ; fail=1 ; fi
"${ZCMP}" -N --bad-option in in 2> /dev/null
if [ $? = 2 ] ; then printf . ; else printf - ; fail=1 ; fi
@@ -263,17 +271,17 @@ if [ $r = 1 ] || [ $r = 2 ] ; then printf . ; else printf - ; fail=1 ; fi
if [ $? = 2 ] ; then printf . ; else printf - ; fail=1 ; fi
mkdir tmp2
-cat in > tmp2/x || framework_failure
-cat in.lz > tmp2/x.lz || framework_failure
-"${ZDIFF}" -N --format=bz2 tmp2/x < /dev/null > /dev/null
+cat in > tmp2/a || framework_failure
+cat in.lz > tmp2/a.lz || framework_failure
+"${ZDIFF}" -N --format=bz2 tmp2/a < /dev/null > /dev/null
if [ $? = 1 ] ; then printf . ; else printf - ; fail=1 ; fi
-"${ZDIFF}" -N --format=gz tmp2/x < /dev/null > /dev/null
+"${ZDIFF}" -N --format=gz tmp2/a < /dev/null > /dev/null
if [ $? = 1 ] ; then printf . ; else printf - ; fail=1 ; fi
-"${ZDIFF}" -N --format=lz tmp2/x.lz < /dev/null > /dev/null
+"${ZDIFF}" -N --format=lz tmp2/a.lz < /dev/null > /dev/null
if [ $? = 1 ] ; then printf . ; else printf - ; fail=1 ; fi
-"${ZDIFF}" -N --format=lz tmp2/x < /dev/null
+"${ZDIFF}" -N --format=lz tmp2/a < /dev/null
if [ $? = 0 ] ; then printf . ; else printf - ; fail=1 ; fi
-"${ZDIFF}" -N --format=un tmp2/x.lz < /dev/null
+"${ZDIFF}" -N --format=un tmp2/a.lz < /dev/null
if [ $? = 0 ] ; then printf . ; else printf - ; fail=1 ; fi
rm -r tmp2 || framework_failure
@@ -303,7 +311,7 @@ for i in ${extensions}; do
if [ $? = 2 ] ; then printf . ; else printf - ; fail=1 ; fi
done
-"${ZGREP}" -N "GNU" pin.tar > /dev/null || fail=1
+"${ZGREP}" -N pin.tar -e "GNU" > /dev/null || fail=1
printf .
"${ZGREP}" -N "GNU" < pin.tar > /dev/null || fail=1
printf .
@@ -311,11 +319,13 @@ printf .
printf .
"${ZGREP}" -N "nx_pattern" -r . in > /dev/null
if [ $? != 0 ] ; then printf . ; else printf - ; fail=1 ; fi
-"${ZGREP}" -N "GNU" in > /dev/null || fail=1
+"${ZGREP}" -N -e "GNU" in > /dev/null || fail=1
printf .
"${ZGREP}" -N "GNU" < in > /dev/null || fail=1
printf .
-"${ZGREP}" -N "GNU" --lz='lzip -q' < in.lz > /dev/null || fail=1
+"${ZGREP}" -N -O lz "nx_pattern" - - < in.lz > /dev/null
+if [ $? != 0 ] ; then printf . ; else printf - ; fail=1 ; fi
+"${ZGREP}" -N -e "-free" --lz='lzip -q' < in.lz > /dev/null || fail=1
printf .
"${ZGREP}" -N -- "-free" -in- > /dev/null || fail=1
printf .
@@ -363,15 +373,17 @@ printf .
printf .
"${ZTEST}" -N < in.lz || fail=1
printf .
+"${ZTEST}" -N - in.gz - < in.lz || fail=1
+printf .
"${ZTEST}" -N --lz='lzip -q' < in.lz || fail=1
printf .
"${ZTEST}" -N -r . || fail=1
printf .
-"${ZTEST}" -N < in 2> /dev/null
+"${ZTEST}" -Nq < in
if [ $? = 2 ] ; then printf . ; else printf - ; fail=1 ; fi
dd if=in.lz bs=1000 count=1 2> /dev/null | "${ZTEST}" -N -q
if [ $? = 2 ] ; then printf . ; else printf - ; fail=1 ; fi
-"${ZTEST}" -N --force-format=lz in.bz2 2> /dev/null
+"${ZTEST}" -Nq --force-format=lz in.bz2
if [ $? = 2 ] ; then printf . ; else printf - ; fail=1 ; fi
"${ZTEST}" -N --lz='lzip --bad-option' in.lz 2> /dev/null
if [ $? = 1 ] ; then printf . ; else printf - ; fail=1 ; fi
@@ -381,86 +393,86 @@ if [ $? = 1 ] ; then printf . ; else printf - ; fail=1 ; fi
printf "\ntesting zupdate-%s..." "$2"
-cat in.bz2 > x.bz2 || framework_failure
-cat in.gz > x.gz || framework_failure
-"${ZUPDATE}" -N --bz2=bad_command x.bz2 2> /dev/null
+cat in.bz2 > a.bz2 || framework_failure
+cat in.gz > a.gz || framework_failure
+"${ZUPDATE}" -Nq --bz2=bad_command a.bz2
if [ $? = 1 ] ; then printf . ; else printf - ; fail=1 ; fi
-"${ZUPDATE}" -N --bz2='bzip2 --bad-option' x.bz2 > /dev/null 2>&1
+"${ZUPDATE}" -N --bz2='bzip2 --bad-option' a.bz2 > /dev/null 2>&1
if [ $? = 1 ] ; then printf . ; else printf - ; fail=1 ; fi
-"${ZUPDATE}" -N --gz=bad_command x.gz 2> /dev/null
+"${ZUPDATE}" -Nq --gz=bad_command a.gz
if [ $? = 1 ] ; then printf . ; else printf - ; fail=1 ; fi
-"${ZUPDATE}" -N --gz='gzip --bad-option' x.gz 2> /dev/null
+"${ZUPDATE}" -N --gz='gzip --bad-option' a.gz 2> /dev/null
if [ $? = 1 ] ; then printf . ; else printf - ; fail=1 ; fi
-"${ZUPDATE}" -N --lz=bad_command x.gz 2> /dev/null
+"${ZUPDATE}" -Nq --lz=bad_command a.gz
if [ $? = 1 ] ; then printf . ; else printf - ; fail=1 ; fi
-"${ZUPDATE}" -N --lz='lzip --bad-option' x.gz 2> /dev/null
+"${ZUPDATE}" -N --lz='lzip --bad-option' a.gz 2> /dev/null
if [ $? = 1 ] ; then printf . ; else printf - ; fail=1 ; fi
"${ZUPDATE}" -N --bad-option 2> /dev/null
if [ $? = 1 ] ; then printf . ; else printf - ; fail=1 ; fi
-cat in.lz in.lz > x.lz || framework_failure
-"${ZUPDATE}" -N -f x.bz2 x.gz 2> /dev/null
-if [ $? = 1 ] && [ -e x.bz2 ] && [ -e x.gz ] && [ -e x.lz ] ; then printf .
+cat in.lz in.lz > a.lz || framework_failure
+"${ZUPDATE}" -Nq -f a.bz2 a.gz
+if [ $? = 1 ] && [ -e a.bz2 ] && [ -e a.gz ] && [ -e a.lz ] ; then printf .
else printf - ; fail=1
fi
-rm -f x.lz || framework_failure
+rm -f a.lz || framework_failure
-"${ZUPDATE}" -N x.bz2
-if [ $? = 0 ] && [ ! -e x.bz2 ] && [ -e x.gz ] && [ -e x.lz ] ; then printf .
+"${ZUPDATE}" -N a.bz2
+if [ $? = 0 ] && [ ! -e a.bz2 ] && [ -e a.gz ] && [ -e a.lz ] ; then printf .
else printf - ; fail=1
fi
-rm -f x.lz || framework_failure
-"${ZUPDATE}" -N x.gz
-if [ $? = 0 ] && [ ! -e x.bz2 ] && [ ! -e x.gz ] && [ -e x.lz ] ; then printf .
+rm -f a.lz || framework_failure
+"${ZUPDATE}" -N a.gz
+if [ $? = 0 ] && [ ! -e a.bz2 ] && [ ! -e a.gz ] && [ -e a.lz ] ; then printf .
else printf - ; fail=1
fi
-rm -f x.lz || framework_failure
+rm -f a.lz || framework_failure
-cat in.bz2 > x.bz2 || framework_failure
-cat in.gz > x.gz || framework_failure
-"${ZUPDATE}" -N x.bz2 x.gz 2> /dev/null
-if [ $? = 1 ] && [ ! -e x.bz2 ] && [ -e x.gz ] && [ -e x.lz ] ; then printf .
+cat in.bz2 > a.bz2 || framework_failure
+cat in.gz > a.gz || framework_failure
+"${ZUPDATE}" -Nq a.bz2 a.gz
+if [ $? = 1 ] && [ ! -e a.bz2 ] && [ -e a.gz ] && [ -e a.lz ] ; then printf .
else printf - ; fail=1
fi
-rm -f x.lz || framework_failure
+rm -f a.lz || framework_failure
-cat in.bz2 > x.bz2 || framework_failure
-cat in.gz > x.gz || framework_failure
-"${ZUPDATE}" -N -f -k x.bz2 x.gz
-if [ $? = 0 ] && [ -e x.bz2 ] && [ -e x.gz ] && [ -e x.lz ] ; then printf .
+cat in.bz2 > a.bz2 || framework_failure
+cat in.gz > a.gz || framework_failure
+"${ZUPDATE}" -N -f -k a.bz2 a.gz
+if [ $? = 0 ] && [ -e a.bz2 ] && [ -e a.gz ] && [ -e a.lz ] ; then printf .
else printf - ; fail=1
fi
-rm -f x.lz || framework_failure
+rm -f a.lz || framework_failure
-cat in.bz2 > x.bz2 || framework_failure
-cat in.gz > x.gz || framework_failure
-"${ZUPDATE}" -N -f x.bz2 x.gz
-if [ $? = 0 ] && [ ! -e x.bz2 ] && [ ! -e x.gz ] &&
- [ ! -e x ] && [ -e x.lz ] ; then printf .
+cat in.bz2 > a.bz2 || framework_failure
+cat in.gz > a.gz || framework_failure
+"${ZUPDATE}" -N -f a.bz2 a.gz
+if [ $? = 0 ] && [ ! -e a.bz2 ] && [ ! -e a.gz ] &&
+ [ ! -e a ] && [ -e a.lz ] ; then printf .
else printf - ; fail=1
fi
-rm -f x.lz || framework_failure
+rm -f a.lz || framework_failure
-cat in.bz2 > x.bz2 || framework_failure
-"${ZUPDATE}" -N -1 -q x.bz2
-if [ $? = 0 ] && [ ! -e x.bz2 ] && [ -e x.lz ] ; then printf .
+cat in.bz2 > a.bz2 || framework_failure
+"${ZUPDATE}" -N -1 -q a.bz2
+if [ $? = 0 ] && [ ! -e a.bz2 ] && [ -e a.lz ] ; then printf .
else printf - ; fail=1
fi
-rm -f x.lz || framework_failure
+rm -f a.lz || framework_failure
mkdir tmp2
mkdir tmp2/tmp3
-cat in.bz2 > tmp2/tmp3/x.bz2 || framework_failure
-cat in.gz > tmp2/tmp3/x.gz || framework_failure
+cat in.bz2 > tmp2/tmp3/a.bz2 || framework_failure
+cat in.gz > tmp2/tmp3/a.gz || framework_failure
"${ZUPDATE}" -N -r --format=gz tmp2
-if [ $? = 0 ] && [ -e tmp2/tmp3/x.bz2 ] && [ ! -e tmp2/tmp3/x.gz ] &&
- [ -e tmp2/tmp3/x.lz ] ; then printf .
+if [ $? = 0 ] && [ -e tmp2/tmp3/a.bz2 ] && [ ! -e tmp2/tmp3/a.gz ] &&
+ [ -e tmp2/tmp3/a.lz ] ; then printf .
else printf - ; fail=1
fi
-rm -f tmp2/tmp3/x.lz || framework_failure
+rm -f tmp2/tmp3/a.lz || framework_failure
"${ZUPDATE}" -N -r --format=bz2 tmp2
-if [ $? = 0 ] && [ ! -e tmp2/tmp3/x.bz2 ] && [ ! -e tmp2/tmp3/x.gz ] &&
- [ -e tmp2/tmp3/x.lz ] ; then printf .
+if [ $? = 0 ] && [ ! -e tmp2/tmp3/a.bz2 ] && [ ! -e tmp2/tmp3/a.gz ] &&
+ [ -e tmp2/tmp3/a.lz ] ; then printf .
else printf - ; fail=1
fi
rm -r tmp2 || framework_failure