check.sh (lzlib-1.12.tar.lz) | : | check.sh (lzlib-1.13.tar.lz) | ||
---|---|---|---|---|
#! /bin/sh | #! /bin/sh | |||
# check script for Lzlib - Compression library for the lzip format | # check script for Lzlib - Compression library for the lzip format | |||
# Copyright (C) 2009-2021 Antonio Diaz Diaz. | # Copyright (C) 2009-2022 Antonio Diaz Diaz. | |||
# | # | |||
# This script is free software: you have unlimited permission | # This script is free software: you have unlimited permission | |||
# to copy, distribute, and modify it. | # to copy, distribute, and modify it. | |||
LC_ALL=C | LC_ALL=C | |||
export LC_ALL | export LC_ALL | |||
objdir=`pwd` | objdir=`pwd` | |||
testdir=`cd "$1" ; pwd` | testdir=`cd "$1" ; pwd` | |||
LZIP="${objdir}"/minilzip | LZIP="${objdir}"/minilzip | |||
BBEXAMPLE="${objdir}"/bbexample | BBEXAMPLE="${objdir}"/bbexample | |||
skipping to change at line 42 | skipping to change at line 42 | |||
cd "${objdir}"/tmp || framework_failure | cd "${objdir}"/tmp || framework_failure | |||
cat "${testdir}"/test.txt > in || framework_failure | cat "${testdir}"/test.txt > in || framework_failure | |||
in_lz="${testdir}"/test.txt.lz | in_lz="${testdir}"/test.txt.lz | |||
in_em="${testdir}"/test_em.txt.lz | in_em="${testdir}"/test_em.txt.lz | |||
fox_lf="${testdir}"/fox_lf | fox_lf="${testdir}"/fox_lf | |||
fox_lz="${testdir}"/fox.lz | fox_lz="${testdir}"/fox.lz | |||
fail=0 | fail=0 | |||
test_failed() { fail=1 ; printf " $1" ; [ -z "$2" ] || printf "($2)" ; } | test_failed() { fail=1 ; printf " $1" ; [ -z "$2" ] || printf "($2)" ; } | |||
"${LZIP}" --check-lib # just print warning | "${LZIP}" --check-lib # just print warning | |||
[ $? != 2 ] || { test_failed $LINENO ; exit 2 ; } # unless bad lzlib.h | ||||
printf "testing lzlib-%s..." "$2" | printf "testing lzlib-%s..." "$2" | |||
"${LZIP}" -fkqm4 in | "${LZIP}" -fkqm4 in | |||
[ $? = 1 ] || test_failed $LINENO | [ $? = 1 ] || test_failed $LINENO | |||
[ ! -e in.lz ] || test_failed $LINENO | [ ! -e in.lz ] || test_failed $LINENO | |||
"${LZIP}" -fkqm274 in | "${LZIP}" -fkqm274 in | |||
[ $? = 1 ] || test_failed $LINENO | [ $? = 1 ] || test_failed $LINENO | |||
[ ! -e in.lz ] || test_failed $LINENO | [ ! -e in.lz ] || test_failed $LINENO | |||
for i in bad_size -1 0 4095 513MiB 1G 1T 1P 1E 1Z 1Y 10KB ; do | for i in bad_size -1 0 4095 513MiB 1G 1T 1P 1E 1Z 1Y 10KB ; do | |||
"${LZIP}" -fkqs $i in | "${LZIP}" -fkqs $i in | |||
skipping to change at line 102 | skipping to change at line 103 | |||
[ $? = 1 ] || test_failed $LINENO | [ $? = 1 ] || test_failed $LINENO | |||
"${LZIP}" --test=2 2> /dev/null | "${LZIP}" --test=2 2> /dev/null | |||
[ $? = 1 ] || test_failed $LINENO | [ $? = 1 ] || test_failed $LINENO | |||
"${LZIP}" --output= 2> /dev/null | "${LZIP}" --output= 2> /dev/null | |||
[ $? = 1 ] || test_failed $LINENO | [ $? = 1 ] || test_failed $LINENO | |||
"${LZIP}" --output 2> /dev/null | "${LZIP}" --output 2> /dev/null | |||
[ $? = 1 ] || test_failed $LINENO | [ $? = 1 ] || test_failed $LINENO | |||
printf "LZIP\001-.............................." | "${LZIP}" -t 2> /dev/null | printf "LZIP\001-.............................." | "${LZIP}" -t 2> /dev/null | |||
printf "LZIP\002-.............................." | "${LZIP}" -t 2> /dev/null | printf "LZIP\002-.............................." | "${LZIP}" -t 2> /dev/null | |||
printf "LZIP\001+.............................." | "${LZIP}" -t 2> /dev/null | printf "LZIP\001+.............................." | "${LZIP}" -t 2> /dev/null | |||
rm -f out || framework_failure | ||||
printf "\ntesting decompression..." | printf "\ntesting decompression..." | |||
for i in "${in_lz}" "${in_em}" "${testdir}"/test_sync.lz ; do | for i in "${in_lz}" "${in_em}" "${testdir}"/test_sync.lz ; do | |||
"${LZIP}" -t "$i" || test_failed $LINENO "$i" | "${LZIP}" -t "$i" || test_failed $LINENO "$i" | |||
"${LZIP}" -d "$i" -o copy || test_failed $LINENO "$i" | "${LZIP}" -d "$i" -o copy || test_failed $LINENO "$i" | |||
cmp in copy || test_failed $LINENO "$i" | cmp in copy || test_failed $LINENO "$i" | |||
"${LZIP}" -cd "$i" > copy || test_failed $LINENO "$i" | "${LZIP}" -cd "$i" > copy || test_failed $LINENO "$i" | |||
cmp in copy || test_failed $LINENO "$i" | cmp in copy || test_failed $LINENO "$i" | |||
"${LZIP}" -d "$i" -o - > copy || test_failed $LINENO "$i" | "${LZIP}" -d "$i" -o - > copy || test_failed $LINENO "$i" | |||
cmp in copy || test_failed $LINENO "$i" | cmp in copy || test_failed $LINENO "$i" | |||
"${LZIP}" -d < "$i" > copy || test_failed $LINENO "$i" | "${LZIP}" -d < "$i" > copy || test_failed $LINENO "$i" | |||
cmp in copy || test_failed $LINENO "$i" | cmp in copy || test_failed $LINENO "$i" | |||
rm -f copy || framework_failure | rm -f copy || framework_failure | |||
done | done | |||
lines=$("${LZIP}" -tvv "${in_em}" 2>&1 | wc -l) || test_failed $LINENO | lines=$("${LZIP}" -tvv "${in_em}" 2>&1 | wc -l) || test_failed $LINENO | |||
[ "${lines}" -eq 8 ] || test_failed $LINENO "${lines}" | [ "${lines}" -eq 8 ] || test_failed $LINENO "${lines}" | |||
"${LZIP}" -cd "${fox_lz}" > fox || test_failed $LINENO | ||||
cat "${in_lz}" > copy.lz || framework_failure | cat "${in_lz}" > copy.lz || framework_failure | |||
"${LZIP}" -dk copy.lz || test_failed $LINENO | "${LZIP}" -dk copy.lz || test_failed $LINENO | |||
cmp in copy || test_failed $LINENO | cmp in copy || test_failed $LINENO | |||
printf "to be overwritten" > copy || framework_failure | cat fox > copy || framework_failure | |||
"${LZIP}" -d copy.lz 2> /dev/null | cat "${in_lz}" > out.lz || framework_failure | |||
rm -f out || framework_failure | ||||
"${LZIP}" -d copy.lz out.lz 2> /dev/null # skip copy, decompress out | ||||
[ $? = 1 ] || test_failed $LINENO | [ $? = 1 ] || test_failed $LINENO | |||
cmp fox copy || test_failed $LINENO | ||||
cmp in out || test_failed $LINENO | ||||
"${LZIP}" -df copy.lz || test_failed $LINENO | "${LZIP}" -df copy.lz || test_failed $LINENO | |||
[ ! -e copy.lz ] || test_failed $LINENO | [ ! -e copy.lz ] || test_failed $LINENO | |||
cmp in copy || test_failed $LINENO | cmp in copy || test_failed $LINENO | |||
rm -f copy out || framework_failure | ||||
rm -f copy || framework_failure | ||||
cat "${in_lz}" > copy.lz || framework_failure | cat "${in_lz}" > copy.lz || framework_failure | |||
"${LZIP}" -d -S100k copy.lz || test_failed $LINENO # ignore -S | "${LZIP}" -d -S100k copy.lz || test_failed $LINENO # ignore -S | |||
[ ! -e copy.lz ] || test_failed $LINENO | [ ! -e copy.lz ] || test_failed $LINENO | |||
cmp in copy || test_failed $LINENO | cmp in copy || test_failed $LINENO | |||
printf "to be overwritten" > copy || framework_failure | printf "to be overwritten" > copy || framework_failure | |||
"${LZIP}" -d -o copy < "${in_lz}" 2> /dev/null | ||||
[ $? = 1 ] || test_failed $LINENO | ||||
"${LZIP}" -df -o copy < "${in_lz}" || test_failed $LINENO | "${LZIP}" -df -o copy < "${in_lz}" || test_failed $LINENO | |||
cmp in copy || test_failed $LINENO | cmp in copy || test_failed $LINENO | |||
rm -f out copy || framework_failure | rm -f out copy || framework_failure | |||
"${LZIP}" -d -o ./- "${in_lz}" || test_failed $LINENO | "${LZIP}" -d -o ./- "${in_lz}" || test_failed $LINENO | |||
cmp in ./- || test_failed $LINENO | cmp in ./- || test_failed $LINENO | |||
rm -f ./- || framework_failure | rm -f ./- || framework_failure | |||
"${LZIP}" -d -o ./- < "${in_lz}" || test_failed $LINENO | "${LZIP}" -d -o ./- < "${in_lz}" || test_failed $LINENO | |||
cmp in ./- || test_failed $LINENO | cmp in ./- || test_failed $LINENO | |||
rm -f ./- || framework_failure | rm -f ./- || framework_failure | |||
skipping to change at line 163 | skipping to change at line 168 | |||
cmp in copy || test_failed $LINENO | cmp in copy || test_failed $LINENO | |||
cmp in anyothername.out || test_failed $LINENO | cmp in anyothername.out || test_failed $LINENO | |||
rm -f copy anyothername.out || framework_failure | rm -f copy anyothername.out || framework_failure | |||
"${LZIP}" -tq in "${in_lz}" | "${LZIP}" -tq in "${in_lz}" | |||
[ $? = 2 ] || test_failed $LINENO | [ $? = 2 ] || test_failed $LINENO | |||
"${LZIP}" -tq nx_file.lz "${in_lz}" | "${LZIP}" -tq nx_file.lz "${in_lz}" | |||
[ $? = 1 ] || test_failed $LINENO | [ $? = 1 ] || test_failed $LINENO | |||
"${LZIP}" -cdq in "${in_lz}" > copy | "${LZIP}" -cdq in "${in_lz}" > copy | |||
[ $? = 2 ] || test_failed $LINENO | [ $? = 2 ] || test_failed $LINENO | |||
cat copy in | cmp in - || test_failed $LINENO | cat copy in | cmp in - || test_failed $LINENO # copy must be empty | |||
"${LZIP}" -cdq nx_file.lz "${in_lz}" > copy | "${LZIP}" -cdq nx_file.lz "${in_lz}" > copy | |||
[ $? = 1 ] || test_failed $LINENO | [ $? = 1 ] || test_failed $LINENO | |||
cmp in copy || test_failed $LINENO | cmp in copy || test_failed $LINENO | |||
rm -f copy || framework_failure | rm -f copy || framework_failure | |||
cat "${in_lz}" > copy.lz || framework_failure | cat "${in_lz}" > copy.lz || framework_failure | |||
for i in 1 2 3 4 5 6 7 ; do | for i in 1 2 3 4 5 6 7 ; do | |||
printf "g" >> copy.lz || framework_failure | printf "g" >> copy.lz || framework_failure | |||
"${LZIP}" -atvvvv copy.lz "${in_lz}" 2> /dev/null | "${LZIP}" -atvvvv copy.lz "${in_lz}" 2> /dev/null | |||
[ $? = 2 ] || test_failed $LINENO $i | [ $? = 2 ] || test_failed $LINENO $i | |||
done | done | |||
skipping to change at line 384 | skipping to change at line 389 | |||
printf "\nwarning: skipping header test: 'printf' does not work on your s ystem." | printf "\nwarning: skipping header test: 'printf' does not work on your s ystem." | |||
fi | fi | |||
rm -f int.lz || framework_failure | rm -f int.lz || framework_failure | |||
for i in fox_v2.lz fox_s11.lz fox_de20.lz \ | for i in fox_v2.lz fox_s11.lz fox_de20.lz \ | |||
fox_bcrc.lz fox_crc0.lz fox_das46.lz fox_mes81.lz ; do | fox_bcrc.lz fox_crc0.lz fox_das46.lz fox_mes81.lz ; do | |||
"${LZIP}" -tq "${testdir}"/$i | "${LZIP}" -tq "${testdir}"/$i | |||
[ $? = 2 ] || test_failed $LINENO $i | [ $? = 2 ] || test_failed $LINENO $i | |||
done | done | |||
"${LZIP}" -cd "${fox_lz}" > fox || test_failed $LINENO | ||||
for i in fox_bcrc.lz fox_crc0.lz fox_das46.lz fox_mes81.lz ; do | for i in fox_bcrc.lz fox_crc0.lz fox_das46.lz fox_mes81.lz ; do | |||
"${LZIP}" -cdq "${testdir}"/$i > out | "${LZIP}" -cdq "${testdir}"/$i > out | |||
[ $? = 2 ] || test_failed $LINENO $i | [ $? = 2 ] || test_failed $LINENO $i | |||
cmp fox out || test_failed $LINENO $i | cmp fox out || test_failed $LINENO $i | |||
done | done | |||
rm -f fox out || framework_failure | rm -f fox out || framework_failure | |||
cat "${in_lz}" "${in_lz}" > in2.lz || framework_failure | cat "${in_lz}" "${in_lz}" > in2.lz || framework_failure | |||
cat "${in_lz}" "${in_lz}" "${in_lz}" > in3.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 && | if dd if=in3.lz of=trunc.lz bs=14752 count=1 2> /dev/null && | |||
End of changes. 11 change blocks. | ||||
9 lines changed or deleted | 13 lines changed or added |