summaryrefslogtreecommitdiffstats
path: root/testsuite/check.sh
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/check.sh')
-rwxr-xr-xtestsuite/check.sh246
1 files changed, 220 insertions, 26 deletions
diff --git a/testsuite/check.sh b/testsuite/check.sh
index aea9fbf..29330cf 100755
--- a/testsuite/check.sh
+++ b/testsuite/check.sh
@@ -55,6 +55,7 @@ bad3_lz="${testdir}"/test3_bad3.tar.lz
bad4_lz="${testdir}"/test3_bad4.tar.lz
bad5_lz="${testdir}"/test3_bad5.tar.lz
bad6_lz="${testdir}"/test3_bad6.tar.lz
+eof="${testdir}"/eof.tar
eof_lz="${testdir}"/eof.tar.lz
fail=0
lwarn=0
@@ -112,17 +113,13 @@ printf "testing tarlz-%s..." "$2"
[ ! -e out.tar.lz ] || test_failed $LINENO
"${TARLZ}" -rf out.tar.lz || test_failed $LINENO
[ ! -e out.tar.lz ] || test_failed $LINENO
-"${TARLZ}" -q -rf - "${in}"
-[ $? = 1 ] || test_failed $LINENO
-[ ! -e - ] || test_failed $LINENO
-"${TARLZ}" -q -r "${in}"
-[ $? = 1 ] || test_failed $LINENO
+"${TARLZ}" -r || test_failed $LINENO
"${TARLZ}" --uncompressed -q -rf out.tar "${in}"
[ $? = 1 ] || test_failed $LINENO
[ ! -e out.tar ] || test_failed $LINENO
cat "${test3_lz}" > test.tar.lz || framework_failure
"${TARLZ}" --uncompressed -q -rf test.tar.lz "${in}"
-[ $? = 1 ] || test_failed $LINENO
+[ $? = 2 ] || test_failed $LINENO
cmp "${test3_lz}" test.tar.lz || test_failed $LINENO
rm -f test.tar.lz || framework_failure
cat "${test3}" > test.tar || framework_failure
@@ -175,7 +172,7 @@ rm -f test.txt || framework_failure
cmp "${in}" test.txt || test_failed $LINENO
rm -f test.txt || framework_failure
-# reference files for cmp
+# test3 reference files for cmp
cat "${testdir}"/rfoo > cfoo || framework_failure
cat "${testdir}"/rbar > cbar || framework_failure
cat "${testdir}"/rbaz > cbaz || framework_failure
@@ -223,7 +220,31 @@ 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
-#
+
+# --exclude
+"${TARLZ}" -xf "${test3}" --exclude='f*o' --exclude=baz || test_failed $LINENO
+[ ! -e foo ] || test_failed $LINENO
+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 || 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
+
+# eof
"${TARLZ}" -q -tf "${testdir}"/test3_eof1.tar.lz
[ $? = 2 ] || test_failed $LINENO
"${TARLZ}" -q -tf "${testdir}"/test3_eof2.tar.lz || test_failed $LINENO
@@ -314,6 +335,9 @@ for i in 1 2 3 4 5 6 ; do
done
# test --concatenate
+cat "${in}" > out.tar.lz || framework_failure # invalid tar.lz
+"${TARLZ}" -Aqf out.tar.lz "${test3_lz}"
+[ $? = 2 ] || test_failed $LINENO
cat "${in_tar_lz}" > out.tar.lz || framework_failure
"${TARLZ}" -Af out.tar.lz "${test3_lz}" || test_failed $LINENO
"${TARLZ}" -xf out.tar.lz || test_failed $LINENO
@@ -321,14 +345,82 @@ cmp "${in}" test.txt || test_failed $LINENO
cmp cfoo foo || test_failed $LINENO
cmp cbar bar || test_failed $LINENO
cmp cbaz baz || test_failed $LINENO
+rm -f test.txt foo bar baz || framework_failure
touch aout.tar.lz || framework_failure # concatenate to empty file
+"${TARLZ}" -Aqf aout.tar.lz "${in_tar}"
+[ $? = 2 ] || test_failed $LINENO
+"${TARLZ}" -Af aout.tar.lz "${in_tar_lz}" "${test3_lz}" || test_failed $LINENO
+cmp out.tar.lz aout.tar.lz || test_failed $LINENO
+"${TARLZ}" -Af aout.tar.lz || test_failed $LINENO # concatenate nothing
+cmp out.tar.lz aout.tar.lz || test_failed $LINENO
+"${TARLZ}" -Aqf aout.tar.lz aout.tar.lz || test_failed $LINENO
+cmp out.tar.lz aout.tar.lz || test_failed $LINENO
+"${TARLZ}" -Aq "${in_tar_lz}" "${test3}" > aout.tar.lz # to stdout
+[ $? = 2 ] || test_failed $LINENO
+cmp "${in_tar_lz}" aout.tar.lz || test_failed $LINENO
+"${TARLZ}" -A "${in_tar_lz}" "${test3_lz}" > aout.tar.lz || test_failed $LINENO
+cmp out.tar.lz aout.tar.lz || test_failed $LINENO
+cat "${eof_lz}" > aout.tar.lz || framework_failure # concatenate to empty archive
+"${TARLZ}" -Aqf aout.tar.lz "${in_tar}"
+[ $? = 2 ] || test_failed $LINENO
"${TARLZ}" -Af aout.tar.lz "${in_tar_lz}" "${test3_lz}" || test_failed $LINENO
cmp out.tar.lz aout.tar.lz || test_failed $LINENO
cat "${in_tar_lz}" > aout.tar.lz || framework_failure
"${TARLZ}" -Aqf aout.tar.lz "${test3_lz}" "${test3}"
[ $? = 2 ] || test_failed $LINENO
cmp out.tar.lz aout.tar.lz || test_failed $LINENO
-rm -f test.txt foo bar baz out.tar.lz aout.tar.lz || framework_failure
+rm -f aout.tar.lz || framework_failure
+touch aout.tar.lz || framework_failure # --exclude
+"${TARLZ}" -Af aout.tar.lz "${in_tar_lz}" "${test3_lz}" --exclude 'test3*' ||
+ test_failed $LINENO
+"${TARLZ}" -Af aout.tar.lz "${in_tar_lz}" "${test3_lz}" --exclude '*txt*' ||
+ test_failed $LINENO
+cmp out.tar.lz aout.tar.lz || test_failed $LINENO
+rm -f out.tar.lz aout.tar.lz || framework_failure
+
+# --uncompressed
+cat "${in}" > out.tar || framework_failure # invalid tar
+"${TARLZ}" -Aqf out.tar "${test3}"
+[ $? = 2 ] || test_failed $LINENO
+cat "${in_tar}" > out.tar || framework_failure
+"${TARLZ}" -Af out.tar "${test3}" || test_failed $LINENO
+"${TARLZ}" -xf out.tar || test_failed $LINENO
+cmp "${in}" test.txt || test_failed $LINENO
+cmp cfoo foo || test_failed $LINENO
+cmp cbar bar || test_failed $LINENO
+cmp cbaz baz || test_failed $LINENO
+rm -f test.txt foo bar baz || framework_failure
+touch aout.tar || framework_failure # concatenate to empty file
+"${TARLZ}" -Aqf aout.tar "${in_tar_lz}"
+[ $? = 2 ] || test_failed $LINENO
+"${TARLZ}" -Af aout.tar "${in_tar}" "${test3}" || test_failed $LINENO
+cmp out.tar aout.tar || test_failed $LINENO
+"${TARLZ}" -Af aout.tar || test_failed $LINENO # concatenate nothing
+cmp out.tar aout.tar || test_failed $LINENO
+"${TARLZ}" -Aqf aout.tar aout.tar || test_failed $LINENO
+cmp out.tar aout.tar || test_failed $LINENO
+"${TARLZ}" -Aq "${in_tar}" "${test3_lz}" > aout.tar # to stdout
+[ $? = 2 ] || test_failed $LINENO
+cmp "${in_tar}" aout.tar || test_failed $LINENO
+"${TARLZ}" -A "${in_tar}" "${test3}" > aout.tar || test_failed $LINENO
+cmp out.tar aout.tar || test_failed $LINENO
+cat "${eof}" > aout.tar || framework_failure # concatenate to empty archive
+"${TARLZ}" -Aqf aout.tar "${in_tar_lz}"
+[ $? = 2 ] || test_failed $LINENO
+"${TARLZ}" -Af aout.tar "${in_tar}" "${test3}" || test_failed $LINENO
+cmp out.tar aout.tar || test_failed $LINENO
+cat "${in_tar}" > aout.tar || framework_failure
+"${TARLZ}" -Aqf aout.tar "${test3}" "${test3_lz}"
+[ $? = 2 ] || test_failed $LINENO
+cmp out.tar aout.tar || test_failed $LINENO
+rm -f aout.tar || framework_failure
+touch aout.tar || framework_failure # --exclude
+"${TARLZ}" -Af aout.tar "${test3}" "${in_tar}" --exclude 'test3*' ||
+ test_failed $LINENO
+"${TARLZ}" -Af aout.tar "${test3}" "${in_tar}" --exclude '*txt*' ||
+ test_failed $LINENO
+cmp out.tar aout.tar || test_failed $LINENO
+rm -f out.tar aout.tar || framework_failure
# test --create
cat "${in}" > test.txt || framework_failure
@@ -346,7 +438,7 @@ rm -f test.txt out.tar out.tar.lz || framework_failure
cat cfoo > foo || framework_failure
rm -f bar || framework_failure
cat cbaz > baz || framework_failure
-"${TARLZ}" -q -cf out.tar.lz foo bar baz
+"${TARLZ}" -0 -q -cf out.tar.lz foo bar baz
[ $? = 1 ] || test_failed $LINENO
rm -f foo bar baz || framework_failure
"${TARLZ}" -xf out.tar.lz --missing-crc || test_failed $LINENO
@@ -364,13 +456,9 @@ rm -f out.tar.lz || framework_failure
cat cfoo > foo || framework_failure
cat cbar > bar || framework_failure
cat cbaz > baz || framework_failure
-"${TARLZ}" -0 -cf out.tar.lz foo bar baz || test_failed $LINENO
+"${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
-"${TARLZ}" -q -Af aout.tar.lz aout.tar.lz || test_failed $LINENO
-cmp out.tar.lz aout.tar.lz || test_failed $LINENO
-"${TARLZ}" -q -rf aout.tar.lz aout.tar.lz || test_failed $LINENO
-cmp out.tar.lz aout.tar.lz || test_failed $LINENO
rm -f aout.tar.lz || framework_failure
#
"${TARLZ}" -0 -cf aout.tar.lz foo bar baz -C / || test_failed $LINENO
@@ -425,16 +513,81 @@ cmp cbaz dir1/baz || test_failed $LINENO
rm -rf dir1 || framework_failure
rm -f out.tar.lz aout.tar.lz || framework_failure
+# --exclude
+cat cfoo > foo || framework_failure
+cat cbar > bar || framework_failure
+cat cbaz > baz || framework_failure
+"${TARLZ}" -0 -cf out.tar.lz foo bar baz --exclude 'ba?' || test_failed $LINENO
+rm -f foo bar baz || framework_failure
+"${TARLZ}" -xf out.tar.lz || test_failed $LINENO
+cmp cfoo foo || test_failed $LINENO
+[ ! -e bar ] || test_failed $LINENO
+[ ! -e baz ] || test_failed $LINENO
+rm -f out.tar.lz foo bar baz || framework_failure
+cat cfoo > foo || framework_failure
+cat cbar > bar || framework_failure
+cat cbaz > baz || framework_failure
+"${TARLZ}" --un -cf out.tar foo bar baz --exclude 'ba*' || test_failed $LINENO
+rm -f foo bar baz || framework_failure
+"${TARLZ}" -xf out.tar || test_failed $LINENO
+cmp cfoo foo || test_failed $LINENO
+[ ! -e bar ] || test_failed $LINENO
+[ ! -e baz ] || test_failed $LINENO
+rm -f out.tar foo bar baz || framework_failure
+
+# 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."
+fi
+rm -f dummy_slink dummy_link dummy_file || framework_failure
+
+if [ "${ln_works}" = yes ] ; then
+ mkdir dir || framework_failure
+ cat cfoo > dir/foo || framework_failure
+ cat cbar > dir/bar || framework_failure
+ cat cbaz > dir/baz || framework_failure
+ ln -s dir dir_link || framework_failure
+ "${TARLZ}" -0 -cf out1 dir_link || test_failed $LINENO
+ "${TARLZ}" --un -cf out2 dir_link || test_failed $LINENO
+ "${TARLZ}" -0 -n0 -cf out3 dir_link || test_failed $LINENO
+ "${TARLZ}" -0 -h -cf hout1 dir_link || test_failed $LINENO
+ "${TARLZ}" --un -h -cf hout2 dir_link || test_failed $LINENO
+ "${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
+ [ -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
+ rm -rf dir_link out$i || framework_failure
+ "${TARLZ}" -xf hout$i || test_failed $LINENO $i
+ [ -d dir_link ] || test_failed $LINENO $i
+ cmp cfoo dir_link/foo || test_failed $LINENO $i
+ cmp cbar dir_link/bar || test_failed $LINENO $i
+ cmp cbaz dir_link/baz || test_failed $LINENO $i
+ rm -rf dir_link hout$i || framework_failure
+ done
+fi
+
# test --append
cat cfoo > foo || framework_failure
cat cbar > bar || framework_failure
cat cbaz > baz || framework_failure
-"${TARLZ}" -0 -cf out.tar.lz foo bar baz || test_failed $LINENO
+"${TARLZ}" -0 -cf out.tar.lz foo bar baz --out-slots=1024 || test_failed $LINENO
"${TARLZ}" -0 -cf nout.tar.lz foo bar baz --no-solid || test_failed $LINENO
"${TARLZ}" -0 -cf aout.tar.lz foo || test_failed $LINENO
"${TARLZ}" -0 -rf aout.tar.lz bar baz --no-solid || test_failed $LINENO
cmp nout.tar.lz aout.tar.lz || test_failed $LINENO
rm -f nout.tar.lz aout.tar.lz || framework_failure
+touch aout.tar || framework_failure # wrong extension empty file
+"${TARLZ}" -0 -rf aout.tar foo bar baz || test_failed $LINENO
+cmp out.tar.lz aout.tar || test_failed $LINENO
+rm -f aout.tar || framework_failure
touch aout.tar.lz || framework_failure # append to empty file
"${TARLZ}" -0 -rf aout.tar.lz foo bar baz || test_failed $LINENO
cmp out.tar.lz aout.tar.lz || test_failed $LINENO
@@ -445,10 +598,55 @@ cmp out.tar.lz aout.tar.lz || test_failed $LINENO
"${TARLZ}" -0 -q -rf aout.tar.lz nx_file
[ $? = 1 ] || test_failed $LINENO
cmp out.tar.lz aout.tar.lz || test_failed $LINENO
-cat "${eof_lz}" > aout.tar.lz || framework_failure # append to empty archive
+"${TARLZ}" -0 -q -rf aout.tar.lz aout.tar.lz || test_failed $LINENO
+cmp out.tar.lz aout.tar.lz || test_failed $LINENO
+"${TARLZ}" -0 -r foo bar baz > aout.tar.lz || test_failed $LINENO # to stdout
+cmp out.tar.lz aout.tar.lz || test_failed $LINENO
+"${TARLZ}" --un -q -rf aout.tar.lz foo bar baz # wrong extension archive
+[ $? = 2 ] || test_failed $LINENO
+cmp out.tar.lz aout.tar.lz || test_failed $LINENO
+cat "${eof_lz}" > aout.tar.lz || framework_failure # append to empty archive
"${TARLZ}" -0 -rf aout.tar.lz foo bar baz || test_failed $LINENO
cmp out.tar.lz aout.tar.lz || test_failed $LINENO
+"${TARLZ}" --un -q -rf aout.tar.lz foo bar baz # wrong extension empty archive
+[ $? = 2 ] || test_failed $LINENO
+cmp out.tar.lz aout.tar.lz || test_failed $LINENO
rm -f out.tar.lz aout.tar.lz || framework_failure
+#
+"${TARLZ}" --un -cf out.tar foo bar baz || test_failed $LINENO
+"${TARLZ}" --un -cf aout.tar foo || test_failed $LINENO
+"${TARLZ}" --un -rf aout.tar foo bar baz --exclude foo || test_failed $LINENO
+cmp out.tar aout.tar || test_failed $LINENO
+rm -f aout.tar || framework_failure
+touch aout.tar.lz empty || framework_failure # wrong extension empty file
+"${TARLZ}" --un -q -rf aout.tar.lz foo bar baz
+[ $? = 2 ] || test_failed $LINENO
+cmp aout.tar.lz empty || test_failed $LINENO
+rm -f aout.tar.lz empty || framework_failure
+touch aout.tar || framework_failure # append to empty file
+"${TARLZ}" --un -rf aout.tar foo bar baz || test_failed $LINENO
+cmp out.tar aout.tar || test_failed $LINENO
+"${TARLZ}" --un -rf aout.tar || test_failed $LINENO # append nothing
+cmp out.tar aout.tar || test_failed $LINENO
+"${TARLZ}" --un -rf aout.tar -C nx_dir || test_failed $LINENO
+cmp out.tar aout.tar || test_failed $LINENO
+"${TARLZ}" --un -q -rf aout.tar nx_file
+[ $? = 1 ] || test_failed $LINENO
+cmp out.tar aout.tar || test_failed $LINENO
+"${TARLZ}" --un -q -rf aout.tar aout.tar || test_failed $LINENO
+cmp out.tar aout.tar || test_failed $LINENO
+"${TARLZ}" --un -r foo bar baz > aout.tar || test_failed $LINENO # to stdout
+cmp out.tar aout.tar || test_failed $LINENO
+"${TARLZ}" -0 -q -rf aout.tar foo bar baz # wrong extension archive
+[ $? = 2 ] || test_failed $LINENO
+cmp out.tar aout.tar || test_failed $LINENO
+cat "${eof}" > aout.tar || framework_failure # append to empty archive
+"${TARLZ}" --un -rf aout.tar foo bar baz || test_failed $LINENO
+cmp out.tar aout.tar || test_failed $LINENO
+"${TARLZ}" -0 -q -rf aout.tar foo bar baz # wrong extension empty archive
+[ $? = 2 ] || test_failed $LINENO
+cmp out.tar aout.tar || test_failed $LINENO
+rm -f out.tar aout.tar || framework_failure
# append to solid archive
"${TARLZ}" --solid -q -0 -cf out.tar.lz "${in}" foo bar || test_failed $LINENO
@@ -483,9 +681,11 @@ rm -f foo bar baz || framework_failure
if cmp out.tar aout.tar > /dev/null ; then
printf "\nwarning: --diff test can't be run as root."
else
- "${TARLZ}" -q -df "${test3_lz}"
+ "${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
fi
rm -f out.tar aout.tar foo bar baz || framework_failure
@@ -505,10 +705,7 @@ rmdir dir1 || framework_failure
rmdir dir1
rm -f out.tar || framework_failure
-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
+if [ "${ln_works}" = yes ] ; then
name_100=name_100_bytes_long_nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn
path_100=dir1/dir2/dir3/path_100_bytes_long_nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn
path_106=dir1/dir2/dir3/path_longer_than_100_bytes_nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn
@@ -543,15 +740,12 @@ if ln dummy_file dummy_link 2> /dev/null &&
cmp "${in}" dir1/dir2/dir3/link || test_failed $LINENO
"${TARLZ}" -0 -q -c ../tmp/dir1 | "${TARLZ}" -x || test_failed $LINENO
diff -ru tmp/dir1 dir1 || test_failed $LINENO
- rm -rf tmp/dir1 dir1 || framework_failure
+ rm -rf tmp dir1 || framework_failure
"${TARLZ}" -xf "${testdir}"/ts_in_link.tar.lz || test_failed $LINENO
"${TARLZ}" -df "${testdir}"/ts_in_link.tar.lz --ignore-ids ||
test_failed $LINENO
rm -f link1 link2 link3 link4 || framework_failure
-else
- printf "\nwarning: skipping link test: 'ln' does not work on your system."
fi
-rm -f dummy_slink dummy_link dummy_file || framework_failure
printf "\ntesting long names..."