#!/bin/sh : ${lha=@top_builddir@/src/lha} trap "rm -rf test-*" 0 1 2 3 15 declare -i test_number=0 exec > test.log message() { echo "$@" >&2 echo "$@" } check() { ((test_number = test_number + 1)) local status=$1 if [[ $status -eq 0 ]]; then message test $test_number ... ok else message test $test_number ... failed result=1 fi } message testing $lha message testing to create/list/extract lha archive. for i in `seq 100` do echo foo >> test-a done sed 's/foo/bar/g' < test-a > test-b sed 's/foo/baz/g' < test-a > test-c $lha c test-1.lzh test-a test-b test-c check $? test -s test-1.lzh check $? $lha l test-1.lzh check $? test -d test-1 || mkdir test-1 mv test-[abc] test-1 $lha x test-1.lzh check $? diff test-1/test-a test-a check $? diff test-1/test-b test-b check $? diff test-1/test-c test-c check $? message testing to generic, lh5, lh6 and lh7 method archive. $lha co test-m1.lzh test-a test-b test-c check $? $lha co5 test-m5.lzh test-a test-b test-c check $? $lha co6 test-m6.lzh test-a test-b test-c check $? $lha co7 test-m7.lzh test-a test-b test-c check $? $lha v test-m1.lzh | grep lh1 check $? $lha v test-m5.lzh | grep lh5 check $? $lha v test-m6.lzh | grep lh6 check $? $lha v test-m7.lzh | grep lh7 check $? $lha xw=test-m1 test-m1.lzh check $? $lha xw=test-m5 test-m5.lzh check $? $lha xw=test-m6 test-m6.lzh check $? $lha xw=test-m7 test-m7.lzh check $? diff -r test-1 test-m1 check $? diff -r test-1 test-m5 check $? diff -r test-1 test-m6 check $? diff -r test-1 test-m7 check $? message testing to print lha archive. $lha pq test-m1.lzh test-a | diff test-a - check $? $lha pq test-m5.lzh test-a | diff test-a - check $? $lha pq test-m6.lzh test-a | diff test-a - check $? $lha pq test-m7.lzh test-a | diff test-a - check $? cat test-[abc] > test-abc $lha pq test-m1.lzh | diff test-abc - check $? $lha pq test-m5.lzh | diff test-abc - check $? $lha pq test-m6.lzh | diff test-abc - check $? $lha pq test-m7.lzh | diff test-abc - check $? message testing to delete files from archive. cp test-m5.lzh test-2.lzh # do nothing $lha d test-2.lzh 2> test-stderr check $? test -s test-stderr check $? $lha d test-2.lzh test-a check $? $lha xw=test-2 test-2.lzh diff -r test-m5 test-2 2>&1 | grep -v '^Only in test-m5: test-a' test $? -eq 1 check $? rm -rf test-2 $lha d test-2.lzh test-b check $? $lha xw=test-2 test-2.lzh diff -r test-m5 test-2 2>&1 | grep -v '^Only in test-m5: test-a$' | grep -v '^Only in test-m5: test-b$' test $? -eq 1 check $? rm -rf test-2 $lha d test-2.lzh test-c 2> test-stderr check $? test -s test-stderr check $? test ! -f test-2.lzh check $? message testing to treat stdin/stdout as archive file. $lha c - test-a test-b test-c > test-3.lzh check $? cat test-3.lzh | $lha xw=test-3 - check $? diff -r test-m5 test-3 check $? exit $result