From 18525b97f1a4b60884962d8fb326e8e85d837686 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 17 Jul 2021 09:43:33 +0200 Subject: Merging upstream version 0.21. Signed-off-by: Daniel Baumann --- testsuite/check.sh | 150 +++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 112 insertions(+), 38 deletions(-) (limited to 'testsuite/check.sh') diff --git a/testsuite/check.sh b/testsuite/check.sh index 13ef132..25b7055 100755 --- a/testsuite/check.sh +++ b/testsuite/check.sh @@ -57,20 +57,20 @@ bad6_lz="${testdir}"/test3_bad6.tar.lz eof="${testdir}"/eof.tar eof_lz="${testdir}"/eof.tar.lz fail=0 -lwarn=0 lwarnc=0 test_failed() { fail=1 ; printf " $1" ; [ -z "$2" ] || printf "($2)" ; } -lzlib_1_11() { [ ${lwarn} = 0 ] && - printf "\nwarning: testing --keep-damaged requires lzlib-1.11 or newer\n$1" - lwarn=1 ; } cyg_symlink() { [ ${lwarnc} = 0 ] && printf "\nwarning: your OS follows symbolic links to directories even when tarlz asks it not to\n$1" lwarnc=1 ; } # Description of test files for tarlz: # test.txt.tar.lz: 1 member (test.txt). -# t155.tar[.lz]: directory + links + file + eof, all with 155 char names +# t155.tar[.lz]: directory + 3 links + file + eof, all with 155 char names # t155_fv?.tar[.lz]: like t155.tar but with 3 kinds of format violations +# t155_fv1.tar[.lz]: extended header followed by EOF blocks +# t155_fv2.tar[.lz]: extended header followed by global header +# t155_fv3.tar[.lz]: consecutive extended headers +# t155_fv[456].tar.lz: like t155_fv[123].tar.lz but violation starts member # tar_in_tlz1.tar.lz: 2 members (test.txt.tar test3.tar) 3 lzip members # tar_in_tlz2.tar.lz: 2 members (test.txt.tar test3.tar) 5 lzip members # ts_in_link.tar.lz: 4 symbolic links (link[1-4]) to / /dir/ dir/ dir(107/) @@ -104,6 +104,7 @@ cyg_symlink() { [ ${lwarnc} = 0 ] && # test3_gh?.tar.lz: test3.tar.lz with global before bar split in 4 ways # test3_gh5.tar.lz: test3.tar.lz with global in lzip member before foo # test3_gh6.tar.lz: test3.tar.lz with global before foo in same member +# test3_nn.tar[.lz]: test3.tar[.lz] with no name in bar member # test3_sm?.tar.lz: test3.tar.lz with extended bar member split in 4 ways # tlz_in_tar1.tar: 1 member (test3.tar.lz) first magic damaged # tlz_in_tar2.tar: 2 members (foo test3.tar.lz) first magic damaged @@ -549,12 +550,12 @@ printf "\ntesting --create..." # test --create cat "${in}" > test.txt || framework_failure -"${TARLZ}" -0 -cf out.tar.lz test.txt || test_failed $LINENO +"${TARLZ}" --warn-newer -0 -cf out.tar.lz test.txt || test_failed $LINENO rm -f test.txt || framework_failure "${TARLZ}" -xf out.tar.lz --missing-crc || test_failed $LINENO cmp "${in}" test.txt || test_failed $LINENO cat "${in}" > test.txt || framework_failure -"${TARLZ}" --uncompressed -cf out.tar test.txt || test_failed $LINENO +"${TARLZ}" --warn-newer --uncompressed -cf out.tar test.txt || test_failed $LINENO rm -f test.txt || framework_failure "${TARLZ}" -xf out.tar --missing-crc || test_failed $LINENO cmp "${in}" test.txt || test_failed $LINENO @@ -691,9 +692,11 @@ else test_failed $LINENO $i rm -rf dir || framework_failure done + cmp out0 out2 || test_failed $LINENO + cmp out0 out6 || test_failed $LINENO + rm -f out0 out2 out6 || framework_failure fi -cmp out0 out2 || test_failed $LINENO -rm -f out0 out2 out.tar aout.tar foo bar baz || framework_failure +rm -f out.tar aout.tar foo bar baz || framework_failure printf "\ntesting --delete..." @@ -1035,6 +1038,62 @@ rm -f foo || framework_failure cmp cfoo foo || test_failed $LINENO rm -f foo || framework_failure +printf "\ntesting --compress..." + +cat cfoo > foo || framework_failure +cat cbar > bar || framework_failure +cat cbaz > baz || framework_failure +cat "${in}" > test.txt || framework_failure +"${TARLZ}" --un -cf out.tar test.txt foo bar baz test.txt || test_failed $LINENO +"${TARLZ}" --un -cf out3.tar foo bar baz || test_failed $LINENO +cat out.tar > outz.tar || framework_failure +cat out3.tar > out3z.tar || framework_failure +# +"${TARLZ}" -0 -z outz.tar out3z.tar || test_failed $LINENO +"${TARLZ}" -q -tf outz.tar.lz || test_failed $LINENO +"${TARLZ}" -q -tf out3z.tar.lz || test_failed $LINENO +cat outz.tar.lz > out || test_failed $LINENO +cat out3z.tar.lz > out3 || test_failed $LINENO +rm -f out3z.tar.lz || framework_failure +"${TARLZ}" -q -0 -z outz.tar out3z.tar +[ $? = 1 ] || test_failed $LINENO +cmp out outz.tar.lz || test_failed $LINENO +cmp out3 out3z.tar.lz || test_failed $LINENO +rm -f out out3 outz.tar.lz out3z.tar.lz || framework_failure +# +for i in --solid --no-solid ; do + "${TARLZ}" -0 -n0 $i -cf out.tar.lz test.txt foo bar baz test.txt || test_failed $LINENO $i + "${TARLZ}" -0 -z -o - $i out.tar | cmp out.tar.lz - || test_failed $LINENO $i + "${TARLZ}" -0 -n0 $i -cf out3.tar.lz foo bar baz || test_failed $LINENO $i + "${TARLZ}" -0 -z -o - $i out3.tar | cmp out3.tar.lz - || test_failed $LINENO $i + "${TARLZ}" -0 -z $i outz.tar out3z.tar || test_failed $LINENO $i + cmp out.tar.lz outz.tar.lz || test_failed $LINENO $i + cmp out3.tar.lz out3z.tar.lz || test_failed $LINENO $i + rm -f outz.tar.lz out3z.tar.lz || framework_failure +done +# +"${TARLZ}" -0 -B8KiB -n0 --bsolid -cf out.tar.lz test.txt foo bar baz test.txt || test_failed $LINENO +"${TARLZ}" -0 -B8KiB -z -o - --bsolid out.tar | cmp out.tar.lz - || test_failed $LINENO +"${TARLZ}" -0 -B8KiB -z -o out --bsolid out.tar || test_failed $LINENO +cmp out.tar.lz out || test_failed $LINENO +"${TARLZ}" -0 -B8KiB -z --bsolid outz.tar || test_failed $LINENO +cmp out.tar.lz outz.tar.lz || test_failed $LINENO +rm -f out outz.tar.lz || framework_failure +# +"${TARLZ}" -0 -n0 --asolid -cf out.tar.lz test.txt foo bar baz test.txt || test_failed $LINENO +"${TARLZ}" -0 -n0 --asolid -cf out3.tar.lz foo bar baz || test_failed $LINENO +for i in --asolid --bsolid --dsolid ; do + cat out.tar | "${TARLZ}" -0 -z $i | cmp out.tar.lz - || test_failed $LINENO $i + "${TARLZ}" -0 -z -o out $i out.tar || test_failed $LINENO $i + cmp out.tar.lz out || test_failed $LINENO $i + "${TARLZ}" -0 -z $i outz.tar out3z.tar || test_failed $LINENO $i + cmp out.tar.lz outz.tar.lz || test_failed $LINENO $i + cmp out3.tar.lz out3z.tar.lz || test_failed $LINENO $i + rm -f out outz.tar.lz out3z.tar.lz || framework_failure +done +rm -f foo bar baz test.txt out.tar.lz out3.tar.lz out.tar outz.tar out3z.tar || + framework_failure + printf "\ntesting bad input..." # test --extract ".." @@ -1085,34 +1144,49 @@ if [ "${ln_works}" = yes ] ; then "${TARLZ}" -C dir1 -xf "${t155}" || test_failed $LINENO fi for i in 1 2 3 ; do - "${TARLZ}" -q -tf "${testdir}"/t155_fv${i}.tar - [ $? = 2 ] || test_failed $LINENO $i - "${TARLZ}" -q -tf "${testdir}"/t155_fv${i}.tar --permissive || - test_failed $LINENO $i - if [ "${ln_works}" = yes ] ; then - mkdir dir2 || framework_failure - "${TARLZ}" -C dir2 -xf "${testdir}"/t155_fv${i}.tar --permissive || - test_failed $LINENO $i - diff -ru dir1 dir2 || test_failed $LINENO $i - rm -rf dir2 || framework_failure - fi + "${TARLZ}" -q -tf "${testdir}"/t155_fv${i}.tar + [ $? = 2 ] || test_failed $LINENO $i + "${TARLZ}" -q -tf "${testdir}"/t155_fv${i}.tar --permissive || + test_failed $LINENO $i + if [ "${ln_works}" = yes ] ; then + mkdir dir2 || framework_failure + "${TARLZ}" -C dir2 -xf "${testdir}"/t155_fv${i}.tar --permissive || + test_failed $LINENO $i + diff -ru dir1 dir2 || test_failed $LINENO $i + rm -rf dir2 || framework_failure + fi done for i in 1 2 3 4 5 6 ; do - "${TARLZ}" -q -tf "${testdir}"/t155_fv${i}.tar.lz - [ $? = 2 ] || test_failed $LINENO $i - "${TARLZ}" -q -tf "${testdir}"/t155_fv${i}.tar.lz --permissive || - test_failed $LINENO $i - if [ "${ln_works}" = yes ] ; then - mkdir dir2 || framework_failure - "${TARLZ}" -C dir2 -xf "${testdir}"/t155_fv${i}.tar.lz --permissive || - test_failed $LINENO $i - diff -ru dir1 dir2 || test_failed $LINENO $i - rm -rf dir2 || framework_failure - fi + "${TARLZ}" -q -tf "${testdir}"/t155_fv${i}.tar.lz + [ $? = 2 ] || test_failed $LINENO $i + "${TARLZ}" -q -tf "${testdir}"/t155_fv${i}.tar.lz --permissive || + test_failed $LINENO $i + if [ "${ln_works}" = yes ] ; then + mkdir dir2 || framework_failure + "${TARLZ}" -n4 -C dir2 -xf "${testdir}"/t155_fv${i}.tar.lz --permissive || + test_failed $LINENO $i + diff -ru dir1 dir2 || test_failed $LINENO $i + rm -rf dir2 || framework_failure + fi +done +if [ "${ln_works}" = yes ] ; then rm -rf dir1 || framework_failure ; fi + +for i in "${testdir}"/test3_nn.tar "${testdir}"/test3_nn.tar.lz ; do + "${TARLZ}" -q -n0 -tf "$i" || test_failed $LINENO $i + "${TARLZ}" -q -n4 -tf "$i" || test_failed $LINENO $i + "${TARLZ}" -q -n0 -xf "$i" || test_failed $LINENO $i + "${TARLZ}" -n0 -df "$i" --ignore-ids || test_failed $LINENO $i + cmp cfoo foo || test_failed $LINENO $i + [ ! -e bar ] || test_failed $LINENO $i + cmp cbaz baz || test_failed $LINENO $i + rm -f foo bar baz || framework_failure + "${TARLZ}" -q -n4 -xf "$i" || test_failed $LINENO $i + "${TARLZ}" -n4 -df "$i" --ignore-ids || test_failed $LINENO $i + cmp cfoo foo || test_failed $LINENO $i + [ ! -e bar ] || test_failed $LINENO $i + cmp cbaz baz || test_failed $LINENO $i + rm -f foo bar baz || framework_failure done -if [ "${ln_works}" = yes ] ; then - rm -rf dir1 || framework_failure -fi printf "\ntesting --keep-damaged..." @@ -1126,7 +1200,7 @@ for i in "${inbad1}" "${inbad2}" ; do "${TARLZ}" -q -n0 -xf "${i}.tar.lz" --keep-damaged [ $? = 2 ] || test_failed $LINENO "$i" [ -e test.txt ] || test_failed $LINENO "$i" - cmp "$i" test.txt 2> /dev/null || lzlib_1_11 "$LINENO $i" + cmp "$i" test.txt 2> /dev/null || test_failed $LINENO $i rm -f test.txt || framework_failure done # @@ -1152,7 +1226,7 @@ rm -f foo bar baz || framework_failure "${TARLZ}" -q -n0 -xf "${bad3_lz}" --keep-damaged [ $? = 2 ] || test_failed $LINENO cmp cfoo foo || test_failed $LINENO -cmp cbar bar 2> /dev/null || lzlib_1_11 $LINENO +cmp cbar bar 2> /dev/null || test_failed $LINENO cmp cbaz baz || test_failed $LINENO rm -f foo bar baz || framework_failure "${TARLZ}" -q -n0 -xf "${bad4_lz}" @@ -1164,7 +1238,7 @@ rm -f foo bar baz || framework_failure "${TARLZ}" -q -n0 -xf "${bad4_lz}" --keep-damaged [ $? = 2 ] || test_failed $LINENO [ ! -e foo ] || test_failed $LINENO -cmp cbar bar 2> /dev/null || lzlib_1_11 $LINENO +cmp cbar bar 2> /dev/null || test_failed $LINENO cmp cbaz baz || test_failed $LINENO rm -f foo bar baz || framework_failure "${TARLZ}" -q -n0 -xf "${bad5_lz}" @@ -1175,7 +1249,7 @@ cmp cbaz baz || test_failed $LINENO rm -f foo bar baz || framework_failure "${TARLZ}" -q -n0 -xf "${bad5_lz}" --keep-damaged [ $? = 2 ] || test_failed $LINENO -cmp cfoo foo 2> /dev/null || lzlib_1_11 $LINENO +cmp cfoo foo 2> /dev/null || test_failed $LINENO [ ! -e bar ] || test_failed $LINENO cmp cbaz baz || test_failed $LINENO rm -f foo bar baz || framework_failure -- cgit v1.2.3