check() {
((test_number = test_number + 1))
local status=$1
+ local lineno=$2
if [[ $status -eq 0 ]]; then
message test $test_number ... ok
else
- message test $test_number ... failed
+ message test $test_number ... at line $lineno failed
((error_num = error_num + 1))
error_tests="$error_tests #$test_number"
result=1
sed 's/foo/baz/g' < test-a > test-c
$lha c test-1.lzh test-a test-b test-c
- check $?
+ check $? $LINENO
test -s test-1.lzh
- check $?
+ check $? $LINENO
$lha l test-1.lzh
- check $?
+ check $? $LINENO
test -d test-1 || mkdir test-1
mv test-[abc] test-1
$lha x test-1.lzh
- check $?
+ check $? $LINENO
diff test-1/test-a test-a
- check $?
+ check $? $LINENO
diff test-1/test-b test-b
- check $?
+ check $? $LINENO
diff test-1/test-c test-c
- check $?
+ check $? $LINENO
# followings are test data for remaining tests.
test -f test-1.lzh &&
test -f test-1/test-a &&
test -f test-1/test-b &&
test -f test-1/test-c
- check $?
+ check $? $LINENO
. $srcdir/lha-test2; cleanup
# -*- shell-script -*-
message testing header level 0, 1 and 2
$lha c0 test-tmp-h0.lzh test-1
- check $?
+ check $? $LINENO
$lha c1 test-tmp-h1.lzh test-1
- check $?
+ check $? $LINENO
$lha c2 test-tmp-h2.lzh test-1
- check $?
+ check $? $LINENO
$lha xw=test-tmp-h0 test-tmp-h0.lzh
- check $?
+ check $? $LINENO
$lha xw=test-tmp-h1 test-tmp-h1.lzh
- check $?
+ check $? $LINENO
$lha xw=test-tmp-h2 test-tmp-h2.lzh
- check $?
+ check $? $LINENO
$lha vv test-tmp-h0.lzh
- check $?
+ check $? $LINENO
$lha vv test-tmp-h1.lzh
- check $?
+ check $? $LINENO
$lha vv test-tmp-h2.lzh
- check $?
+ check $? $LINENO
$lha vv test-tmp-h0.lzh | grep '\[0\]$'
- check $?
+ check $? $LINENO
$lha vv test-tmp-h1.lzh | grep '\[1\]$'
- check $?
+ check $? $LINENO
$lha vv test-tmp-h2.lzh | grep '\[2\]$'
- check $?
+ check $? $LINENO
diff -r test-1 test-tmp-h0/test-1
- check $?
+ check $? $LINENO
diff -r test-1 test-tmp-h1/test-1
- check $?
+ check $? $LINENO
diff -r test-1 test-tmp-h2/test-1
- check $?
+ check $? $LINENO
mkdir test-tmp-d1 &&
cp test-a test-tmp-d1 &&
mkdir test-tmp-d1/d2 &&
cp test-b test-tmp-d1/d2 &&
mkdir test-tmp-d1/d2/d3 &&
cp test-c test-tmp-d1/d2/d3 &&
- check $?
+ check $? $LINENO
$lha c0 test-tmp2-h0.lzh test-tmp-d1
- check $?
+ check $? $LINENO
$lha c1 test-tmp2-h1.lzh test-tmp-d1
- check $?
+ check $? $LINENO
$lha c2 test-tmp2-h2.lzh test-tmp-d1
- check $?
+ check $? $LINENO
$lha xw=test-tmp2-h0 test-tmp2-h0.lzh
- check $?
+ check $? $LINENO
$lha xw=test-tmp2-h1 test-tmp2-h1.lzh
- check $?
+ check $? $LINENO
$lha xw=test-tmp2-h2 test-tmp2-h2.lzh
- check $?
+ check $? $LINENO
# for logging
$lha vv test-tmp2-h0.lzh
- check $?
+ check $? $LINENO
$lha vv test-tmp2-h1.lzh
- check $?
+ check $? $LINENO
$lha vv test-tmp2-h2.lzh
- check $?
+ check $? $LINENO
$lha vv test-tmp2-h0.lzh | grep '\[0\]$'
- check $?
+ check $? $LINENO
$lha vv test-tmp2-h1.lzh | grep '\[1\]$'
- check $?
+ check $? $LINENO
$lha vv test-tmp2-h2.lzh | grep '\[2\]$'
- check $?
+ check $? $LINENO
diff test-a test-tmp2-h0/test-tmp-d1/test-a
- check $?
+ check $? $LINENO
diff test-b test-tmp2-h0/test-tmp-d1/d2/test-b
- check $?
+ check $? $LINENO
diff test-c test-tmp2-h0/test-tmp-d1/d2/d3/test-c
- check $?
+ check $? $LINENO
diff test-a test-tmp2-h1/test-tmp-d1/test-a
- check $?
+ check $? $LINENO
diff test-b test-tmp2-h1/test-tmp-d1/d2/test-b
- check $?
+ check $? $LINENO
diff test-c test-tmp2-h1/test-tmp-d1/d2/d3/test-c
- check $?
+ check $? $LINENO
diff test-a test-tmp2-h2/test-tmp-d1/test-a
- check $?
+ check $? $LINENO
diff test-b test-tmp2-h2/test-tmp-d1/d2/test-b
- check $?
+ check $? $LINENO
diff test-c test-tmp2-h2/test-tmp-d1/d2/d3/test-c
- check $?
+ check $? $LINENO
# long long filename
# assume that we are allowed to create 255 bytes filename (not path name).
# the _POSIX_PATH_MAX (the maximam length of relative path name) value may
mkdir test-tmp3
case $(uname) in
CYGWIN*)
- # 200 bytes
+ # 220 bytes
file=12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890 ;;
*)
# 255 bytes
file=123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345 ;;
esac
(cd test-tmp3 && touch $file)
- check $?
+ check $? $LINENO
$lha cg test-tmp3-hg.lzh test-tmp3 2> test-stderr
- check $?
+ check $? $LINENO
test -s test-stderr
- check $?
+ check $? $LINENO
$lha c0 test-tmp3-h0.lzh test-tmp3 2> test-stderr
- check $?
+ check $? $LINENO
test -s test-stderr
- check $?
+ check $? $LINENO
$lha c1 test-tmp3-h1.lzh test-tmp3
- check $?
+ check $? $LINENO
$lha c2 test-tmp3-h2.lzh test-tmp3
- check $?
+ check $? $LINENO
$lha xw=test-tmp3-hg test-tmp3-hg.lzh
- check $?
+ check $? $LINENO
$lha xw=test-tmp3-h0 test-tmp3-h0.lzh
- check $?
+ check $? $LINENO
$lha xw=test-tmp3-h1 test-tmp3-h1.lzh
- check $?
+ check $? $LINENO
$lha xw=test-tmp3-h2 test-tmp3-h2.lzh
- check $?
+ check $? $LINENO
# for logging
$lha vv test-tmp3-hg.lzh
- check $?
+ check $? $LINENO
$lha vv test-tmp3-h0.lzh
- check $?
+ check $? $LINENO
$lha vv test-tmp3-h1.lzh
- check $?
+ check $? $LINENO
$lha vv test-tmp3-h2.lzh
- check $?
+ check $? $LINENO
$lha vv test-tmp3-hg.lzh | grep '\[0\]$'
- check $?
+ check $? $LINENO
$lha vv test-tmp3-h0.lzh | grep '\[0\]$'
- check $?
+ check $? $LINENO
$lha vv test-tmp3-h1.lzh | grep '\[1\]$'
- check $?
+ check $? $LINENO
$lha vv test-tmp3-h2.lzh | grep '\[2\]$'
- check $?
+ check $? $LINENO
test -f test-tmp3-hg/$(echo test-tmp3/$file | cut -c-233)
- check $?
+ check $? $LINENO
test -f test-tmp3-h0/$(echo test-tmp3/$file | cut -c-221)
- check $?
+ check $? $LINENO
test -f test-tmp3-h1/test-tmp3/$file
- check $?
+ check $? $LINENO
test -f test-tmp3-h2/test-tmp3/$file
- check $?
+ check $? $LINENO
# the header size is 0x101 instead of 0x100 on level 2 header
file=test-tmp9012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
touch $file
- check $?
+ check $? $LINENO
$lha c2 test-tmp4-h2.lzh $file
- check $?
+ check $? $LINENO
$lha vv test-tmp4-h2.lzh
- check $?
+ check $? $LINENO
$lha vv test-tmp4-h2.lzh | grep '\[2\]$'
- check $?
+ check $? $LINENO
$lha xw=test-tmp4 test-tmp4-h2.lzh
- check $?
+ check $? $LINENO
test x"`/bin/ls -l test-tmp4-h2.lzh | awk '{print $5}'`" = x258
- check $?
+ check $? $LINENO
test -f test-tmp4/$file
- check $?
+ check $? $LINENO
+echo $_
# -*- shell-script -*-
message testing to lh0, lh1, lh5, lh6 and lh7 method archive.
$lha cz test-tmp-m0.lzh test-a test-b test-c
- check $?
+ check $? $LINENO
$lha co test-tmp-m1.lzh test-a test-b test-c
- check $?
+ check $? $LINENO
$lha co5 test-tmp-m5.lzh test-a test-b test-c
- check $?
+ check $? $LINENO
$lha co6 test-tmp-m6.lzh test-a test-b test-c
- check $?
+ check $? $LINENO
$lha co7 test-tmp-m7.lzh test-a test-b test-c
- check $?
+ check $? $LINENO
$lha v test-tmp-m0.lzh | grep lh0
- check $?
+ check $? $LINENO
$lha v test-tmp-m1.lzh | grep lh1
- check $?
+ check $? $LINENO
$lha v test-tmp-m5.lzh | grep lh5
- check $?
+ check $? $LINENO
$lha v test-tmp-m6.lzh | grep lh6
- check $?
+ check $? $LINENO
$lha v test-tmp-m7.lzh | grep lh7
- check $?
+ check $? $LINENO
$lha xw=test-tmp-m0 test-tmp-m0.lzh
- check $?
+ check $? $LINENO
$lha xw=test-tmp-m1 test-tmp-m1.lzh
- check $?
+ check $? $LINENO
$lha xw=test-tmp-m5 test-tmp-m5.lzh
- check $?
+ check $? $LINENO
$lha xw=test-tmp-m6 test-tmp-m6.lzh
- check $?
+ check $? $LINENO
$lha xw=test-tmp-m7 test-tmp-m7.lzh
- check $?
+ check $? $LINENO
diff -r test-1 test-tmp-m0
- check $?
+ check $? $LINENO
diff -r test-1 test-tmp-m1
- check $?
+ check $? $LINENO
diff -r test-1 test-tmp-m5
- check $?
+ check $? $LINENO
diff -r test-1 test-tmp-m6
- check $?
+ check $? $LINENO
diff -r test-1 test-tmp-m7
- check $?
+ check $? $LINENO
$lha pq test-tmp-m0.lzh test-a | diff test-a -
- check $?
+ check $? $LINENO
$lha pq test-tmp-m1.lzh test-a | diff test-a -
- check $?
+ check $? $LINENO
$lha pq test-tmp-m5.lzh test-a | diff test-a -
- check $?
+ check $? $LINENO
$lha pq test-tmp-m6.lzh test-a | diff test-a -
- check $?
+ check $? $LINENO
$lha pq test-tmp-m7.lzh test-a | diff test-a -
- check $?
+ check $? $LINENO
cat test-[abc] > test-tmp-abc
$lha pq test-tmp-m0.lzh | diff test-tmp-abc -
- check $?
+ check $? $LINENO
$lha pq test-tmp-m1.lzh | diff test-tmp-abc -
- check $?
+ check $? $LINENO
$lha pq test-tmp-m5.lzh | diff test-tmp-abc -
- check $?
+ check $? $LINENO
$lha pq test-tmp-m6.lzh | diff test-tmp-abc -
- check $?
+ check $? $LINENO
$lha pq test-tmp-m7.lzh | diff test-tmp-abc -
- check $?
+ check $? $LINENO
# -*- shell-script -*-
message testing to generic format archive.
$lha czg test-tmp-m0g.lzh test-a test-b test-c
- check $?
+ check $? $LINENO
$lha cgo test-tmp-m1g.lzh test-a test-b test-c
- check $?
+ check $? $LINENO
$lha co5g test-tmp-m5g.lzh test-a test-b test-c
- check $?
+ check $? $LINENO
$lha co6g test-tmp-m6g.lzh test-a test-b test-c
- check $?
+ check $? $LINENO
$lha co7g test-tmp-m7g.lzh test-a test-b test-c
- check $?
+ check $? $LINENO
$lha v test-tmp-m0g.lzh
$lha v test-tmp-m0g.lzh | grep 'generic.*lh0'
- check $?
+ check $? $LINENO
$lha v test-tmp-m1g.lzh | grep 'generic.*lh1'
- check $?
+ check $? $LINENO
$lha v test-tmp-m5g.lzh | grep 'generic.*lh5'
- check $?
+ check $? $LINENO
$lha v test-tmp-m6g.lzh | grep 'generic.*lh6'
- check $?
+ check $? $LINENO
$lha v test-tmp-m7g.lzh | grep 'generic.*lh7'
- check $?
+ check $? $LINENO
$lha xw=test-tmp-m0g test-tmp-m0g.lzh
- check $?
+ check $? $LINENO
$lha xw=test-tmp-m1g test-tmp-m1g.lzh
- check $?
+ check $? $LINENO
$lha xw=test-tmp-m5g test-tmp-m5g.lzh
- check $?
+ check $? $LINENO
$lha xw=test-tmp-m6g test-tmp-m6g.lzh
- check $?
+ check $? $LINENO
$lha xw=test-tmp-m7g test-tmp-m7g.lzh
- check $?
+ check $? $LINENO
diff -r test-1 test-tmp-m0g
- check $?
+ check $? $LINENO
diff -r test-1 test-tmp-m1g
- check $?
+ check $? $LINENO
diff -r test-1 test-tmp-m5g
- check $?
+ check $? $LINENO
diff -r test-1 test-tmp-m6g
- check $?
+ check $? $LINENO
diff -r test-1 test-tmp-m7g
- check $?
+ check $? $LINENO
$lha pq test-tmp-m0g.lzh test-a | diff test-a -
- check $?
+ check $? $LINENO
$lha pq test-tmp-m1g.lzh test-a | diff test-a -
- check $?
+ check $? $LINENO
$lha pq test-tmp-m5g.lzh test-a | diff test-a -
- check $?
+ check $? $LINENO
$lha pq test-tmp-m6g.lzh test-a | diff test-a -
- check $?
+ check $? $LINENO
$lha pq test-tmp-m7g.lzh test-a | diff test-a -
- check $?
+ check $? $LINENO
cat test-[abc] > test-tmp-abc
$lha pq test-tmp-m0g.lzh | diff test-tmp-abc -
- check $?
+ check $? $LINENO
$lha pq test-tmp-m1g.lzh | diff test-tmp-abc -
- check $?
+ check $? $LINENO
$lha pq test-tmp-m5g.lzh | diff test-tmp-abc -
- check $?
+ check $? $LINENO
$lha pq test-tmp-m6g.lzh | diff test-tmp-abc -
- check $?
+ check $? $LINENO
$lha pq test-tmp-m7g.lzh | diff test-tmp-abc -
- check $?
+ check $? $LINENO
# do nothing
$lha d test-tmp.lzh 2> test-stderr
- check $?
+ check $? $LINENO
test -s test-stderr
- check $?
+ check $? $LINENO
$lha d test-tmp.lzh test-a
- check $?
+ check $? $LINENO
$lha xw=test-tmp test-tmp.lzh &&
test ! -f test-tmp/test-a &&
diff test-1/test-b test-tmp/test-b &&
diff test-1/test-c test-tmp/test-c
- check $?
+ check $? $LINENO
rm -rf test-tmp
- check $?
+ check $? $LINENO
$lha d test-tmp.lzh test-b
- check $?
+ check $? $LINENO
$lha xw=test-tmp test-tmp.lzh &&
test ! -f test-tmp/test-a &&
test ! -f test-tmp/test-b &&
diff test-1/test-c test-tmp/test-c
- check $?
+ check $? $LINENO
rm -rf test-tmp
- check $?
+ check $? $LINENO
$lha d test-tmp.lzh test-c 2> test-stderr
- check $?
+ check $? $LINENO
# this test will be failed on original LHa for UNIX.
: test -s test-stderr
- check $?
+ check $? $LINENO
test ! -f test-tmp.lzh
- check $?
+ check $? $LINENO
message testing to treat stdin/stdout as archive file.
$lha c - test-a test-b test-c > test-tmp.lzh
- check $?
+ check $? $LINENO
cat test-tmp.lzh | $lha xw=test-tmp -
- check $?
+ check $? $LINENO
diff -r test-1 test-tmp
- check $?
+ check $? $LINENO
test-b
test-c
EOF
- check $?
+ check $? $LINENO
echo test-b | $lha xw=test-tmp test-tmp.lzh
- check $?
+ check $? $LINENO
test ! -f test-tmp/test-a &&
test ! -f test-tmp/test-c &&
diff test-b test-tmp/test-b
- check $?
+ check $? $LINENO
# -*- shell-script -*-
message testing to add/update files to archive.
$lha a test-tmp.lzh test-c
- check $?
+ check $? $LINENO
$lha a test-tmp.lzh test-b
- check $?
+ check $? $LINENO
$lha u test-tmp.lzh test-a
- check $?
+ check $? $LINENO
$lha xw=test-tmp test-tmp.lzh
- check $?
+ check $? $LINENO
diff -r test-1 test-tmp
- check $?
+ check $? $LINENO
(cd test-tmp
echo foo > test-a
echo bar > test-b
# update with new files
$lha u ../test-tmp.lzh test-[abc]
)
- check $?
+ check $? $LINENO
# old files are in test-1 and in current directory
# new files are in test-tmp
$lha xw=test-tmp2 test-tmp.lzh
- check $?
+ check $? $LINENO
diff -r test-tmp test-tmp2
- check $?
+ check $? $LINENO
# no update with old files
$lha u test-tmp.lzh test-[abc]
$lha xw=test-tmp3 test-tmp.lzh
- check $?
+ check $? $LINENO
diff -r test-tmp test-tmp3
- check $?
+ check $? $LINENO
# replace with old files
$lha a test-tmp.lzh test-[abc]
$lha xw=test-tmp4 test-tmp.lzh
- check $?
+ check $? $LINENO
diff -r test-1 test-tmp4
- check $?
+ check $? $LINENO
# replace with new files
(cd test-tmp &&
$lha a ../test-tmp.lzh test-[abc]
)
$lha xw=test-tmp5 test-tmp.lzh
- check $?
+ check $? $LINENO
diff -r test-tmp test-tmp5
- check $?
+ check $? $LINENO
# -*- shell-script -*-
message testing timestamp
$lha c test-tmp.lzh test-[abc]
- check $?
+ check $? $LINENO
# show time stamp
$lha v test-tmp.lzh
ls -l test-[abc]
$lha xw=test-tmp test-tmp.lzh
- check $?
+ check $? $LINENO
diff -r test-1 test-tmp
- check $?
+ check $? $LINENO
test test-a -nt test-tmp/test-a ||
test test-a -ot test-tmp/test-a ||
test test-b -nt test-tmp/test-b ||
test test-c -nt test-tmp/test-c ||
test test-c -ot test-tmp/test-c
test $? -ne 0
- check $?
+ check $? $LINENO
echo baz > test-tmp/test-c &&
cp -pr test-tmp test-tmp2 &&
$lha c test-tmp.lzh test-tmp
- check $?
+ check $? $LINENO
$lha v test-tmp.lzh &&
$lha v test-1.lzh
- check $?
+ check $? $LINENO
# skip file
rm -rf test-tmp &&
cp -pr test-tmp2 test-tmp &&
pty 3 n $lha xw=test-tmp test-1.lzh
- check $?
+ check $? $LINENO
diff -r test-tmp test-tmp2
- check $?
+ check $? $LINENO
# overwrite
rm -rf test-tmp &&
cp -pr test-tmp2 test-tmp &&
pty 3 y $lha xw=test-tmp test-1.lzh
- check $?
+ check $? $LINENO
diff -r test-1 test-tmp
- check $?
+ check $? $LINENO
# overwrite all
rm -rf test-tmp &&
cp -pr test-1 test-tmp &&
pty 1 a $lha x test-tmp.lzh
- check $?
+ check $? $LINENO
diff -r test-tmp test-tmp2
- check $?
+ check $? $LINENO
# skip all
rm -rf test-tmp &&
cp -pr test-tmp2 test-tmp &&
pty 1 s $lha xw=test-tmp test-1.lzh
- check $?
+ check $? $LINENO
diff -r test-tmp test-tmp2
- check $?
+ check $? $LINENO