diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2020-08-08 17:10:19 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2020-08-08 17:11:19 +0000 |
commit | e9232deb17df1ba9d36920e1d3444d34ad6ec18e (patch) | |
tree | 86f970c2e20f2d35845918f26f55bedffcd5f82c /testsuite/check.sh | |
parent | Releasing debian version 0.16-4. (diff) | |
download | tarlz-e9232deb17df1ba9d36920e1d3444d34ad6ec18e.tar.xz tarlz-e9232deb17df1ba9d36920e1d3444d34ad6ec18e.zip |
Merging upstream version 0.17.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testsuite/check.sh')
-rwxr-xr-x | testsuite/check.sh | 101 |
1 files changed, 61 insertions, 40 deletions
diff --git a/testsuite/check.sh b/testsuite/check.sh index 1b6f3f7..74e8549 100755 --- a/testsuite/check.sh +++ b/testsuite/check.sh @@ -1,9 +1,9 @@ #! /bin/sh # check script for Tarlz - Archiver with multimember lzip compression -# Copyright (C) 2013-2019 Antonio Diaz Diaz. +# Copyright (C) 2013-2020 Antonio Diaz Diaz. # # This script is free software: you have unlimited permission -# to copy, distribute and modify it. +# to copy, distribute, and modify it. LC_ALL=C export LC_ALL @@ -60,20 +60,24 @@ 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_fv?.tar[.lz]: like t155.tar but with 3 kinds of format violations -# 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 +# 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/) -# test_bad1.tar.lz: truncated at offset 6000 (of 7495) -# test_bad2.tar.lz: byte at offset 6000 changed from 0x56 to 0x46 +# test_bad1.txt.tar.lz: truncated at offset 6000 (of 7495) +# test_bad2.txt.tar.lz: byte at offset 6000 changed from 0x56 to 0x46 # test3.tar[.lz]: 3 members (foo bar baz) + 2 zeroed 512-byte blocks # test3_dir.tar[.lz] like test3.tar but members /dir/foo /dir/bar /dir/baz # test3_dot.tar.lz: 3 times 3 members ./foo ././bar ./././baz @@ -108,12 +112,17 @@ lzlib_1_11() { [ ${lwarn} = 0 ] && # ug32chars.tar.lz: 1 member (foo) with 32-character owner and group names # ug32767.tar.lz: 1 member (foo) with numerical-only owner and group +# Note that multi-threaded --list succeeds with test_bad2.txt.tar.lz and +# test3_bad3.tar.lz because their headers are intact. + printf "testing tarlz-%s..." "$2" "${TARLZ}" -q -tf "${in}" [ $? = 2 ] || test_failed $LINENO "${TARLZ}" -q -tf "${in_lz}" [ $? = 2 ] || test_failed $LINENO +"${TARLZ}" -q -tf "${in_tar_lz}" -f "${in_tar_lz}" +[ $? = 1 ] || test_failed $LINENO "${TARLZ}" -q -tf nx_file [ $? = 1 ] || test_failed $LINENO "${TARLZ}" -tf 2> /dev/null @@ -159,6 +168,8 @@ rm -f empty.tar.lz empty.tlz || framework_failure [ $? = 1 ] || test_failed $LINENO "${TARLZ}" -q -ctx [ $? = 1 ] || test_failed $LINENO +"${TARLZ}" -q -tf "${in_tar_lz}" "" +[ $? = 1 ] || test_failed $LINENO "${TARLZ}" --help > /dev/null || test_failed $LINENO "${TARLZ}" -V > /dev/null || test_failed $LINENO "${TARLZ}" --bad_option -tf "${test3_lz}" 2> /dev/null @@ -382,16 +393,16 @@ for i in "${tarint1_lz}" "${tarint2_lz}" ; do "${TARLZ}" -tvf "$i" -n$j > outv$j || test_failed $LINENO "$i $j" done - diff -u out0 out2 || test_failed $LINENO $i - diff -u out0 out6 || test_failed $LINENO $i - diff -u out2 out6 || test_failed $LINENO $i - diff -u outv0 outv2 || test_failed $LINENO $i - diff -u outv0 outv6 || test_failed $LINENO $i - diff -u outv2 outv6 || test_failed $LINENO $i + diff -u out0 out2 || test_failed $LINENO "$i" + diff -u out0 out6 || test_failed $LINENO "$i" + diff -u out2 out6 || test_failed $LINENO "$i" + diff -u outv0 outv2 || test_failed $LINENO "$i" + diff -u outv0 outv6 || test_failed $LINENO "$i" + diff -u outv2 outv6 || test_failed $LINENO "$i" rm -f out0 out2 out6 outv0 outv2 outv6 || framework_failure - "${TARLZ}" -xf "$i" || test_failed $LINENO $i - cmp "${in_tar}" test.txt.tar || test_failed $LINENO $i - cmp "${test3}" test3.tar || test_failed $LINENO $i + "${TARLZ}" -xf "$i" || test_failed $LINENO "$i" + cmp "${in_tar}" test.txt.tar || test_failed $LINENO "$i" + cmp "${test3}" test3.tar || test_failed $LINENO "$i" rm -f test.txt.tar test3.tar || framework_failure done @@ -414,16 +425,16 @@ done # extended tar members split among lzip members for i in em1 em2 em3 em4 em5 em6 gh1 gh2 gh3 gh4 gh5 gh6 sm1 sm2 sm3 sm4 ; do for j in 0 2 6 ; do - "${TARLZ}" -tf "${testdir}"/test3_${i}.tar.lz -n$j > out || + "${TARLZ}" -n$j -tf "${testdir}"/test3_${i}.tar.lz > out || test_failed $LINENO "$i $j" diff -u list3 out || test_failed $LINENO "$i $j" - "${TARLZ}" -tvf "${testdir}"/test3_${i}.tar.lz -n$j > out || + "${TARLZ}" -n$j -tvf "${testdir}"/test3_${i}.tar.lz > out || test_failed $LINENO "$i $j" diff -u vlist3 out || test_failed $LINENO "$i $j" done rm -f out || framework_failure for j in 0 2 6 ; do - "${TARLZ}" -xf "${testdir}"/test3_${i}.tar.lz -n$j || + "${TARLZ}" -n$j -xf "${testdir}"/test3_${i}.tar.lz || test_failed $LINENO "$i $j" cmp cfoo foo || test_failed $LINENO "$i $j" cmp cbar bar || test_failed $LINENO "$i $j" @@ -431,6 +442,7 @@ for i in em1 em2 em3 em4 em5 em6 gh1 gh2 gh3 gh4 gh5 gh6 sm1 sm2 sm3 sm4 ; do rm -f foo bar baz || framework_failure done done +rm -f list3 vlist3 || framework_failure # test --concatenate compressed cat "${in}" > out.tar.lz || framework_failure # invalid tar.lz @@ -556,7 +568,7 @@ cat cbar > bar || framework_failure cat cbaz > baz || framework_failure "${TARLZ}" -0 -cf out.tar.lz foo bar baz --out-slots=1 || test_failed $LINENO "${TARLZ}" -0 -q -cf aout.tar.lz foo bar aout.tar.lz baz || test_failed $LINENO -cmp out.tar.lz aout.tar.lz || test_failed $LINENO +cmp out.tar.lz aout.tar.lz || test_failed $LINENO # test reproducible rm -f aout.tar.lz || framework_failure # "${TARLZ}" -0 -cf aout.tar.lz foo bar baz -C / || test_failed $LINENO @@ -638,25 +650,33 @@ rm -f out.tar foo bar baz || framework_failure "${TARLZ}" --uncompressed -cf out.tar foo || test_failed $LINENO "${TARLZ}" --uncompressed -cf aout.tar foo --anonymous || test_failed $LINENO if cmp out.tar aout.tar > /dev/null ; then - printf "\nwarning: '--diff' test can't be run as root." + printf "\nwarning: '--diff' test can't be run as root." else - "${TARLZ}" -df "${test3_lz}" > /dev/null - [ $? = 1 ] || test_failed $LINENO - "${TARLZ}" -df "${test3_lz}" --ignore-ids || test_failed $LINENO - "${TARLZ}" -df "${test3_lz}" --exclude '*' || test_failed $LINENO - "${TARLZ}" -df "${in_tar_lz}" --exclude '*' || test_failed $LINENO - rm -f bar || framework_failure - "${TARLZ}" -df "${test3_lz}" foo baz --ignore-ids || test_failed $LINENO - "${TARLZ}" -df "${test3_lz}" --exclude bar --ignore-ids || - test_failed $LINENO - rm -f foo baz || framework_failure - "${TARLZ}" -q -xf "${test3dir_lz}" || test_failed $LINENO - "${TARLZ}" -q -df "${test3dir_lz}" --ignore-ids || test_failed $LINENO - "${TARLZ}" -q -df "${test3dir_lz}" dir --ignore-ids || test_failed $LINENO - "${TARLZ}" -df "${test3_lz}" --ignore-ids -C dir || test_failed $LINENO - rm -rf dir || framework_failure + for i in 0 2 ; do + "${TARLZ}" -n$i -xf "${test3_lz}" || test_failed $LINENO + "${TARLZ}" -n$i -df "${test3_lz}" > out$i + [ $? = 1 ] || test_failed $LINENO $i + "${TARLZ}" -n$i -df "${test3_lz}" --ignore-ids || test_failed $LINENO $i + "${TARLZ}" -n$i -df "${test3_lz}" --exclude '*' || test_failed $LINENO $i + "${TARLZ}" -n$i -df "${in_tar_lz}" --exclude '*' || test_failed $LINENO $i + rm -f bar || framework_failure + "${TARLZ}" -n$i -df "${test3_lz}" foo baz --ignore-ids || + test_failed $LINENO $i + "${TARLZ}" -n$i -df "${test3_lz}" --exclude bar --ignore-ids || + test_failed $LINENO $i + rm -f foo baz || framework_failure + "${TARLZ}" -q -n$i -xf "${test3dir_lz}" || test_failed $LINENO $i + "${TARLZ}" -q -n$i -df "${test3dir_lz}" --ignore-ids || + test_failed $LINENO $i + "${TARLZ}" -q -n$i -df "${test3dir_lz}" dir --ignore-ids || + test_failed $LINENO $i + "${TARLZ}" -n$i -df "${test3_lz}" --ignore-ids -C dir || + test_failed $LINENO $i + rm -rf dir || framework_failure + done fi -rm -f out.tar aout.tar foo bar baz || framework_failure +cmp out0 out2 || test_failed $LINENO +rm -f out0 out2 out.tar aout.tar foo bar baz || framework_failure # test --delete for e in "" .lz ; do @@ -778,11 +798,12 @@ if [ "${ln_works}" = yes ] ; then "${TARLZ}" -0 -n0 -h -cf hout3 dir_link || test_failed $LINENO rm -rf dir dir_link || framework_failure for i in 1 2 3 ; do - "${TARLZ}" -xf out$i || test_failed $LINENO $i + "${TARLZ}" -xf out$i --exclude='dir_link/*' dir_link || + test_failed $LINENO $i # Cygwin stores dir_link/* [ -h dir_link ] || test_failed $LINENO $i - [ ! -e dir_link/foo ] || test_failed $LINENO $i - [ ! -e dir_link/bar ] || test_failed $LINENO $i - [ ! -e dir_link/baz ] || test_failed $LINENO $i + "${TARLZ}" -q -tf out$i dir_link/foo && cyg_symlink $LINENO $i + "${TARLZ}" -q -tf out$i dir_link/bar && cyg_symlink $LINENO $i + "${TARLZ}" -q -tf out$i dir_link/baz && cyg_symlink $LINENO $i rm -rf dir_link out$i || framework_failure "${TARLZ}" -xf hout$i || test_failed $LINENO $i [ -d dir_link ] || test_failed $LINENO $i |