summaryrefslogtreecommitdiffstats
path: root/testsuite/check.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2020-06-28 09:38:47 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2020-06-28 09:38:47 +0000
commitd1eec8184551651d58eefdea942648f2c8432240 (patch)
treec8089fa3b24adda100afb1294c21f2747d321cb1 /testsuite/check.sh
parentReleasing debian version 0.5-1. (diff)
downloadxlunzip-d1eec8184551651d58eefdea942648f2c8432240.tar.xz
xlunzip-d1eec8184551651d58eefdea942648f2c8432240.zip
Merging upstream version 0.6.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testsuite/check.sh')
-rwxr-xr-xtestsuite/check.sh92
1 files changed, 73 insertions, 19 deletions
diff --git a/testsuite/check.sh b/testsuite/check.sh
index 853deda..5625ac2 100755
--- a/testsuite/check.sh
+++ b/testsuite/check.sh
@@ -48,8 +48,13 @@ printf "testing xlunzip-%s..." "$2"
[ $? = 2 ] || test_failed $LINENO
"${LZIP}" -dq -o in < "${in_lz}"
[ $? = 1 ] || test_failed $LINENO
+"${LZIP}" -dq -o in "${in_lz}"
+[ $? = 1 ] || test_failed $LINENO
+"${LZIP}" -dq -o out nx_file.lz
+[ $? = 1 ] || test_failed $LINENO
+[ ! -e out ] || test_failed $LINENO
# these are for code coverage
-"${LZIP}" -t -- nx_file 2> /dev/null
+"${LZIP}" -t -- nx_file.lz 2> /dev/null
[ $? = 1 ] || test_failed $LINENO
"${LZIP}" -t "" < /dev/null 2> /dev/null
[ $? = 1 ] || test_failed $LINENO
@@ -77,11 +82,17 @@ printf "\ntesting decompression..."
for i in "${in_lz}" "${in_em}" ; do
"${LZIP}" -t "$i" || test_failed $LINENO "$i"
+ "${LZIP}" -d "$i" -o copy || test_failed $LINENO "$i"
+ cmp in copy || test_failed $LINENO "$i"
"${LZIP}" -cd "$i" > copy || test_failed $LINENO "$i"
cmp in copy || test_failed $LINENO "$i"
+ "${LZIP}" -d "$i" -o - > copy || test_failed $LINENO "$i"
+ cmp in copy || test_failed $LINENO "$i"
+ "${LZIP}" -d < "$i" > copy || test_failed $LINENO "$i"
+ cmp in copy || test_failed $LINENO "$i"
+ rm -f copy || framework_failure
done
-rm -f copy || framework_failure
cat "${in_lz}" > copy.lz || framework_failure
"${LZIP}" -dk copy.lz || test_failed $LINENO
cmp in copy || test_failed $LINENO
@@ -95,10 +106,16 @@ cmp in copy || test_failed $LINENO
printf "to be overwritten" > copy || framework_failure
"${LZIP}" -df -o copy < "${in_lz}" || test_failed $LINENO
cmp in copy || test_failed $LINENO
+rm -f out copy || framework_failure
+"${LZIP}" -d -o ./- "${in_lz}" || test_failed $LINENO
+cmp in ./- || test_failed $LINENO
+rm -f ./- || framework_failure
+"${LZIP}" -d -o ./- < "${in_lz}" || test_failed $LINENO
+cmp in ./- || test_failed $LINENO
+rm -f ./- || framework_failure
-rm -f copy || framework_failure
cat "${in_lz}" > anyothername || framework_failure
-"${LZIP}" -dv --output copy - anyothername - < "${in_lz}" 2> /dev/null ||
+"${LZIP}" -dv - anyothername - < "${in_lz}" > copy 2> /dev/null ||
test_failed $LINENO
cmp in copy || test_failed $LINENO
cmp in anyothername.out || test_failed $LINENO
@@ -128,12 +145,16 @@ cat "${in_lz}" > copy.lz || framework_failure
cmp in copy || test_failed $LINENO
cat in in > in2 || framework_failure
-cat "${in_lz}" "${in_lz}" > in2.lz || framework_failure
-"${LZIP}" -t in2.lz || test_failed $LINENO
-"${LZIP}" -cd in2.lz > copy2 || test_failed $LINENO
+"${LZIP}" -t "${in_lz}" "${in_lz}" || test_failed $LINENO
+"${LZIP}" -cd "${in_lz}" "${in_lz}" -o out > copy2 || test_failed $LINENO
+[ ! -e out ] || test_failed $LINENO # override -o
+cmp in2 copy2 || test_failed $LINENO
+rm -f copy2 || framework_failure
+"${LZIP}" -d "${in_lz}" "${in_lz}" -o copy2 || test_failed $LINENO
cmp in2 copy2 || test_failed $LINENO
+rm -f copy2 || framework_failure
-cat in2.lz > copy2.lz || framework_failure
+cat "${in_lz}" "${in_lz}" > copy2.lz || framework_failure
printf "\ngarbage" >> copy2.lz || framework_failure
"${LZIP}" -tvvvv copy2.lz 2> /dev/null || test_failed $LINENO
printf "to be overwritten" > copy2 || framework_failure
@@ -183,6 +204,7 @@ for i in fox_bcrc.lz fox_crc0.lz fox_das46.lz fox_mes81.lz ; do
done
rm -f fox out || framework_failure
+cat "${in_lz}" "${in_lz}" > in2.lz || framework_failure
cat "${in_lz}" "${in_lz}" "${in_lz}" > in3.lz || framework_failure
if dd if=in3.lz of=trunc.lz bs=14752 count=1 2> /dev/null &&
[ -e trunc.lz ] && cmp in2.lz trunc.lz > /dev/null 2>&1 ; then
@@ -283,30 +305,62 @@ cmp -s in copy && test_failed $LINENO
[ $? = 1 ] || test_failed $LINENO
cmp -s in copy && test_failed $LINENO
+# decompress in place
+rm -f copy copy2 || framework_failure
"${LZIP}" -t --in-place "${in_lz}" || test_failed $LINENO
+"${LZIP}" -t --in-place < "${in_lz}" || test_failed $LINENO
+"${LZIP}" -d --in-place "${in_lz}" -o copy || test_failed $LINENO
+cmp in copy || test_failed $LINENO
+rm -f copy || framework_failure
+"${LZIP}" -d --in-place < "${in_lz}" -o copy || test_failed $LINENO
+cmp in copy || test_failed $LINENO
"${LZIP}" -cd --in-place "${in_lz}" > copy || test_failed $LINENO
cmp in copy || test_failed $LINENO
+"${LZIP}" -cd --in-place < "${in_lz}" > copy || test_failed $LINENO
+cmp in copy || test_failed $LINENO
+"${LZIP}" -t --in-place "${in_lz}" "${in_lz}" || test_failed $LINENO
+"${LZIP}" -d --in-place "${in_lz}" "${in_lz}" -o copy2 || test_failed $LINENO
+cmp in2 copy2 || test_failed $LINENO
+"${LZIP}" -cd --in-place "${in_lz}" "${in_lz}" > copy2 || test_failed $LINENO
+cmp in2 copy2 || test_failed $LINENO
+
+# decompress multimember in place
cat in in in > in3 || framework_failure
for i in in2 in3 ; do
"${LZIP}" -t --in-place $i.lz || test_failed $LINENO
+ "${LZIP}" -t --in-place < $i.lz || test_failed $LINENO
+ rm -f copy || framework_failure
+ "${LZIP}" -d --in-place $i.lz -o copy || test_failed $LINENO
+ cmp $i copy || test_failed $LINENO
+ rm -f copy || framework_failure
+ "${LZIP}" -d --in-place < $i.lz -o copy || test_failed $LINENO
+ cmp $i copy || test_failed $LINENO
"${LZIP}" -cd --in-place $i.lz > copy || test_failed $LINENO
cmp $i copy || test_failed $LINENO
+ "${LZIP}" -cd --in-place < $i.lz > copy || test_failed $LINENO
+ cmp $i copy || test_failed $LINENO
done
"${LZIP}" -tq --in-place ingin.lz
[ $? = 2 ] || test_failed $LINENO
+rm -f copy copy2 ingin.lz in2 in2.lz in3 in3.lz || framework_failure
+
+cat "${in_lz}" > inz.lz || framework_failure
+counter=0
+while [ ${counter} -lt 20 ] ; do
+ cat "${zero_lz}" >> inz.lz || framework_failure
+ "${LZIP}" -t --in-place inz.lz || test_failed $LINENO
+ "${LZIP}" -cd --in-place inz.lz > copy || test_failed $LINENO
+ cmp in copy || test_failed $LINENO
+ counter=$((counter+1))
+done
+rm -f copy inz.lz || framework_failure
-cat "${in_lz}" "${zero_lz}" "${zero_lz}" "${zero_lz}" "${zero_lz}" \
- "${zero_lz}" "${zero_lz}" "${zero_lz}" > inz.lz || framework_failure
-"${LZIP}" -t --in-place inz.lz || test_failed $LINENO
-"${LZIP}" -cd --in-place inz.lz > copy || test_failed $LINENO
+# decompress with trailing data in place
+cat "${in_lz}" in in in in > int.lz || framework_failure
+"${LZIP}" -t --in-place int.lz || test_failed $LINENO
+"${LZIP}" -cd --in-place int.lz > copy || test_failed $LINENO
cmp in copy || test_failed $LINENO
-cat "${zero_lz}" >> inz.lz || framework_failure
-"${LZIP}" -tq --in-place inz.lz
-[ $? = 2 ] || test_failed $LINENO
-"${LZIP}" -cdq --in-place inz.lz > copy
-[ $? = 2 ] || test_failed $LINENO
-cmp -s in copy && test_failed $LINENO
-rm -f copy ingin.lz in2 in2.lz in3 in3.lz || framework_failure
+rm -f copy int.lz || framework_failure
echo
if [ ${fail} = 0 ] ; then