summaryrefslogtreecommitdiffstats
path: root/testsuite/check.sh
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xtestsuite/check.sh141
1 files changed, 97 insertions, 44 deletions
diff --git a/testsuite/check.sh b/testsuite/check.sh
index c2d67f4..cbd53b3 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-2014 Antonio Diaz Diaz.
+# Copyright (C) 2009-2015 Antonio Diaz Diaz.
#
# This script is free software: you have unlimited permission
# to copy, distribute and modify it.
@@ -52,7 +52,10 @@ for i in ${extensions}; do
"${ZCAT}" -N in.$i > copy || fail=1
cmp in copy || fail=1
printf .
- "${ZCAT}" -N --format=$i in.$i > copy || fail=1
+ "${ZCAT}" -N --format=un in.$i > copy || fail=1
+ cmp in copy || fail=1
+ printf .
+ "${ZCAT}" -N --force-format=$i in.$i > copy || fail=1
cmp in copy || fail=1
printf .
"${ZCAT}" -N in.$i | dd bs=1000 count=1 > copy 2> /dev/null || fail=1
@@ -81,14 +84,28 @@ printf .
"${ZCAT}" -N lz_only > copy || fail=1
cmp in copy || fail=1
printf .
-"${ZCAT}" -N in in.gz in.bz2 in.lz -- -in- -in-.lz > copy6 || fail=1
-cmp in6 copy6 || fail=1
+"${ZCAT}" -N in in.gz in.bz2 in.lz -- -in- -in-.lz > copy || fail=1
+cmp in6 copy || fail=1
printf .
-"${ZCAT}" -N --format=gz in.bz2 2> /dev/null
+"${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
+if [ $? = 1 ] ; then printf . ; else printf - ; fail=1 ; fi
+"${ZCAT}" -N --format=,lz in.lz 2> /dev/null
+if [ $? = 1 ] ; then printf . ; else printf - ; fail=1 ; fi
+"${ZCAT}" -N --format=gz,,lz in.lz 2> /dev/null
+if [ $? = 1 ] ; then printf . ; else printf - ; fail=1 ; fi
+"${ZCAT}" -N --format=lz,, in.lz 2> /dev/null
+if [ $? = 1 ] ; then printf . ; else printf - ; fail=1 ; fi
+"${ZCAT}" -N --format=nc in.lz 2> /dev/null
+if [ $? = 1 ] ; then printf . ; else printf - ; fail=1 ; fi
+"${ZCAT}" -N --lz='-lzip -q' in.lz 2> /dev/null
+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 --format=bz2 in.lz 2> /dev/null
+"${ZCAT}" -N --force-format=bz2 in.lz 2> /dev/null
if [ $? = 1 ] ; then printf . ; else printf - ; fail=1 ; fi
-"${ZCAT}" -N --format=lz in.gz 2> /dev/null
+"${ZCAT}" -N --force-format=lz in.gz 2> /dev/null
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
@@ -103,13 +120,13 @@ for i in ${extensions}; do
printf .
"${ZCMP}" -N -i 100 -n 500 in6 in.$i || fail=1
printf .
- "${ZCMP}" -N in in.$i --format=,$i || fail=1
+ "${ZCMP}" -N in in.$i --force-format=,$i || fail=1
printf .
"${ZCMP}" -N in.$i in || fail=1
printf .
"${ZCMP}" -N -i 1000:1000 -n 50 in.$i in6 || fail=1
printf .
- "${ZCMP}" -N in.$i in --format=$i || fail=1
+ "${ZCMP}" -N in.$i in --force-format=$i || fail=1
printf .
done
@@ -165,11 +182,11 @@ printf .
printf .
"${ZCMP}" -N - in < in.lz || fail=1
printf .
-"${ZCMP}" -N -q --format=lz in.lz
+"${ZCMP}" -N -q --force-format=lz in.lz
if [ $? = 2 ] ; then printf . ; else printf - ; fail=1 ; fi
-"${ZCMP}" -N --format=lz in.gz in.lz 2> /dev/null
-res=$?
-if [ ${res} = 1 ] || [ ${res} = 2 ] ; then printf . ; else printf - ; fail=1 ; fi
+"${ZCMP}" -N --force-format=lz in.gz in.lz 2> /dev/null
+r=$?
+if [ $r = 1 ] || [ $r = 2 ] ; then printf . ; else printf - ; fail=1 ; fi
"${ZCMP}" -N -n -1 in in 2> /dev/null
if [ $? = 2 ] ; then printf . ; else printf - ; fail=1 ; fi
"${ZCMP}" -N --bad-option in in 2> /dev/null
@@ -183,11 +200,11 @@ for i in ${extensions}; do
printf .
"${ZDIFF}" -N in in.$i > /dev/null || fail=1
printf .
- "${ZDIFF}" -N --format=,$i in in.$i > /dev/null || fail=1
+ "${ZDIFF}" -N --force-format=,$i in in.$i > /dev/null || fail=1
printf .
"${ZDIFF}" -N in.$i in > /dev/null || fail=1
printf .
- "${ZDIFF}" -N --format=$i, in.$i in > /dev/null || fail=1
+ "${ZDIFF}" -N --force-format=$i, in.$i in > /dev/null || fail=1
printf .
done
@@ -199,7 +216,11 @@ if [ $? != 0 ] ; then printf . ; else printf - ; fail=1 ; fi
printf .
"${ZDIFF}" -N in in || fail=1
printf .
-"${ZDIFF}" -N in > /dev/null || fail=1
+"${ZDIFF}" -N in || fail=1
+printf .
+"${ZDIFF}" -N --format=gz,bz2 in || fail=1
+printf .
+"${ZDIFF}" -N --format=gz in || fail=1
printf .
"${ZDIFF}" -N in.lz in.gz > /dev/null || fail=1
printf .
@@ -231,25 +252,44 @@ printf .
printf .
"${ZDIFF}" -N - in < in.lz > /dev/null || fail=1
printf .
-"${ZDIFF}" -N -q --format=bz2 in.bz2 2> /dev/null
+"${ZDIFF}" -N --bz2='-bzip2' in.bz2 2> /dev/null
+if [ $? = 2 ] ; then printf . ; else printf - ; fail=1 ; fi
+"${ZDIFF}" -N -q --force-format=bz2 in.bz2 2> /dev/null
if [ $? = 2 ] ; then printf . ; else printf - ; fail=1 ; fi
-"${ZDIFF}" -N -q --format=,lz in.lz in.bz2 > /dev/null 2>&1
-res=$?
-if [ ${res} = 1 ] || [ ${res} = 2 ] ; then printf . ; else printf - ; fail=1 ; fi
+"${ZDIFF}" -N -q --force-format=,lz in.lz in.bz2 > /dev/null 2>&1
+r=$?
+if [ $r = 1 ] || [ $r = 2 ] ; then printf . ; else printf - ; fail=1 ; fi
"${ZDIFF}" -N --bad-option 2> /dev/null
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
+if [ $? = 1 ] ; then printf . ; else printf - ; fail=1 ; fi
+"${ZDIFF}" -N --format=gz tmp2/x < /dev/null > /dev/null
+if [ $? = 1 ] ; then printf . ; else printf - ; fail=1 ; fi
+"${ZDIFF}" -N --format=lz tmp2/x.lz < /dev/null > /dev/null
+if [ $? = 1 ] ; then printf . ; else printf - ; fail=1 ; fi
+"${ZDIFF}" -N --format=lz tmp2/x < /dev/null
+if [ $? = 0 ] ; then printf . ; else printf - ; fail=1 ; fi
+"${ZDIFF}" -N --format=un tmp2/x.lz < /dev/null
+if [ $? = 0 ] ; then printf . ; else printf - ; fail=1 ; fi
+rm -r tmp2 || framework_failure
+
printf "\ntesting zgrep-%s..." "$2"
for i in ${extensions}; do
"${ZGREP}" -N "GNU" in.$i > /dev/null || fail=1
printf .
+ "${ZGREP}" -N "GNU" < in.$i > /dev/null || fail=1
+ printf .
"${ZGREP}" -N -l "GNU" in.$i > /dev/null || fail=1
printf .
"${ZGREP}" -N -L "GNU" in.$i || fail=1
printf .
- "${ZGREP}" -N --format=$i "GNU" in.$i > /dev/null || fail=1
+ "${ZGREP}" -N --force-format=$i "GNU" in.$i > /dev/null || fail=1
printf .
"${ZGREP}" -N -v "nx_pattern" in.$i > /dev/null || fail=1
printf .
@@ -259,34 +299,28 @@ for i in ${extensions}; do
if [ $? != 0 ] ; then printf . ; else printf - ; fail=1 ; fi
"${ZGREP}" -N -L "nx_pattern" in.$i > /dev/null
if [ $? != 0 ] ; then printf . ; else printf - ; fail=1 ; fi
- "${ZGREP}" -N --format=$i "GNU" in 2> /dev/null
+ "${ZGREP}" -N --force-format=$i "GNU" in 2> /dev/null
if [ $? = 2 ] ; then printf . ; else printf - ; fail=1 ; fi
done
-"${ZGREP}" -N "GNU" < pin.tar > /dev/null || fail=1
-printf .
"${ZGREP}" -N "GNU" pin.tar > /dev/null || fail=1
printf .
+"${ZGREP}" -N "GNU" < pin.tar > /dev/null || fail=1
+printf .
"${ZGREP}" -N -r "GNU" . > /dev/null || fail=1
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
-printf .
-"${ZGREP}" -N "GNU" < in.gz > /dev/null || fail=1
-printf .
-"${ZGREP}" -N "GNU" < in.bz2 > /dev/null || fail=1
+"${ZGREP}" -N "GNU" in > /dev/null || fail=1
printf .
-"${ZGREP}" -N "GNU" < in.lz > /dev/null || fail=1
+"${ZGREP}" -N "GNU" < in > /dev/null || fail=1
printf .
"${ZGREP}" -N "GNU" --lz='lzip -q' < in.lz > /dev/null || fail=1
printf .
-"${ZGREP}" -N "GNU" in > /dev/null || fail=1
-printf .
-"${ZGREP}" -N "GNU" -- -in- > /dev/null || fail=1
-printf .
-"${ZGREP}" -N "GNU" -- -in-.lz > /dev/null || fail=1
+"${ZGREP}" -N -- "-free" -in- > /dev/null || fail=1
printf .
+"${ZGREP}" -N -q -- "-free" nx_file -in-.lz
+if [ $? = 0 ] ; then printf . ; else printf - ; fail=1 ; fi
"${ZGREP}" -N "GNU" in in.gz in.bz2 in.lz -- -in- > /dev/null || fail=1
printf .
"${ZGREP}" -N -l "GNU" in in.gz in.bz2 in.lz -- -in- > /dev/null || fail=1
@@ -301,6 +335,8 @@ if [ $? != 0 ] ; then printf . ; else printf - ; fail=1 ; fi
if [ $? = 2 ] ; then printf . ; else printf - ; fail=1 ; fi
"${ZGREP}" -N "GNU" -s nx_file
if [ $? = 2 ] ; then printf . ; else printf - ; fail=1 ; fi
+"${ZGREP}" -N -q
+if [ $? = 2 ] ; then printf . ; else printf - ; fail=1 ; fi
"${ZEGREP}" -N "GNU" in > /dev/null || fail=1
printf .
@@ -311,11 +347,11 @@ printf .
printf "\ntesting ztest-%s..." "$2"
for i in ${extensions}; do
- "${ZTEST}" -N --format=$i < in.$i || fail=1
+ "${ZTEST}" -N --force-format=$i < in.$i || fail=1
printf .
- "${ZTEST}" -N --format=$i < in 2> /dev/null
+ "${ZTEST}" -N --force-format=$i < in 2> /dev/null
if [ $? = 2 ] ; then printf . ; else printf - ; fail=1 ; fi
- "${ZTEST}" -N --format=$i in 2> /dev/null
+ "${ZTEST}" -N --force-format=$i in 2> /dev/null
if [ $? = 2 ] ; then printf . ; else printf - ; fail=1 ; fi
done
@@ -335,7 +371,7 @@ printf .
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 --format=lz in.bz2 2> /dev/null
+"${ZTEST}" -N --force-format=lz in.bz2 2> /dev/null
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
@@ -369,12 +405,12 @@ else printf - ; fail=1
fi
rm -f x.lz || framework_failure
-"${ZUPDATE}" -N x.bz2 2> /dev/null
+"${ZUPDATE}" -N x.bz2
if [ $? = 0 ] && [ ! -e x.bz2 ] && [ -e x.gz ] && [ -e x.lz ] ; then printf .
else printf - ; fail=1
fi
rm -f x.lz || framework_failure
-"${ZUPDATE}" -N x.gz 2> /dev/null
+"${ZUPDATE}" -N x.gz
if [ $? = 0 ] && [ ! -e x.bz2 ] && [ ! -e x.gz ] && [ -e x.lz ] ; then printf .
else printf - ; fail=1
fi
@@ -390,7 +426,7 @@ rm -f x.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 2> /dev/null
+"${ZUPDATE}" -N -f -k x.bz2 x.gz
if [ $? = 0 ] && [ -e x.bz2 ] && [ -e x.gz ] && [ -e x.lz ] ; then printf .
else printf - ; fail=1
fi
@@ -398,7 +434,7 @@ rm -f x.lz || framework_failure
cat in.bz2 > x.bz2 || framework_failure
cat in.gz > x.gz || framework_failure
-"${ZUPDATE}" -N -f x.bz2 x.gz 2> /dev/null
+"${ZUPDATE}" -N -f x.bz2 x.gz
if [ $? = 0 ] && [ ! -e x.bz2 ] && [ ! -e x.gz ] &&
[ ! -e x ] && [ -e x.lz ] ; then printf .
else printf - ; fail=1
@@ -406,12 +442,29 @@ fi
rm -f x.lz || framework_failure
cat in.bz2 > x.bz2 || framework_failure
-"${ZUPDATE}" -N -6 -q x.bz2
+"${ZUPDATE}" -N -1 -q x.bz2
if [ $? = 0 ] && [ ! -e x.bz2 ] && [ -e x.lz ] ; then printf .
else printf - ; fail=1
fi
rm -f x.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
+"${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 .
+else printf - ; fail=1
+fi
+rm -f tmp2/tmp3/x.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 .
+else printf - ; fail=1
+fi
+rm -r tmp2 || framework_failure
+
echo
if [ ${fail} = 0 ] ; then
echo "tests completed successfully."