summaryrefslogtreecommitdiffstats
path: root/testsuite
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xtestsuite/check.sh213
1 files changed, 120 insertions, 93 deletions
diff --git a/testsuite/check.sh b/testsuite/check.sh
index 74e8549..13ef132 100755
--- a/testsuite/check.sh
+++ b/testsuite/check.sh
@@ -1,6 +1,6 @@
#! /bin/sh
# check script for Tarlz - Archiver with multimember lzip compression
-# Copyright (C) 2013-2020 Antonio Diaz Diaz.
+# Copyright (C) 2013-2021 Antonio Diaz Diaz.
#
# This script is free software: you have unlimited permission
# to copy, distribute, and modify it.
@@ -39,8 +39,6 @@ test3_lz="${testdir}"/test3.tar.lz
test3dir="${testdir}"/test3_dir.tar
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
@@ -115,6 +113,7 @@ cyg_symlink() { [ ${lwarnc} = 0 ] &&
# Note that multi-threaded --list succeeds with test_bad2.txt.tar.lz and
# test3_bad3.tar.lz because their headers are intact.
+"${TARLZ}" --check-lib # just print warning
printf "testing tarlz-%s..." "$2"
"${TARLZ}" -q -tf "${in}"
@@ -181,25 +180,31 @@ rm -f empty.tar.lz empty.tlz || framework_failure
"${TARLZ}" --group=invalid_goup_name -tf "${test3_lz}" 2> /dev/null
[ $? = 1 ] || test_failed $LINENO
+printf "\ntesting --list and --extract..."
+
# test --list and --extract
"${TARLZ}" -tf "${eof_lz}" --missing-crc || test_failed $LINENO
"${TARLZ}" -xf "${eof_lz}" --missing-crc || test_failed $LINENO
-"${TARLZ}" -tf "${in_tar_lz}" --missing-crc > /dev/null || test_failed $LINENO
-"${TARLZ}" -xf "${in_tar_lz}" --missing-crc || test_failed $LINENO
-cmp "${in}" test.txt || test_failed $LINENO
-rm -f test.txt || framework_failure
"${TARLZ}" -C nx_dir -tf "${in_tar}" > /dev/null || test_failed $LINENO
"${TARLZ}" -xf "${in_tar}" --missing-crc || test_failed $LINENO
cmp "${in}" test.txt || test_failed $LINENO
rm -f test.txt || framework_failure
+"${TARLZ}" -tf "${in_tar_lz}" --missing-crc > /dev/null || test_failed $LINENO
+for i in 0 2 6 ; do
+ "${TARLZ}" -n$i -xf "${in_tar_lz}" --missing-crc || test_failed $LINENO $i
+ cmp "${in}" test.txt || test_failed $LINENO $i
+ rm -f test.txt || framework_failure
+done
# test3 reference files for -t and -tv (list3, vlist3)
"${TARLZ}" -tf "${test3}" > list3 || test_failed $LINENO
"${TARLZ}" -tvf "${test3}" > vlist3 || test_failed $LINENO
-"${TARLZ}" -tf "${test3_lz}" > out || test_failed $LINENO
-diff -u list3 out || test_failed $LINENO
-"${TARLZ}" -tvf "${test3_lz}" > out || test_failed $LINENO
-diff -u vlist3 out || test_failed $LINENO
+for i in 0 2 6 ; do
+ "${TARLZ}" -n$i -tf "${test3_lz}" > out || test_failed $LINENO $i
+ diff -u list3 out || test_failed $LINENO $i
+ "${TARLZ}" -n$i -tvf "${test3_lz}" > out || test_failed $LINENO $i
+ diff -u vlist3 out || test_failed $LINENO $i
+done
rm -f out || framework_failure
# test3 reference files for cmp
@@ -209,41 +214,43 @@ cat "${testdir}"/rbaz > cbaz || framework_failure
# test --list and --extract test3
rm -f foo bar baz || framework_failure
-"${TARLZ}" -xf "${test3_lz}" --missing-crc || 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}" -tvf "${test3_lz}" ./foo ./bar ./baz > out 2> /dev/null ||
- test_failed $LINENO
-diff -u vlist3 out || test_failed $LINENO
-rm -f out || framework_failure
-"${TARLZ}" -q -xf "${test3_lz}" ./foo ./bar ./baz || 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 "${test3_lz}" foo/ bar// baz/// || 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 "${test3}" --missing-crc || 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}" -q -xf "${test3dot_lz}" --missing-crc || 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}" -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
-cmp cbaz baz || test_failed $LINENO
-rm -f foo bar baz || framework_failure
+for i in 0 2 6 ; do
+ "${TARLZ}" -n$i -xf "${test3_lz}" --missing-crc || test_failed $LINENO $i
+ cmp cfoo foo || test_failed $LINENO $i
+ cmp cbar bar || test_failed $LINENO $i
+ cmp cbaz baz || test_failed $LINENO $i
+ rm -f foo bar baz || framework_failure
+ "${TARLZ}" -n$i -tvf "${test3_lz}" ./foo ./bar ./baz > out 2> /dev/null ||
+ test_failed $LINENO $i
+ diff -u vlist3 out || test_failed $LINENO $i
+ rm -f out || framework_failure
+ "${TARLZ}" -q -n$i -xf "${test3_lz}" ./foo ./bar ./baz || test_failed $LINENO $i
+ cmp cfoo foo || test_failed $LINENO $i
+ cmp cbar bar || test_failed $LINENO $i
+ cmp cbaz baz || test_failed $LINENO $i
+ rm -f foo bar baz || framework_failure
+ "${TARLZ}" -n$i -xf "${test3_lz}" foo/ bar// baz/// || test_failed $LINENO $i
+ cmp cfoo foo || test_failed $LINENO $i
+ cmp cbar bar || test_failed $LINENO $i
+ cmp cbaz baz || test_failed $LINENO $i
+ rm -f foo bar baz || framework_failure
+ "${TARLZ}" -q -n$i -xf "${test3dot_lz}" --missing-crc || test_failed $LINENO $i
+ cmp cfoo foo || test_failed $LINENO $i
+ cmp cbar bar || test_failed $LINENO $i
+ cmp cbaz baz || test_failed $LINENO $i
+ rm -f foo bar baz || framework_failure
+ "${TARLZ}" -q -n$i -tf "${test3dot_lz}" foo bar baz || test_failed $LINENO $i
+ "${TARLZ}" -q -n$i -xf "${test3dot_lz}" foo bar baz || test_failed $LINENO $i
+ cmp cfoo foo || test_failed $LINENO $i
+ cmp cbar bar || test_failed $LINENO $i
+ cmp cbaz baz || test_failed $LINENO $i
+ rm -f foo bar baz || framework_failure
+done
for i in "${test3dir}" "${test3dir_lz}" ; do
"${TARLZ}" -q -tf "$i" --missing-crc || test_failed $LINENO "$i"
@@ -272,34 +279,37 @@ done
cmp cbar bar || test_failed $LINENO
[ ! -e baz ] || test_failed $LINENO
rm -f foo bar baz || framework_failure
-"${TARLZ}" -xf "${test3_lz}" --exclude=bar || test_failed $LINENO
-cmp cfoo foo || test_failed $LINENO
-[ ! -e bar ] || test_failed $LINENO
-cmp cbaz baz || test_failed $LINENO
-rm -f foo bar baz || framework_failure
-"${TARLZ}" -q -xf "${test3dir_lz}" --exclude='?ar' || test_failed $LINENO
-cmp cfoo dir/foo || test_failed $LINENO
-[ ! -e dir/bar ] || test_failed $LINENO
-cmp cbaz dir/baz || test_failed $LINENO
-rm -rf dir || framework_failure
-"${TARLZ}" -q -xf "${test3dir_lz}" --exclude=dir/bar || test_failed $LINENO
-cmp cfoo dir/foo || test_failed $LINENO
-[ ! -e dir/bar ] || test_failed $LINENO
-cmp cbaz dir/baz || test_failed $LINENO
-rm -rf dir || framework_failure
-"${TARLZ}" -q -xf "${test3dir_lz}" --exclude=dir || test_failed $LINENO
-[ ! -e dir ] || test_failed $LINENO
-rm -rf dir || framework_failure
-"${TARLZ}" -q -xf "${test3dir_lz}" --exclude='dir/*' || test_failed $LINENO
-[ ! -e dir ] || test_failed $LINENO
-rm -rf dir || framework_failure
-"${TARLZ}" -q -xf "${test3dir_lz}" --exclude='[bf][ao][orz]' ||
- test_failed $LINENO
-[ ! -e dir ] || test_failed $LINENO
-rm -rf dir || framework_failure
-"${TARLZ}" -q -xf "${test3dir_lz}" --exclude='*o' dir/foo || test_failed $LINENO
-[ ! -e dir ] || test_failed $LINENO
-rm -rf dir || framework_failure
+for i in 0 2 6 ; do
+ "${TARLZ}" -n$i -xf "${test3_lz}" --exclude=bar || 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 -n$i -xf "${test3dir_lz}" --exclude='?ar' || test_failed $LINENO $i
+ cmp cfoo dir/foo || test_failed $LINENO $i
+ [ ! -e dir/bar ] || test_failed $LINENO $i
+ cmp cbaz dir/baz || test_failed $LINENO $i
+ rm -rf dir || framework_failure
+ "${TARLZ}" -q -n$i -xf "${test3dir_lz}" --exclude=dir/bar || test_failed $LINENO $i
+ cmp cfoo dir/foo || test_failed $LINENO $i
+ [ ! -e dir/bar ] || test_failed $LINENO $i
+ cmp cbaz dir/baz || test_failed $LINENO $i
+ rm -rf dir || framework_failure
+ "${TARLZ}" -q -n$i -xf "${test3dir_lz}" --exclude=dir || test_failed $LINENO $i
+ [ ! -e dir ] || test_failed $LINENO $i
+ rm -rf dir || framework_failure
+ "${TARLZ}" -q -n$i -xf "${test3dir_lz}" --exclude='dir/*' || test_failed $LINENO $i
+ [ ! -e dir ] || test_failed $LINENO $i
+ rm -rf dir || framework_failure
+ "${TARLZ}" -q -n$i -xf "${test3dir_lz}" --exclude='[bf][ao][orz]' ||
+ test_failed $LINENO $i
+ [ ! -e dir ] || test_failed $LINENO $i
+ rm -rf dir || framework_failure
+ "${TARLZ}" -q -n$i -xf "${test3dir_lz}" --exclude='*o' dir/foo ||
+ test_failed $LINENO $i
+ [ ! -e dir ] || test_failed $LINENO $i
+ rm -rf dir || framework_failure
+done
# test --list and --extract eof
"${TARLZ}" -tvf "${testdir}"/test3_eof1.tar > out 2> /dev/null
@@ -365,12 +375,6 @@ for i in 0 2 6 ; do
cmp cbar bar || test_failed $LINENO $i
cmp cbaz baz || test_failed $LINENO $i
rm -f foo bar baz || framework_failure
- "${TARLZ}" -n$i -xf "${testdir}"/test3_eof3.tar.lz ||
- test_failed $LINENO $i
- cmp cfoo foo || test_failed $LINENO $i
- [ ! -e bar ] || test_failed $LINENO $i
- [ ! -e baz ] || test_failed $LINENO $i
- rm -f foo bar baz || framework_failure
"${TARLZ}" -q -n$i -xf "${testdir}"/test3_eof4.tar.lz
[ $? = 2 ] || test_failed $LINENO $i
cmp cfoo foo || test_failed $LINENO $i
@@ -384,9 +388,14 @@ for i in 0 2 6 ; do
cmp cbaz baz || test_failed $LINENO $i
rm -f foo bar baz || framework_failure
done
+"${TARLZ}" -n0 -xf "${testdir}"/test3_eof3.tar.lz || test_failed $LINENO
+cmp cfoo foo || test_failed $LINENO $i
+[ ! -e bar ] || test_failed $LINENO $i
+[ ! -e baz ] || test_failed $LINENO $i
+rm -f foo bar baz || framework_failure
# test --list and --extract tar in tar.lz
-for i in "${tarint1_lz}" "${tarint2_lz}" ; do
+for i in "${testdir}"/tar_in_tlz1.tar.lz "${testdir}"/tar_in_tlz2.tar.lz ; do
for j in 0 2 6 ; do
"${TARLZ}" -tf "$i" -n$j > out$j ||
test_failed $LINENO "$i $j"
@@ -400,10 +409,12 @@ for i in "${tarint1_lz}" "${tarint2_lz}" ; do
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"
- rm -f test.txt.tar test3.tar || framework_failure
+ for j in 0 2 6 ; do
+ "${TARLZ}" -xf "$i" -n$j || test_failed $LINENO "$i $j"
+ cmp "${in_tar}" test.txt.tar || test_failed $LINENO "$i $j"
+ cmp "${test3}" test3.tar || test_failed $LINENO "$i $j"
+ rm -f test.txt.tar test3.tar || framework_failure
+ done
done
# test --list and --extract with global headers uncompressed
@@ -444,6 +455,8 @@ for i in em1 em2 em3 em4 em5 em6 gh1 gh2 gh3 gh4 gh5 gh6 sm1 sm2 sm3 sm4 ; do
done
rm -f list3 vlist3 || framework_failure
+printf "\ntesting --concatenate..."
+
# test --concatenate compressed
cat "${in}" > out.tar.lz || framework_failure # invalid tar.lz
"${TARLZ}" -Aqf out.tar.lz "${test3_lz}"
@@ -532,6 +545,8 @@ touch aout.tar || framework_failure # --exclude
cmp out.tar aout.tar || test_failed $LINENO
rm -f out.tar aout.tar || framework_failure
+printf "\ntesting --create..."
+
# test --create
cat "${in}" > test.txt || framework_failure
"${TARLZ}" -0 -cf out.tar.lz test.txt || test_failed $LINENO
@@ -645,14 +660,16 @@ cmp cfoo foo || test_failed $LINENO
[ ! -e baz ] || test_failed $LINENO
rm -f out.tar foo bar baz || framework_failure
+printf "\ntesting --diff..."
+
# test --diff
"${TARLZ}" -xf "${test3_lz}" || test_failed $LINENO
"${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.\n"
else
- for i in 0 2 ; do
+ for i in 0 2 6 ; do
"${TARLZ}" -n$i -xf "${test3_lz}" || test_failed $LINENO
"${TARLZ}" -n$i -df "${test3_lz}" > out$i
[ $? = 1 ] || test_failed $LINENO $i
@@ -678,6 +695,8 @@ fi
cmp out0 out2 || test_failed $LINENO
rm -f out0 out2 out.tar aout.tar foo bar baz || framework_failure
+printf "\ntesting --delete..."
+
# test --delete
for e in "" .lz ; do
"${TARLZ}" -A "${in_tar}"$e "${test3}"$e > out.tar$e || test_failed $LINENO $e
@@ -774,13 +793,15 @@ for i in 1 2 3 4 ; do
rm -f out.tar || framework_failure
done
+printf "\ntesting --dereference..."
+
# test --dereference
touch dummy_file || framework_failure
if ln dummy_file dummy_link 2> /dev/null &&
ln -s dummy_file dummy_slink 2> /dev/null ; then
ln_works=yes
else
- printf "\nwarning: skipping link test: 'ln' does not work on your system."
+ printf "\nwarning: skipping link test: 'ln' does not work on your system.\n"
fi
rm -f dummy_slink dummy_link dummy_file || framework_failure
#
@@ -814,6 +835,8 @@ if [ "${ln_works}" = yes ] ; then
done
fi
+printf "\ntesting --append..."
+
# test --append compressed
cat cfoo > foo || framework_failure
cat cbar > bar || framework_failure
@@ -915,6 +938,8 @@ for i in --asolid --bsolid --dsolid -0 ; do
done
rm -f foo bar baz || framework_failure
+printf "\ntesting dirs and links..."
+
# test -c -d -x on directories and links
mkdir dir1 || framework_failure
"${TARLZ}" -0 -cf out.tar.lz dir1 || test_failed $LINENO
@@ -1089,6 +1114,8 @@ if [ "${ln_works}" = yes ] ; then
rm -rf dir1 || framework_failure
fi
+printf "\ntesting --keep-damaged..."
+
# test --extract and --keep-damaged compressed
rm -f test.txt || framework_failure
for i in "${inbad1}" "${inbad2}" ; do
@@ -1096,7 +1123,7 @@ for i in "${inbad1}" "${inbad2}" ; do
[ $? = 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
+ "${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"
@@ -1104,55 +1131,55 @@ for i in "${inbad1}" "${inbad2}" ; do
done
#
rm -f foo bar baz || framework_failure
-"${TARLZ}" -q -xf "${bad1_lz}"
+"${TARLZ}" -q -n0 -xf "${bad1_lz}"
[ $? = 2 ] || test_failed $LINENO
[ ! -e 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 -xf "${bad2_lz}"
+"${TARLZ}" -q -n0 -xf "${bad2_lz}"
[ $? = 2 ] || test_failed $LINENO
[ ! -e 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 -xf "${bad3_lz}"
+"${TARLZ}" -q -n0 -xf "${bad3_lz}"
[ $? = 2 ] || test_failed $LINENO
cmp cfoo foo || test_failed $LINENO
[ ! -e bar ] || test_failed $LINENO
cmp cbaz baz || test_failed $LINENO
rm -f foo bar baz || framework_failure
-"${TARLZ}" -q -xf "${bad3_lz}" --keep-damaged
+"${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 cbaz baz || test_failed $LINENO
rm -f foo bar baz || framework_failure
-"${TARLZ}" -q -xf "${bad4_lz}"
+"${TARLZ}" -q -n0 -xf "${bad4_lz}"
[ $? = 2 ] || test_failed $LINENO
[ ! -e foo ] || test_failed $LINENO
[ ! -e bar ] || test_failed $LINENO
cmp cbaz baz || test_failed $LINENO
rm -f foo bar baz || framework_failure
-"${TARLZ}" -q -xf "${bad4_lz}" --keep-damaged
+"${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 cbaz baz || test_failed $LINENO
rm -f foo bar baz || framework_failure
-"${TARLZ}" -q -xf "${bad5_lz}"
+"${TARLZ}" -q -n0 -xf "${bad5_lz}"
[ $? = 2 ] || test_failed $LINENO
[ ! -e foo ] || test_failed $LINENO
[ ! -e bar ] || test_failed $LINENO
cmp cbaz baz || test_failed $LINENO
rm -f foo bar baz || framework_failure
-"${TARLZ}" -q -xf "${bad5_lz}" --keep-damaged
+"${TARLZ}" -q -n0 -xf "${bad5_lz}" --keep-damaged
[ $? = 2 ] || test_failed $LINENO
cmp cfoo foo 2> /dev/null || lzlib_1_11 $LINENO
[ ! -e bar ] || test_failed $LINENO
cmp cbaz baz || test_failed $LINENO
rm -f foo bar baz || framework_failure
-"${TARLZ}" -q -xf "${bad6_lz}"
+"${TARLZ}" -q -n0 -xf "${bad6_lz}"
[ $? = 2 ] || test_failed $LINENO
cmp cfoo foo || test_failed $LINENO
cmp cbar bar || test_failed $LINENO