summaryrefslogtreecommitdiffstats
path: root/testsuite
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xtestsuite/check.sh110
1 files changed, 98 insertions, 12 deletions
diff --git a/testsuite/check.sh b/testsuite/check.sh
index 61058ab..85217fc 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, 2010, 2011 Antonio Diaz Diaz.
+# Copyright (C) 2009, 2010, 2011, 2012, 2013 Antonio Diaz Diaz.
#
# This script is free software: you have unlimited permission
# to copy, distribute and modify it.
@@ -18,8 +18,8 @@ ZFGREP="${objdir}"/zfgrep
ZTEST="${objdir}"/ztest
compressors="bzip2 gzip lzip"
extensions="bz2 gz lz"
-framework_failure() { echo "failure in testing framework" ; exit 1 ; }
compressor_needed() { echo "${compressors} are needed to run tests" ; exit 1 ; }
+framework_failure() { echo "failure in testing framework" ; exit 1 ; }
if [ ! -x "${ZCAT}" ] ; then
echo "${ZCAT}: cannot execute"
@@ -35,7 +35,6 @@ for i in ${compressors}; do
$i in || compressor_needed
done
-printf "testing zutils-%s..." "$2"
cat "${testdir}"/test.txt > in || framework_failure
cat "${testdir}"/test.txt.tar > in.tar || framework_failure
printf "01234567890" > pin.tar || framework_failure
@@ -46,12 +45,20 @@ cat in.lz > lz_only.lz || framework_failure
cat in in in in in in > in6 || framework_failure
fail=0
+printf "testing zutils-%s..." "$2"
printf "\ntesting zcat-%s..." "$2"
+
for i in ${extensions}; do
"${ZCAT}" in.$i > copy || fail=1
cmp in copy || fail=1
printf .
+ "${ZCAT}" --format=$i in.$i > copy || fail=1
+ cmp in copy || fail=1
+ printf .
+ "${ZCAT}" in.$i | dd bs=1000 count=1 > copy 2> /dev/null || fail=1
+ dd if=in bs=1000 count=1 2> /dev/null | cmp - copy || fail=1
+ printf .
done
"${ZCAT}" < in > copy || fail=1
@@ -75,20 +82,51 @@ printf .
"${ZCAT}" in in.gz in.bz2 in.lz -- -in- -in-.lz > copy6 || fail=1
cmp in6 copy6 || fail=1
printf .
+"${ZCAT}" --format=gz in.bz2 2> /dev/null
+if [ $? != 1 ] ; then fail=1 ; printf - ; else printf . ; fi
+"${ZCAT}" --format=bz2 in.lz 2> /dev/null
+if [ $? != 1 ] ; then fail=1 ; printf - ; else printf . ; fi
+"${ZCAT}" --format=lz in.gz 2> /dev/null
+if [ $? != 1 ] ; then fail=1 ; printf - ; else printf . ; fi
+"${ZCAT}" --bad-option 2> /dev/null
+if [ $? != 1 ] ; then fail=1 ; printf - ; else printf . ; fi
printf "\ntesting zcmp-%s..." "$2"
+
for i in ${extensions}; do
"${ZCMP}" in.$i || fail=1
printf .
"${ZCMP}" in in.$i || fail=1
printf .
+ "${ZCMP}" -i 100 -n 500 in6 in.$i || fail=1
+ printf .
+ "${ZCMP}" in in.$i --format=,$i || fail=1
+ printf .
"${ZCMP}" in.$i in || fail=1
printf .
+ "${ZCMP}" -i 1000:1000 -n 50 in.$i in6 || fail=1
+ printf .
+ "${ZCMP}" in.$i in --format=$i || fail=1
+ printf .
done
+"${ZCMP}" in in6 2> /dev/null
+if [ $? != 1 ] ; then fail=1 ; printf - ; else printf . ; fi
+"${ZCMP}" -n 0 in in6 || fail=1
+"${ZCMP}" -n 100 in in6 || fail=1
+"${ZCMP}" -n 1000 in in6 || fail=1
+"${ZCMP}" -n 10000 in in6 || fail=1
+printf .
"${ZCMP}" in.tar pin.tar > /dev/null
if [ $? != 1 ] ; then fail=1 ; printf - ; else printf . ; fi
+"${ZCMP}" -i 0,11 in.tar pin.tar 2> /dev/null
+if [ $? != 1 ] ; then fail=1 ; printf - ; else printf . ; fi
+"${ZCMP}" -i 0,11 -n 0 in.tar pin.tar || fail=1
+"${ZCMP}" -i 0,11 -n 100 in.tar pin.tar || fail=1
+"${ZCMP}" -i 0,11 -n 1000 in.tar pin.tar || fail=1
+"${ZCMP}" -i 0,11 -n 10000 in.tar pin.tar || fail=1
+printf .
"${ZCMP}" - || fail=1
printf .
"${ZCMP}" in in || fail=1
@@ -123,20 +161,35 @@ printf .
printf .
"${ZCMP}" - in < in.lz || fail=1
printf .
+"${ZCMP}" -q --format=lz in.lz
+if [ $? != 2 ] ; then fail=1 ; printf - ; else printf . ; fi
+"${ZCMP}" --format=lz in.gz in.lz 2> /dev/null
+if [ $? != 2 ] ; then fail=1 ; printf - ; else printf . ; fi
+"${ZCMP}" -n -1 in in 2> /dev/null
+if [ $? != 2 ] ; then fail=1 ; printf - ; else printf . ; fi
+"${ZCMP}" --bad-option in in 2> /dev/null
+if [ $? != 2 ] ; then fail=1 ; printf - ; else printf . ; fi
printf "\ntesting zdiff-%s..." "$2"
+
for i in ${extensions}; do
"${ZDIFF}" in.$i || fail=1
printf .
"${ZDIFF}" in in.$i || fail=1
printf .
+ "${ZDIFF}" --format=,$i in in.$i || fail=1
+ printf .
"${ZDIFF}" in.$i in || fail=1
printf .
+ "${ZDIFF}" --format=$i, in.$i in || fail=1
+ printf .
done
-#"${ZDIFF}" in.tar pin.tar > /dev/null
-#if [ $? != 1 ] ; then fail=1 ; printf - ; else printf . ; fi
+"${ZDIFF}" in in6 > /dev/null
+if [ $? = 0 ] ; then fail=1 ; printf - ; else printf . ; fi
+"${ZDIFF}" in.tar pin.tar > /dev/null
+if [ $? = 0 ] ; then fail=1 ; printf - ; else printf . ; fi
"${ZDIFF}" - || fail=1
printf .
"${ZDIFF}" in in || fail=1
@@ -171,13 +224,27 @@ printf .
printf .
"${ZDIFF}" - in < in.lz || fail=1
printf .
+"${ZDIFF}" -q --format=bz2 in.bz2 2> /dev/null
+if [ $? != 2 ] ; then fail=1 ; printf - ; else printf . ; fi
+"${ZDIFF}" -q --format=,lz in.lz in.bz2 > /dev/null 2> /dev/null
+if [ $? != 2 ] ; then fail=1 ; printf - ; else printf . ; fi
+"${ZDIFF}" --bad-option 2> /dev/null
+if [ $? != 2 ] ; then fail=1 ; printf - ; else printf . ; fi
printf "\ntesting zgrep-%s..." "$2"
+
for i in ${extensions}; do
"${ZGREP}" "GNU" in.$i > /dev/null || fail=1
- "${ZGREP}" "nx_pattern" in.$i > /dev/null && fail=1
printf .
+ "${ZGREP}" --format=$i "GNU" in.$i > /dev/null || fail=1
+ printf .
+ "${ZGREP}" -v "nx_pattern" in.$i > /dev/null || fail=1
+ printf .
+ "${ZGREP}" "nx_pattern" in.$i > /dev/null
+ if [ $? = 0 ] ; then fail=1 ; printf - ; else printf . ; fi
+ "${ZGREP}" --format=$i "GNU" in 2> /dev/null
+ if [ $? != 2 ] ; then fail=1 ; printf - ; else printf . ; fi
done
"${ZGREP}" "GNU" < pin.tar > /dev/null || fail=1
@@ -186,8 +253,8 @@ printf .
printf .
"${ZGREP}" -r "GNU" . > /dev/null || fail=1
printf .
-"${ZGREP}" "nx_pattern" -r . in > /dev/null && fail=1
-printf .
+"${ZGREP}" "nx_pattern" -r . in > /dev/null
+if [ $? = 0 ] ; then fail=1 ; printf - ; else printf . ; fi
"${ZGREP}" "GNU" < in > /dev/null || fail=1
printf .
"${ZGREP}" "GNU" < in.gz > /dev/null || fail=1
@@ -204,6 +271,11 @@ printf .
printf .
"${ZGREP}" "GNU" in in.gz in.bz2 in.lz -- -in- > /dev/null || fail=1
printf .
+"${ZGREP}" -l "GNU" in in.gz in.bz2 in.lz -- -in- > /dev/null || fail=1
+printf .
+"${ZGREP}" --bad-option 2> /dev/null
+if [ $? != 2 ] ; then fail=1 ; printf - ; else printf . ; fi
+
"${ZEGREP}" "GNU" in > /dev/null || fail=1
printf .
"${ZFGREP}" "GNU" in > /dev/null || fail=1
@@ -211,6 +283,16 @@ printf .
printf "\ntesting ztest-%s..." "$2"
+
+for i in ${extensions}; do
+ "${ZTEST}" --format=$i < in.$i || fail=1
+ printf .
+ "${ZTEST}" --format=$i < in 2> /dev/null
+ if [ $? != 2 ] ; then fail=1 ; printf - ; else printf . ; fi
+ "${ZTEST}" --format=$i in 2> /dev/null
+ if [ $? != 2 ] ; then fail=1 ; printf - ; else printf . ; fi
+done
+
"${ZTEST}" in in.gz in.bz2 in.lz -- -in- || fail=1
printf .
"${ZTEST}" < in.gz || fail=1
@@ -221,10 +303,14 @@ printf .
printf .
"${ZTEST}" -r . || fail=1
printf .
-"${ZTEST}" < in 2>/dev/null
-if [ $? = 0 ] ; then fail=1 ; printf - ; else printf . ; fi
-printf "LZIPvs0000000000000000000000" | "${ZTEST}" 2>/dev/null
-if [ $? = 0 ] ; then fail=1 ; printf - ; else printf . ; fi
+"${ZTEST}" < in 2> /dev/null
+if [ $? != 2 ] ; then fail=1 ; printf - ; else printf . ; fi
+dd if=in.lz bs=1000 count=1 2> /dev/null | "${ZTEST}" -q
+if [ $? != 2 ] ; then fail=1 ; printf - ; else printf . ; fi
+"${ZTEST}" --format=lz in.bz2 2> /dev/null
+if [ $? != 2 ] ; then fail=1 ; printf - ; else printf . ; fi
+"${ZTEST}" --bad-option 2> /dev/null
+if [ $? != 1 ] ; then fail=1 ; printf - ; else printf . ; fi
echo
if [ ${fail} = 0 ] ; then