summaryrefslogtreecommitdiffstats
path: root/testsuite
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-01-23 05:54:13 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-01-23 05:54:13 +0000
commite50d8921980602c5569b31dd9d12a24b43a196e8 (patch)
treed7240fd2cd209b129f72dac13832b6cfce13dc76 /testsuite
parentReleasing debian version 1.12-3. (diff)
downloadzutils-e50d8921980602c5569b31dd9d12a24b43a196e8.tar.xz
zutils-e50d8921980602c5569b31dd9d12a24b43a196e8.zip
Merging upstream version 1.13~rc1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testsuite')
-rwxr-xr-xtestsuite/check.sh110
1 files changed, 70 insertions, 40 deletions
diff --git a/testsuite/check.sh b/testsuite/check.sh
index 833eab7..dc6ae2c 100755
--- a/testsuite/check.sh
+++ b/testsuite/check.sh
@@ -43,6 +43,8 @@ for i in ${compressors}; do
$i in || compressor_needed
printf "Hello World!\n" > hello || framework_failure
$i hello || compressor_needed
+ touch zero || framework_failure
+ $i zero || compressor_needed
done
cat "${testdir}"/test.txt > in || framework_failure
@@ -56,24 +58,34 @@ cat in in in in in in > in6 || framework_failure
bad0_lz="${testdir}"/zero_bad_crc.lz
bad0_gz="${testdir}"/zero_bad_crc.gz
bad1_lz="${testdir}"/test_bad_crc.lz
-touch empty empty.bz2 empty.gz empty.lz
+touch empty empty.bz2 empty.gz empty.lz || framework_failure
fail=0
test_failed() { fail=1 ; printf " $1" ; [ -z "$2" ] || printf "($2)" ; }
printf "testing zcat-%s..." "$2"
for i in ${extensions}; do
- "${ZCAT}" -N in.$i > copy || test_failed $LINENO $i
- cmp in copy || test_failed $LINENO $i
- "${ZCAT}" -N empty.$i in.$i > copy || test_failed $LINENO $i
- cmp in copy || test_failed $LINENO $i
- "${ZCAT}" -N --format=un in.$i > copy || test_failed $LINENO $i
- cmp in copy || test_failed $LINENO $i
- "${ZCAT}" -N --force-format=$i in.$i > copy || test_failed $LINENO $i
- cmp in copy || test_failed $LINENO $i
- "${ZCAT}" -N in.$i | dd bs=1000 count=1 > copy 2> /dev/null ||
+ "${ZCAT}" -N in.$i > out || test_failed $LINENO $i
+ cmp in out || test_failed $LINENO $i
+ "${ZCAT}" -N empty in.$i > out || test_failed $LINENO $i
+ cmp in out || test_failed $LINENO $i
+ "${ZCAT}" -N empty.$i in.$i > out || test_failed $LINENO $i
+ cmp in out || test_failed $LINENO $i
+ "${ZCAT}" -N in.$i empty > out || test_failed $LINENO $i
+ cmp in out || test_failed $LINENO $i
+ "${ZCAT}" -N in.$i empty.$i > out || test_failed $LINENO $i
+ cmp in out || test_failed $LINENO $i
+ "${ZCAT}" -N zero.$i in.$i > out || test_failed $LINENO $i
+ cmp in out || test_failed $LINENO $i
+ "${ZCAT}" -N in.$i zero.$i > out || test_failed $LINENO $i
+ cmp in out || test_failed $LINENO $i
+ "${ZCAT}" -N --format=un in.$i > out || test_failed $LINENO $i
+ cmp in out || test_failed $LINENO $i
+ "${ZCAT}" -N --force-format=$i in.$i > out || test_failed $LINENO $i
+ cmp in out || test_failed $LINENO $i
+ "${ZCAT}" -N in.$i | dd bs=1000 count=1 > out 2> /dev/null ||
test_failed $LINENO $i
- dd if=in bs=1000 count=1 2> /dev/null | cmp - copy ||
+ dd if=in bs=1000 count=1 2> /dev/null | cmp - out ||
test_failed $LINENO $i
done
@@ -82,34 +94,34 @@ printf "LZIP\001-.............................." | "${ZCAT}" -N > /dev/null 2>&1
printf "LZIPxxxxxx" | "${ZCAT}" -N > /dev/null || test_failed $LINENO
printf "BZh9xxxxxx" | "${ZCAT}" -N > /dev/null || test_failed $LINENO
"${ZCAT}" -N -v -s "${testdir}"/zcat_vs.dat > /dev/null || test_failed $LINENO
-"${ZCAT}" -N < in > copy || test_failed $LINENO
-cmp in copy || test_failed $LINENO
-"${ZCAT}" -N < in.gz > copy || test_failed $LINENO
-cmp in copy || test_failed $LINENO
-"${ZCAT}" -N < in.bz2 > copy || test_failed $LINENO
-cmp in copy || test_failed $LINENO
-"${ZCAT}" -N < in.lz > copy || test_failed $LINENO
-cmp in copy || test_failed $LINENO
-"${ZCAT}" -N -O lz - - < in.lz > copy || test_failed $LINENO
-cmp in copy || test_failed $LINENO
-"${ZCAT}" -N -O un in.lz | lzip -d > copy || test_failed $LINENO
-cmp in copy || test_failed $LINENO
-"${ZCAT}" -N --lz='lzip -q' < in.lz > copy || test_failed $LINENO
-cmp in copy || test_failed $LINENO
-"${ZCAT}" -N in > copy || test_failed $LINENO
-cmp in copy || test_failed $LINENO
-"${ZCAT}" -N lz_only > copy || test_failed $LINENO
-cmp in copy || test_failed $LINENO
-cat in.lz in in in in | "${ZCAT}" -N > copy || test_failed $LINENO # tdata
-cmp in copy || test_failed $LINENO
-"${ZCAT}" -N in in.gz in.bz2 in.lz -- -in- -in-.lz > copy || test_failed $LINENO
-cmp in6 copy || test_failed $LINENO
-"${ZCAT}" -Nq in in.gz in.bz2 in.lz "${bad0_lz}" -- -in- -in-.lz > copy
+"${ZCAT}" -N < in > out || test_failed $LINENO
+cmp in out || test_failed $LINENO
+"${ZCAT}" -N < in.gz > out || test_failed $LINENO
+cmp in out || test_failed $LINENO
+"${ZCAT}" -N < in.bz2 > out || test_failed $LINENO
+cmp in out || test_failed $LINENO
+"${ZCAT}" -N < in.lz > out || test_failed $LINENO
+cmp in out || test_failed $LINENO
+"${ZCAT}" -N -O lz - - < in.lz > out || test_failed $LINENO
+cmp in out || test_failed $LINENO
+"${ZCAT}" -N -O un in.lz | lzip -d > out || test_failed $LINENO
+cmp in out || test_failed $LINENO
+"${ZCAT}" -N --lz='lzip -q' < in.lz > out || test_failed $LINENO
+cmp in out || test_failed $LINENO
+"${ZCAT}" -N in > out || test_failed $LINENO
+cmp in out || test_failed $LINENO
+"${ZCAT}" -N lz_only > out || test_failed $LINENO
+cmp in out || test_failed $LINENO
+cat in.lz in in in in | "${ZCAT}" -N > out || test_failed $LINENO # tdata
+cmp in out || test_failed $LINENO
+"${ZCAT}" -N in in.gz in.bz2 in.lz -- -in- -in-.lz > out || test_failed $LINENO
+cmp in6 out || test_failed $LINENO
+"${ZCAT}" -Nq in in.gz in.bz2 in.lz "${bad0_lz}" -- -in- -in-.lz > out
[ $? = 1 ] || test_failed $LINENO
-cmp in6 copy || test_failed $LINENO
-"${ZCAT}" -Nq "${bad1_lz}" -- -in-.lz in in.gz in.bz2 in.lz > copy
+cmp in6 out || test_failed $LINENO
+"${ZCAT}" -Nq "${bad1_lz}" -- -in-.lz in in.gz in.bz2 in.lz > out
[ $? = 1 ] || test_failed $LINENO
-cmp in6 copy || test_failed $LINENO
+cmp in6 out || test_failed $LINENO
"${ZCAT}" -N . || test_failed $LINENO
"${ZCAT}" -N -r . > /dev/null || test_failed $LINENO
"${ZCAT}" -N -r > /dev/null || test_failed $LINENO
@@ -151,6 +163,7 @@ for i in ${extensions}; do
"${ZCMP}" -N -i 1kB:1000 -n 500 in6 in.$i || test_failed $LINENO $i
"${ZCMP}" -N -i 1KiB:1024 -n 50 in.$i in6 || test_failed $LINENO $i
"${ZCMP}" -N empty empty.$i || test_failed $LINENO $i
+ "${ZCMP}" -N empty zero.$i || test_failed $LINENO $i
done
"${ZCMP}" -N -q in in6
@@ -214,10 +227,18 @@ cat in.lz | "${ZCMP}" -N -O un,un in.lz - || test_failed $LINENO
[ $? = 2 ] || test_failed $LINENO
"${ZCMP}" -N --bad-option in in 2> /dev/null
[ $? = 2 ] || test_failed $LINENO
+cat in.gz > a.gz || framework_failure
+cat in.lz > a.lz || framework_failure
+"${ZCMP}" -N a.gz || test_failed $LINENO
+"${ZCMP}" -N a.lz || test_failed $LINENO
printf "\ntesting zdiff-%s..." "$2"
+"${ZDIFF}" -N a.gz || test_failed $LINENO
+"${ZDIFF}" -N a.lz || test_failed $LINENO
+rm -f a.gz a.lz || framework_failure
+
for i in ${extensions}; do
"${ZDIFF}" -N in.$i > /dev/null || test_failed $LINENO $i
"${ZDIFF}" -N in in.$i > /dev/null || test_failed $LINENO $i
@@ -227,11 +248,12 @@ for i in ${extensions}; do
"${ZDIFF}" -N in.$i in --force-format=$i, > /dev/null ||
test_failed $LINENO $i
"${ZDIFF}" -N empty empty.$i > /dev/null || test_failed $LINENO $i
+ "${ZDIFF}" -N empty zero.$i > /dev/null || test_failed $LINENO $i
done
"${ZDIFF}" -N in in6 > /dev/null
[ $? = 1 ] || test_failed $LINENO
-# GNU diff 3.0 returns 2 when binary files differ
+# GNU diff 3.0 returns 2 (instead of 1) when binary files differ
"${ZDIFF}" -N in.tar pin.tar4 > /dev/null && test_failed $LINENO
"${ZDIFF}" -N - - || test_failed $LINENO
"${ZDIFF}" -N - 2> /dev/null
@@ -307,8 +329,10 @@ for i in ${extensions}; do
"${ZGREP}" -N --force-format=$i "GNU" in 2> /dev/null
[ $? = 2 ] || test_failed $LINENO $i
"${ZGREP}" -N "nx_pattern" empty.$i && test_failed $LINENO $i
+ "${ZGREP}" -N "nx_pattern" zero.$i && test_failed $LINENO $i
done
+"${ZGREP}" -N "nx_pattern" empty && test_failed $LINENO
"${ZGREP}" -N pin.tar4 -e "GNU" > /dev/null || test_failed $LINENO
"${ZGREP}" -N "GNU" < pin.tar4 > /dev/null || test_failed $LINENO
"${ZGREP}" -N -r "GNU" . > /dev/null || test_failed $LINENO
@@ -379,7 +403,6 @@ rm -f empty.bz2 empty.gz empty.lz || framework_failure
"${ZTEST}" -N -R . || test_failed $LINENO
"${ZTEST}" -N -R || test_failed $LINENO
"${ZTEST}" -N empty || test_failed $LINENO
-rm -f empty || framework_failure
# test wrong compressed extensions
cat in.bz2 > in_bz2.gz || framework_failure
@@ -569,6 +592,13 @@ cat in.gz > 'name with spaces.gz' || framework_failure
"${ZCMP}" -N in 'name with spaces.lz' || test_failed $LINENO
rm -f 'name with spaces.lz' || framework_failure
+cat zero.gz > z.gz || framework_failure
+"${ZUPDATE}" -N -0 -q z.gz || test_failed $LINENO
+[ ! -e z.gz ] || test_failed $LINENO
+[ -e z.lz ] || test_failed $LINENO
+"${ZCMP}" -N empty z.lz || test_failed $LINENO
+rm -f empty z.lz || framework_failure
+
mkdir tmp2
mkdir tmp2/tmp3
cat in.bz2 > tmp2/tmp3/a.bz2 || framework_failure
@@ -584,7 +614,7 @@ cat in.gz > tmp2/tmp3/a.gz || framework_failure
[ -e tmp2/tmp3/a.gz ] || test_failed $LINENO
[ -e ddir2/tmp3/a.lz ] || test_failed $LINENO
# test non-recursive to destdir
-"${ZUPDATE}" -N -0 -k --destdir=ddir3 tmp2/tmp3/a.gz || test_failed $LINENO
+"${ZUPDATE}" -N -0 -k --destdir=ddir3/// tmp2/tmp3/a.gz || test_failed $LINENO
[ -e tmp2/tmp3/a.bz2 ] || test_failed $LINENO
[ -e tmp2/tmp3/a.gz ] || test_failed $LINENO
[ -e ddir3/a.lz ] || test_failed $LINENO