summaryrefslogtreecommitdiffstats
path: root/testsuite/check.sh
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/check.sh')
-rwxr-xr-xtestsuite/check.sh99
1 files changed, 59 insertions, 40 deletions
diff --git a/testsuite/check.sh b/testsuite/check.sh
index e1e3f60..9899c15 100755
--- a/testsuite/check.sh
+++ b/testsuite/check.sh
@@ -72,7 +72,8 @@ lzlib_1_11() { [ ${lwarn} = 0 ] &&
# 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
# test3_dir.tar.lz: like test3.tar.lz but members /dir/foo /dir/bar /dir/baz
-# test3_dot.tar.lz: like test3.tar.lz but members ./foo ./bar ./baz
+# test3_dot.tar.lz: 3 times 3 members ./foo ././bar ./././baz
+# the 3 central members with filename in extended header
# test3_bad1.tar: byte at offset 259 changed from 't' to '0' (magic)
# test3_bad2.tar: byte at offset 1283 changed from 't' to '0' (magic)
# test3_bad3.tar: byte at offset 2559 changed from 0x00 to 0x20 (padding)
@@ -131,6 +132,12 @@ rm -f test.tar || framework_failure
[ $? = 1 ] || test_failed $LINENO
"${TARLZ}" -q -x -C nx_dir "${test3_lz}"
[ $? = 1 ] || test_failed $LINENO
+touch empty.tar.lz empty.tlz # list an empty lz file
+"${TARLZ}" -q -tf empty.tar.lz
+[ $? = 2 ] || test_failed $LINENO
+"${TARLZ}" -q -tf empty.tlz
+[ $? = 2 ] || test_failed $LINENO
+rm -f empty.tar.lz empty.tlz || framework_failure
"${TARLZ}" -q -cr
[ $? = 1 ] || test_failed $LINENO
"${TARLZ}" -q -ct
@@ -180,6 +187,11 @@ 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
@@ -330,41 +342,20 @@ 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
-
-# test --append
-"${TARLZ}" --dsolid -0 -cf aout.tar.lz foo bar baz || test_failed $LINENO
+#
+"${TARLZ}" -0 -cf aout.tar.lz foo bar baz -C / || test_failed $LINENO
cmp out.tar.lz aout.tar.lz || test_failed $LINENO
rm -f aout.tar.lz || framework_failure
-"${TARLZ}" -0 -q -cf aout.tar.lz foo/ ./bar ./baz/ || test_failed $LINENO
+"${TARLZ}" -0 -C / -cf aout.tar.lz -C "${objdir}"/tmp foo bar baz ||
+ 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 || test_failed $LINENO
-"${TARLZ}" -0 -rf aout.tar.lz bar baz || test_failed $LINENO
+"${TARLZ}" --asolid -0 -cf aout.tar.lz foo bar baz || test_failed $LINENO
cmp out.tar.lz aout.tar.lz || test_failed $LINENO
rm -f aout.tar.lz || 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
-"${TARLZ}" -0 -rf aout.tar.lz || test_failed $LINENO # append nothing
-cmp out.tar.lz aout.tar.lz || test_failed $LINENO
-"${TARLZ}" -0 -rf aout.tar.lz -C nx_dir || test_failed $LINENO
-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 -rf aout.tar.lz foo bar baz || test_failed $LINENO
+"${TARLZ}" -0 -q -cf aout.tar.lz foo/ ./bar ./baz/ || test_failed $LINENO
cmp out.tar.lz aout.tar.lz || test_failed $LINENO
-rm -f foo bar baz || framework_failure
-"${TARLZ}" -xf out.tar.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 out.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 aout.tar.lz || framework_failure
mkdir dir1 || framework_failure
"${TARLZ}" -C dir1 -xf out.tar.lz || test_failed $LINENO
cmp cfoo dir1/foo || test_failed $LINENO
@@ -397,17 +388,39 @@ rm -f foo dir1/bar baz || framework_failure
test_failed $LINENO
cmp out.tar.lz aout.tar.lz || test_failed $LINENO
"${TARLZ}" -0 -cf aout.tar.lz dir1/foo dir1/baz || test_failed $LINENO
-rm -rf dir1 || framework_failure
+rm -rf dir1 bar || framework_failure
"${TARLZ}" -xf aout.tar.lz dir1 || test_failed $LINENO
cmp cfoo dir1/foo || test_failed $LINENO
cmp cbaz dir1/baz || test_failed $LINENO
rm -rf dir1 || framework_failure
rm -f out.tar.lz aout.tar.lz || framework_failure
-# append to solid archive
+# 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 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.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
+"${TARLZ}" -0 -rf aout.tar.lz || test_failed $LINENO # append nothing
+cmp out.tar.lz aout.tar.lz || test_failed $LINENO
+"${TARLZ}" -0 -rf aout.tar.lz -C nx_dir || test_failed $LINENO
+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 -rf aout.tar.lz foo bar baz || test_failed $LINENO
+cmp out.tar.lz aout.tar.lz || test_failed $LINENO
+rm -f out.tar.lz aout.tar.lz || framework_failure
+
+# append to solid archive
"${TARLZ}" --solid -0 -cf out.tar.lz foo || test_failed $LINENO
cat out.tar.lz > aout.tar.lz || framework_failure
for i in --asolid --bsolid --dsolid --solid -0 ; do
@@ -434,11 +447,12 @@ rm -f foo bar baz || framework_failure
# test directories and links
mkdir dir1 || framework_failure
-"${TARLZ}" -0 -cf out.tar dir1 || test_failed $LINENO
+"${TARLZ}" -0 -cf out.tar.lz dir1 || test_failed $LINENO
rmdir dir1 || framework_failure
-"${TARLZ}" -xf out.tar || test_failed $LINENO
+"${TARLZ}" -xf out.tar.lz || test_failed $LINENO
[ -d dir1 ] || test_failed $LINENO
rmdir dir1
+rm -f out.tar.lz || framework_failure
mkdir dir1 || framework_failure
"${TARLZ}" --uncompressed -cf out.tar dir1 || test_failed $LINENO
rmdir dir1 || framework_failure
@@ -463,9 +477,9 @@ if ln dummy_file dummy_link 2> /dev/null &&
ln dir1/dir2/dir3/in "${path_106}" || framework_failure
ln -s in dir1/dir2/dir3/link || framework_failure
ln -s "${name_100}" dir1/dir2/dir3/link_100 || framework_failure
- "${TARLZ}" -0 -cf out.tar dir1 || test_failed $LINENO
+ "${TARLZ}" -0 -cf out.tar.lz dir1 || test_failed $LINENO
rm -rf dir1 || framework_failure
- "${TARLZ}" -xf out.tar || test_failed $LINENO
+ "${TARLZ}" -xf out.tar.lz || test_failed $LINENO
cmp "${in}" dir1/dir2/dir3/in || test_failed $LINENO
cmp "${in}" dir1/dir2/dir3/"${name_100}" || test_failed $LINENO
cmp "${in}" "${path_100}" || test_failed $LINENO
@@ -475,12 +489,13 @@ if ln dummy_file dummy_link 2> /dev/null &&
rm -f dir1/dir2/dir3/in || framework_failure
cmp "${in}" dir1/dir2/dir3/link 2> /dev/null && test_failed $LINENO
cmp "${in}" dir1/dir2/dir3/link_100 || test_failed $LINENO
- "${TARLZ}" -xf out.tar || test_failed $LINENO
- rm -f out.tar || framework_failure
+ "${TARLZ}" -xf out.tar.lz || test_failed $LINENO
+ rm -f out.tar.lz || framework_failure
cmp "${in}" dir1/dir2/dir3/in || test_failed $LINENO
cmp "${in}" dir1/dir2/dir3/link || test_failed $LINENO
- "${TARLZ}" -0 -q -c ../tmp/dir1 > /dev/null || test_failed $LINENO
- rm -rf dir1 || framework_failure
+ "${TARLZ}" -0 -q -c ../tmp/dir1 | "${TARLZ}" -x || test_failed $LINENO
+ diff -r tmp/dir1 dir1 || test_failed $LINENO
+ rm -rf tmp/dir1 dir1 || framework_failure
else
printf "\nwarning: skipping link test: 'ln' does not work on your system."
fi
@@ -496,9 +511,13 @@ if [ "${ln_works}" = yes ] ; then
mkdir dir2 || framework_failure
"${TARLZ}" -C dir2 -xf "${t155_lz}" || test_failed $LINENO
diff -r dir1 dir2 || test_failed $LINENO
+ "${TARLZ}" -cf out.tar.lz dir2 || test_failed $LINENO
+ rm -rf dir2 || framework_failure
+ "${TARLZ}" -xf out.tar.lz || test_failed $LINENO
+ diff -r dir1 dir2 || test_failed $LINENO
rmdir dir2 2> /dev/null && test_failed $LINENO
rmdir dir1 2> /dev/null && test_failed $LINENO
- rm -rf dir2 dir1 || framework_failure
+ rm -rf out.tar.lz dir2 dir1 || framework_failure
fi
"${TARLZ}" -tvf "${testdir}"/ug32chars.tar.lz | grep -q \