summaryrefslogtreecommitdiffstats
path: root/testsuite/check.sh
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/check.sh')
-rwxr-xr-xtestsuite/check.sh85
1 files changed, 47 insertions, 38 deletions
diff --git a/testsuite/check.sh b/testsuite/check.sh
index 00a56cd..1b6f3f7 100755
--- a/testsuite/check.sh
+++ b/testsuite/check.sh
@@ -182,7 +182,7 @@ rm -f test.txt || framework_failure
cmp "${in}" test.txt || test_failed $LINENO
rm -f test.txt || framework_failure
-# test3 reference files for diff
+# 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
@@ -195,6 +195,8 @@ rm -f out || framework_failure
cat "${testdir}"/rfoo > cfoo || framework_failure
cat "${testdir}"/rbar > cbar || framework_failure
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
@@ -253,7 +255,7 @@ for i in "${test3dir}" "${test3dir_lz}" ; do
rm -rf dir || framework_failure
done
-# --exclude
+# test --extract --exclude
"${TARLZ}" -xf "${test3}" --exclude='f*o' --exclude=baz || test_failed $LINENO
[ ! -e foo ] || test_failed $LINENO
cmp cbar bar || test_failed $LINENO
@@ -288,7 +290,7 @@ rm -rf dir || framework_failure
[ ! -e dir ] || test_failed $LINENO
rm -rf dir || framework_failure
-# eof
+# test --list and --extract eof
"${TARLZ}" -tvf "${testdir}"/test3_eof1.tar > out 2> /dev/null
[ $? = 2 ] || test_failed $LINENO
diff -u vlist3 out || test_failed $LINENO
@@ -456,8 +458,8 @@ cmp out.tar.lz aout.tar.lz || 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}"
+cat "${eof_lz}" > aout.tar.lz || framework_failure
+"${TARLZ}" -Aqf aout.tar.lz "${in_tar}" # concatenate to empty archive
[ $? = 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
@@ -609,7 +611,7 @@ cmp cbaz dir1/baz || test_failed $LINENO
rm -rf dir1 || framework_failure
rm -f out.tar.lz aout.tar.lz || framework_failure
-# --exclude
+# test --create --exclude
cat cfoo > foo || framework_failure
cat cbar > bar || framework_failure
cat cbaz > baz || framework_failure
@@ -631,6 +633,31 @@ cmp cfoo foo || test_failed $LINENO
[ ! -e baz ] || test_failed $LINENO
rm -f out.tar foo bar baz || framework_failure
+# 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."
+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
+fi
+rm -f out.tar aout.tar foo bar baz || framework_failure
+
# test --delete
for e in "" .lz ; do
"${TARLZ}" -A "${in_tar}"$e "${test3}"$e > out.tar$e || test_failed $LINENO $e
@@ -694,6 +721,10 @@ cat "${in}" > test.txt || framework_failure
"${TARLZ}" -0 -cf out.tar.lz foo bar baz --asolid || test_failed $LINENO
"${TARLZ}" -0 -rf out.tar.lz test.txt || test_failed $LINENO
rm -f foo bar baz test.txt || framework_failure
+for i in foo bar baz ; do
+ "${TARLZ}" -qf out.tar.lz --delete $i
+ [ $? = 2 ] || test_failed $LINENO
+done
"${TARLZ}" -f out.tar.lz --delete test.txt || test_failed $LINENO
"${TARLZ}" -xf out.tar.lz || test_failed $LINENO
cmp cfoo foo || test_failed $LINENO
@@ -732,7 +763,7 @@ 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
@@ -762,7 +793,7 @@ if [ "${ln_works}" = yes ] ; then
done
fi
-# test --append
+# test --append compressed
cat cfoo > foo || framework_failure
cat cbar > bar || framework_failure
cat cbaz > baz || framework_failure
@@ -801,7 +832,7 @@ cmp out.tar.lz aout.tar.lz || test_failed $LINENO
cmp out.tar.lz aout.tar.lz || test_failed $LINENO
rm -f out.tar.lz aout.tar.lz || framework_failure
-# --uncompressed
+# test --append --uncompressed
"${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
@@ -837,7 +868,7 @@ cmp out.tar aout.tar || test_failed $LINENO
cmp out.tar aout.tar || test_failed $LINENO
rm -f out.tar aout.tar || framework_failure
-# append to solid archive
+# test --append to solid archive
"${TARLZ}" --solid -q -0 -cf out.tar.lz "${in}" foo bar || test_failed $LINENO
"${TARLZ}" -q -tf out.tar.lz || test_failed $LINENO # compressed seekable
cat out.tar.lz > aout.tar.lz || framework_failure
@@ -863,31 +894,7 @@ for i in --asolid --bsolid --dsolid -0 ; do
done
rm -f foo bar baz || framework_failure
-# 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."
-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
- rm -rf dir || framework_failure
-fi
-rm -f out.tar aout.tar foo bar baz || framework_failure
-
-# test directories and links
+# test -c -d -x on directories and links
mkdir dir1 || framework_failure
"${TARLZ}" -0 -cf out.tar.lz dir1 || test_failed $LINENO
rmdir dir1 || framework_failure
@@ -984,6 +991,7 @@ rm -f foo || framework_failure
printf "\ntesting bad input..."
+# test --extract ".."
mkdir dir1 || framework_failure
cd dir1 || framework_failure
"${TARLZ}" -q -xf "${testdir}"/dotdot1.tar.lz || test_failed $LINENO
@@ -999,6 +1007,7 @@ cd dir1 || framework_failure
cd .. || framework_failure
rm -rf dir1 || framework_failure
+# test --list and --extract truncated tar
dd if="${in_tar}" of=truncated.tar bs=1000 count=1 2> /dev/null
"${TARLZ}" -q -tf truncated.tar > /dev/null
[ $? = 2 ] || test_failed $LINENO
@@ -1024,7 +1033,7 @@ for i in 1 2 3 4 ; do
rm -f out.tar.lz foo bar baz || framework_failure
done
-# test format violations
+# test --list and --extract format violations
if [ "${ln_works}" = yes ] ; then
mkdir dir1 || framework_failure
"${TARLZ}" -C dir1 -xf "${t155}" || test_failed $LINENO
@@ -1059,7 +1068,7 @@ if [ "${ln_works}" = yes ] ; then
rm -rf dir1 || framework_failure
fi
-# test compressed and --keep-damaged
+# test --extract and --keep-damaged compressed
rm -f test.txt || framework_failure
for i in "${inbad1}" "${inbad2}" ; do
"${TARLZ}" -q -xf "${i}.tar.lz"
@@ -1128,7 +1137,7 @@ cmp cfoo foo || test_failed $LINENO
cmp cbar bar || test_failed $LINENO
cmp cbaz baz || test_failed $LINENO
-# test uncompressed and --keep-damaged
+# test --extract and --keep-damaged uncompressed
rm -f test.txt || framework_failure
"${TARLZ}" -q -xf "${inbad1}.tar"
[ $? = 2 ] || test_failed $LINENO