Merging upstream version 0.9.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
2ab7382c1c
commit
f787962ed2
25 changed files with 1761 additions and 353 deletions
|
@ -1,6 +1,6 @@
|
|||
#! /bin/sh
|
||||
# check script for Tarlz - Archiver with multimember lzip compression
|
||||
# Copyright (C) 2013-2018 Antonio Diaz Diaz.
|
||||
# Copyright (C) 2013-2019 Antonio Diaz Diaz.
|
||||
#
|
||||
# This script is free software: you have unlimited permission
|
||||
# to copy, distribute and modify it.
|
||||
|
@ -38,6 +38,8 @@ test3="${testdir}"/test3.tar
|
|||
test3_lz="${testdir}"/test3.tar.lz
|
||||
test3dir_lz="${testdir}"/test3_dir.tar.lz
|
||||
test3dot_lz="${testdir}"/test3_dot.tar.lz
|
||||
tarint1_lz="${testdir}"/tar_in_tlz1.tar.lz
|
||||
tarint2_lz="${testdir}"/tar_in_tlz2.tar.lz
|
||||
t155="${testdir}"/t155.tar
|
||||
t155_lz="${testdir}"/t155.tar.lz
|
||||
tlzit1="${testdir}"/tlz_in_tar1.tar
|
||||
|
@ -58,11 +60,14 @@ fail=0
|
|||
lwarn=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-rc2 or newer\n$1"
|
||||
printf "\nwarning: testing --keep-damaged requires lzlib-1.11 or newer\n$1"
|
||||
lwarn=1 ; }
|
||||
|
||||
# Description of test files for tarlz:
|
||||
# t155.tar[.lz] directory + file + link + eof, all with 155 char names
|
||||
# test.txt.tar.lz: 1 member (test.txt).
|
||||
# t155.tar[.lz]: directory + file + link + eof, all with 155 char names
|
||||
# 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
|
||||
# test_bad1.tar.lz: truncated at offset 6000 (of 7495)
|
||||
# test_bad2.tar.lz: byte at offset 6000 changed from 0x56 to 0x46
|
||||
# test3.tar: 3 members (foo bar baz) + 2 zeroed 512-byte blocks
|
||||
|
@ -80,6 +85,9 @@ lzlib_1_11() { [ ${lwarn} = 0 ] &&
|
|||
# test3_bad4.tar.lz: combined damage of test3_bad2.tar.lz and test3_bad3.tar.lz
|
||||
# test3_bad5.tar.lz: [71-134] --> zeroed (first trailer + seconf header)
|
||||
# test3_bad6.tar.lz: 510 zeros prepended to test3.tar.lz (header in two blocks)
|
||||
# test3_eof1.tar.lz: test3.tar.lz without eof blocks
|
||||
# test3_eof2.tar.lz: test3.tar.lz with only one eof block
|
||||
# test3_eof3.tar.lz: test3.tar.lz with one zeroed block between foo and bar
|
||||
# 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
|
||||
# ug32chars.tar.lz: 1 member (foo) with 32-character owner and group names
|
||||
|
@ -155,7 +163,7 @@ rm -f test.txt || framework_failure
|
|||
"${TARLZ}" -xf "${in_tar}" --missing-crc || test_failed $LINENO
|
||||
cmp "${in}" test.txt || test_failed $LINENO
|
||||
rm -f test.txt || framework_failure
|
||||
|
||||
#
|
||||
printf "foo\n" > cfoo || framework_failure
|
||||
printf "bar\n" > cbar || framework_failure
|
||||
printf "baz\n" > cbaz || framework_failure
|
||||
|
@ -165,6 +173,7 @@ cmp cfoo foo || test_failed $LINENO
|
|||
cmp cbar bar || test_failed $LINENO
|
||||
cmp cbaz baz || test_failed $LINENO
|
||||
rm -f foo bar baz || framework_failure
|
||||
"${TARLZ}" -q -tf "${test3_lz}" ./foo ./bar ./baz || test_failed $LINENO
|
||||
"${TARLZ}" -q -xf "${test3_lz}" ./foo ./bar ./baz || test_failed $LINENO
|
||||
cmp cfoo foo || test_failed $LINENO
|
||||
cmp cbar bar || test_failed $LINENO
|
||||
|
@ -180,6 +189,7 @@ cmp cfoo foo || test_failed $LINENO
|
|||
cmp cbar bar || test_failed $LINENO
|
||||
cmp cbaz baz || test_failed $LINENO
|
||||
rm -f foo bar baz || framework_failure
|
||||
"${TARLZ}" -q -tf "${test3dot_lz}" foo bar baz || test_failed $LINENO
|
||||
"${TARLZ}" -q -xf "${test3dot_lz}" foo bar baz || test_failed $LINENO
|
||||
cmp cfoo foo || test_failed $LINENO
|
||||
cmp cbar bar || test_failed $LINENO
|
||||
|
@ -190,11 +200,75 @@ cmp cfoo dir/foo || test_failed $LINENO
|
|||
cmp cbar dir/bar || test_failed $LINENO
|
||||
cmp cbaz dir/baz || test_failed $LINENO
|
||||
rm -rf dir || framework_failure
|
||||
"${TARLZ}" -q -tf "${test3dir_lz}" dir/foo dir/bar dir/baz || test_failed $LINENO
|
||||
"${TARLZ}" -q -xf "${test3dir_lz}" dir/foo dir/bar dir/baz || test_failed $LINENO
|
||||
cmp cfoo dir/foo || test_failed $LINENO
|
||||
cmp cbar dir/bar || test_failed $LINENO
|
||||
cmp cbaz dir/baz || test_failed $LINENO
|
||||
rm -rf dir || framework_failure
|
||||
#
|
||||
"${TARLZ}" -q -tf "${testdir}"/test3_eof1.tar.lz
|
||||
[ $? = 2 ] || test_failed $LINENO
|
||||
"${TARLZ}" -q -tf "${testdir}"/test3_eof2.tar.lz || test_failed $LINENO
|
||||
"${TARLZ}" -q -tf "${testdir}"/test3_eof3.tar.lz || test_failed $LINENO
|
||||
"${TARLZ}" -q -n0 -tf "${testdir}"/test3_eof1.tar.lz
|
||||
[ $? = 2 ] || test_failed $LINENO
|
||||
"${TARLZ}" -q -n0 -tf "${testdir}"/test3_eof2.tar.lz || test_failed $LINENO
|
||||
"${TARLZ}" -q -n0 -tf "${testdir}"/test3_eof3.tar.lz || test_failed $LINENO
|
||||
#
|
||||
"${TARLZ}" -q -xf "${testdir}"/test3_eof1.tar.lz
|
||||
[ $? = 2 ] || test_failed $LINENO
|
||||
cmp cfoo foo || test_failed $LINENO
|
||||
cmp cbar bar || test_failed $LINENO
|
||||
cmp cbaz baz || test_failed $LINENO
|
||||
rm -f foo bar baz || framework_failure
|
||||
"${TARLZ}" -xf "${testdir}"/test3_eof2.tar.lz || test_failed $LINENO
|
||||
cmp cfoo foo || test_failed $LINENO
|
||||
cmp cbar bar || test_failed $LINENO
|
||||
cmp cbaz baz || test_failed $LINENO
|
||||
rm -f foo bar baz || framework_failure
|
||||
"${TARLZ}" -xf "${testdir}"/test3_eof3.tar.lz || test_failed $LINENO
|
||||
cmp cfoo foo || test_failed $LINENO
|
||||
[ ! -e bar ] || test_failed $LINENO
|
||||
[ ! -e baz ] || test_failed $LINENO
|
||||
rm -f foo bar baz || framework_failure
|
||||
#
|
||||
"${TARLZ}" -q -n0 -xf "${testdir}"/test3_eof1.tar.lz
|
||||
[ $? = 2 ] || test_failed $LINENO
|
||||
cmp cfoo foo || test_failed $LINENO
|
||||
cmp cbar bar || test_failed $LINENO
|
||||
cmp cbaz baz || test_failed $LINENO
|
||||
rm -f foo bar baz || framework_failure
|
||||
"${TARLZ}" -n0 -xf "${testdir}"/test3_eof2.tar.lz || test_failed $LINENO
|
||||
cmp cfoo foo || test_failed $LINENO
|
||||
cmp cbar bar || test_failed $LINENO
|
||||
cmp cbaz baz || test_failed $LINENO
|
||||
rm -f foo bar baz || framework_failure
|
||||
"${TARLZ}" -n0 -xf "${testdir}"/test3_eof3.tar.lz || test_failed $LINENO
|
||||
cmp cfoo foo || test_failed $LINENO
|
||||
[ ! -e bar ] || test_failed $LINENO
|
||||
[ ! -e baz ] || test_failed $LINENO
|
||||
rm -f foo bar baz || framework_failure
|
||||
#
|
||||
for i in "${tarint1_lz}" "${tarint2_lz}" ; do
|
||||
for j in 0 2 6 ; do
|
||||
"${TARLZ}" -tf "$i" --threads=$j > out$j ||
|
||||
test_failed $LINENO "$i $j"
|
||||
"${TARLZ}" -tvf "$i" --threads=$j > outv$j ||
|
||||
test_failed $LINENO "$i $j"
|
||||
done
|
||||
cmp out0 out2 || test_failed $LINENO
|
||||
cmp out0 out6 || test_failed $LINENO
|
||||
cmp out2 out6 || test_failed $LINENO
|
||||
cmp outv0 outv2 || test_failed $LINENO
|
||||
cmp outv0 outv2 || test_failed $LINENO
|
||||
cmp outv2 outv6 || test_failed $LINENO
|
||||
rm -f out0 out2 out6 outv0 outv2 outv6 || framework_failure
|
||||
"${TARLZ}" -xf "$i" || test_failed $LINENO
|
||||
cmp "${in_tar}" test.txt.tar || test_failed $LINENO
|
||||
cmp "${test3}" test3.tar || test_failed $LINENO
|
||||
rm -f test.txt.tar test3.tar || framework_failure
|
||||
done
|
||||
|
||||
# test --concatenate
|
||||
cat "${in_tar_lz}" > out.tar.lz || framework_failure
|
||||
|
@ -464,13 +538,13 @@ rm -f truncated.tar || framework_failure
|
|||
rm -f test.txt || framework_failure
|
||||
for i in "${inbad1}" "${inbad2}" ; do
|
||||
"${TARLZ}" -q -xf "${i}.tar.lz"
|
||||
[ $? = 2 ] || test_failed $LINENO "${i}"
|
||||
[ ! -e test.txt ] || test_failed $LINENO "${i}"
|
||||
[ $? = 2 ] || test_failed $LINENO "$i"
|
||||
[ ! -e test.txt ] || test_failed $LINENO "$i"
|
||||
rm -f test.txt || framework_failure
|
||||
"${TARLZ}" -q -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}"
|
||||
[ $? = 2 ] || test_failed $LINENO "$i"
|
||||
[ -e test.txt ] || test_failed $LINENO "$i"
|
||||
cmp "$i" test.txt 2> /dev/null || lzlib_1_11 "$LINENO $i"
|
||||
rm -f test.txt || framework_failure
|
||||
done
|
||||
#
|
||||
|
|
BIN
testsuite/tar_in_tlz1.tar.lz
Normal file
BIN
testsuite/tar_in_tlz1.tar.lz
Normal file
Binary file not shown.
BIN
testsuite/tar_in_tlz2.tar.lz
Normal file
BIN
testsuite/tar_in_tlz2.tar.lz
Normal file
Binary file not shown.
BIN
testsuite/test3_eof1.tar.lz
Normal file
BIN
testsuite/test3_eof1.tar.lz
Normal file
Binary file not shown.
BIN
testsuite/test3_eof2.tar.lz
Normal file
BIN
testsuite/test3_eof2.tar.lz
Normal file
Binary file not shown.
BIN
testsuite/test3_eof3.tar.lz
Normal file
BIN
testsuite/test3_eof3.tar.lz
Normal file
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue