OSDN Git Service

* tests/lha-test.in: all tests are splited into some files.
authorarai <arai@6a8cc165-1e22-0410-a132-eb4e3f353aba>
Thu, 20 Jun 2002 15:57:01 +0000 (15:57 +0000)
committerarai <arai@6a8cc165-1e22-0410-a132-eb4e3f353aba>
Thu, 20 Jun 2002 15:57:01 +0000 (15:57 +0000)
* tests/lha-test2: ditto.

* tests/lha-test3: ditto.

* tests/lha-test4: ditto.

* tests/lha-test5: ditto.

* tests/lha-test6: ditto.

* tests/lha-test7: ditto.

* tests/lha-test8: ditto.

git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/lha/lha/trunk@211 6a8cc165-1e22-0410-a132-eb4e3f353aba

tests/lha-test.in
tests/lha-test2 [new file with mode: 0644]
tests/lha-test3 [new file with mode: 0644]
tests/lha-test4 [new file with mode: 0644]
tests/lha-test5 [new file with mode: 0644]
tests/lha-test6 [new file with mode: 0644]
tests/lha-test7 [new file with mode: 0644]
tests/lha-test8 [new file with mode: 0644]

index 2f48c50..11f90a8 100644 (file)
@@ -2,6 +2,7 @@
 
 : ${lha_dir=@top_builddir@/src}
 : ${lha=$(cd $lha_dir && pwd)/lha}
+: ${srcdir=@srcdir@}
 
 trap "rm -rf test-*" 0 1 2 3 15
 
@@ -31,6 +32,13 @@ seq() {
   }'
 }
 
+cleanup()
+{
+  rm -rf test-tmp*
+}
+
+# create test data
+
 message testing $lha
 message testing to create/list/extract lha archive.
 
@@ -60,183 +68,24 @@ diff test-1/test-b test-b
 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 &&
-test ! -f test-2/test-a &&
-diff test-1/test-b test-2/test-b &&
-diff test-1/test-c test-2/test-c
-                                                       check $?
-rm -rf test-2
-                                                       check $?
-$lha d test-2.lzh test-b
-                                                       check $?
-$lha xw=test-2 test-2.lzh &&
-test ! -f test-2/test-a &&
-test ! -f test-2/test-b &&
-diff test-1/test-c test-2/test-c
-                                                       check $?
-rm -rf test-2
-                                                       check $?
-$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 $?
-
-# message testing to treat stdin/stdout as file list.
-# # On MinGW, these tests will fail for now.
-# cat <<EOF | $lha c test-4.lzh
-# test-a
-# test-b
-# test-c
-# EOF
-#                                                      check $?
-# echo test-b | $lha xw=test-4 test-4.lzh
-#                                                      check $?
-# test ! -f test-4/test-a &&
-# test ! -f test-4/test-c &&
-# diff test-b test-4/test-b
-#                                                      check $?
-
-message testing to add/update files to archive.
-$lha a test-5.lzh test-c
-                                                       check $?
-$lha a test-5.lzh test-b
-                                                       check $?
-$lha a test-5.lzh test-a
-                                                       check $?
-$lha xw=test-5 test-5.lzh
-                                                       check $?
-diff -r test-1 test-5
+# followings are test data for remaining tests.
+test -f test-1.lzh &&
+test -f test-a &&
+test -f test-b &&
+test -f test-c &&
+test -d test-1 &&
+test -f test-1/test-a &&
+test -f test-1/test-b &&
+test -f test-1/test-c
                                                        check $?
-mkdir test-5.2 &&
-(cd test-5.2
- echo foo > test-a
- echo bar > test-b
- echo baz > test-c
-
- $lha u ../test-5.lzh test-[abc]
-)
-                                                       check $?
-$lha xw=test-5.3 test-5.lzh
-                                                       check $?
-diff -r test-5.2 test-5.3
-                                                       check $?
-# no update old files
-(cd test-5 &&
- $lha u ../test-5.lzh test-[abc]
-)
 
-$lha xw=test-5.4 test-5.lzh
-                                                       check $?
-diff -r test-5.3 test-5.4
-                                                       check $?
-# replace old files
-(cd test-5 &&
- $lha a ../test-5.lzh test-[abc]
-)
-$lha xw=test-5.5 test-5.lzh
-                                                       check $?
-diff -r test-5 test-5.5
-                                                       check $?
-
-message testing timestamp
-$lha c test-6.lzh test-[abc]
-                                                       check $?
-# show time stamp
-$lha v test-6.lzh
-ls -l test-[abc]
 
-$lha xw=test-6 test-6.lzh
-                                                       check $?
-test -f test-6/test-a &&
-test -f test-6/test-b &&
-test -f test-6/test-c
-                                                       check $?
-test test-a -nt test-6/test-a ||
-test test-a -ot test-6/test-a ||
-test test-b -nt test-6/test-b ||
-test test-b -ot test-6/test-b ||
-test test-c -nt test-6/test-c ||
-test test-c -ot test-6/test-c
-test $? -ne 0
-                                                       check $?
+. $srcdir/lha-test2; cleanup
+. $srcdir/lha-test3; cleanup
+. $srcdir/lha-test4; cleanup
+. $srcdir/lha-test5; cleanup
+# . $srcdir/lha-test6; cleanup         # this feature is removed.
+. $srcdir/lha-test7; cleanup
+. $srcdir/lha-test8; cleanup
 
 exit $result
diff --git a/tests/lha-test2 b/tests/lha-test2
new file mode 100644 (file)
index 0000000..ca1bae5
--- /dev/null
@@ -0,0 +1,35 @@
+message testing to generic, lh5, lh6 and lh7 method archive.
+$lha co  test-tmp-m1.lzh test-a test-b test-c
+                                                       check $?
+$lha co5 test-tmp-m5.lzh test-a test-b test-c
+                                                       check $?
+$lha co6 test-tmp-m6.lzh test-a test-b test-c
+                                                       check $?
+$lha co7 test-tmp-m7.lzh test-a test-b test-c
+                                                       check $?
+$lha v test-tmp-m1.lzh | grep lh1
+                                                       check $?
+$lha v test-tmp-m5.lzh | grep lh5
+                                                       check $?
+$lha v test-tmp-m6.lzh | grep lh6
+                                                       check $?
+$lha v test-tmp-m7.lzh | grep lh7
+                                                       check $?
+
+$lha xw=test-tmp-m1 test-tmp-m1.lzh
+                                                       check $?
+$lha xw=test-tmp-m5 test-tmp-m5.lzh
+                                                       check $?
+$lha xw=test-tmp-m6 test-tmp-m6.lzh
+                                                       check $?
+$lha xw=test-tmp-m7 test-tmp-m7.lzh
+                                                       check $?
+
+diff -r test-1 test-tmp-m1
+                                                       check $?
+diff -r test-1 test-tmp-m5
+                                                       check $?
+diff -r test-1 test-tmp-m6
+                                                       check $?
+diff -r test-1 test-tmp-m7
+                                                       check $?
diff --git a/tests/lha-test3 b/tests/lha-test3
new file mode 100644 (file)
index 0000000..7eafa8d
--- /dev/null
@@ -0,0 +1,29 @@
+message testing to print lha archive.
+
+$lha co  test-tmp-m1.lzh test-a test-b test-c
+                                                       check $?
+$lha co5 test-tmp-m5.lzh test-a test-b test-c
+                                                       check $?
+$lha co6 test-tmp-m6.lzh test-a test-b test-c
+                                                       check $?
+$lha co7 test-tmp-m7.lzh test-a test-b test-c
+                                                       check $?
+
+$lha pq test-tmp-m1.lzh test-a | diff test-a -
+                                                       check $?
+$lha pq test-tmp-m5.lzh test-a | diff test-a -
+                                                       check $?
+$lha pq test-tmp-m6.lzh test-a | diff test-a -
+                                                       check $?
+$lha pq test-tmp-m7.lzh test-a | diff test-a -
+                                                       check $?
+
+cat test-[abc] > test-tmp-abc
+$lha pq test-tmp-m1.lzh | diff test-tmp-abc -
+                                                       check $?
+$lha pq test-tmp-m5.lzh | diff test-tmp-abc -
+                                                       check $?
+$lha pq test-tmp-m6.lzh | diff test-tmp-abc -
+                                                       check $?
+$lha pq test-tmp-m7.lzh | diff test-tmp-abc -
+                                                       check $?
diff --git a/tests/lha-test4 b/tests/lha-test4
new file mode 100644 (file)
index 0000000..facf926
--- /dev/null
@@ -0,0 +1,33 @@
+message testing to delete files from archive.
+
+cp test-1.lzh test-tmp.lzh
+
+# do nothing
+$lha d test-tmp.lzh 2> test-stderr
+                                                       check $?
+test -s test-stderr
+                                                       check $?
+$lha d test-tmp.lzh test-a
+                                                       check $?
+$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 $?
+rm -rf test-tmp
+                                                       check $?
+$lha d test-tmp.lzh test-b
+                                                       check $?
+$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 $?
+rm -rf test-tmp
+                                                       check $?
+$lha d test-tmp.lzh test-c 2> test-stderr
+                                                       check $?
+test -s test-stderr
+                                                       check $?
+test ! -f test-tmp.lzh
+                                                       check $?
diff --git a/tests/lha-test5 b/tests/lha-test5
new file mode 100644 (file)
index 0000000..490cb30
--- /dev/null
@@ -0,0 +1,8 @@
+message testing to treat stdin/stdout as archive file.
+
+$lha c - test-a test-b test-c > test-tmp.lzh
+                                                       check $?
+cat test-tmp.lzh | $lha xw=test-tmp -
+                                                       check $?
+diff -r test-1 test-tmp
+                                                       check $?
diff --git a/tests/lha-test6 b/tests/lha-test6
new file mode 100644 (file)
index 0000000..bd752f4
--- /dev/null
@@ -0,0 +1,14 @@
+message testing to treat stdin/stdout as file list.
+message Warning: On MinGW, these tests will fail for now.
+cat <<EOF | $lha c test-tmp.lzh
+test-a
+test-b
+test-c
+EOF
+                                                       check $?
+echo test-b | $lha xw=test-tmp test-tmp.lzh
+                                                       check $?
+test ! -f test-tmp/test-a &&
+test ! -f test-tmp/test-c &&
+diff test-b test-tmp/test-b
+                                                       check $?
diff --git a/tests/lha-test7 b/tests/lha-test7
new file mode 100644 (file)
index 0000000..45e8f5f
--- /dev/null
@@ -0,0 +1,51 @@
+message testing to add/update files to archive.
+$lha a test-tmp.lzh test-c
+                                                       check $?
+$lha a test-tmp.lzh test-b
+                                                       check $?
+$lha u test-tmp.lzh test-a
+                                                       check $?
+$lha xw=test-tmp test-tmp.lzh
+                                                       check $?
+diff -r test-1 test-tmp
+                                                       check $?
+(cd test-tmp
+ echo foo > test-a
+ echo bar > test-b
+ echo baz > test-c
+
+ # update with new files
+ $lha u ../test-tmp.lzh test-[abc]
+)
+                                                       check $?
+
+# old files are in test-1 and in current directory
+# new files are in test-tmp
+
+$lha xw=test-tmp2 test-tmp.lzh
+                                                       check $?
+diff -r test-tmp test-tmp2
+                                                       check $?
+# no update with old files
+$lha u test-tmp.lzh test-[abc]
+
+$lha xw=test-tmp3 test-tmp.lzh
+                                                       check $?
+diff -r test-tmp test-tmp3
+                                                       check $?
+# replace with old files
+$lha a test-tmp.lzh test-[abc]
+
+$lha xw=test-tmp4 test-tmp.lzh
+                                                       check $?
+diff -r test-1 test-tmp4
+                                                       check $?
+# replace with new files
+(cd test-tmp &&
+ $lha a ../test-tmp.lzh test-[abc]
+)
+
+$lha xw=test-tmp5 test-tmp.lzh
+                                                       check $?
+diff -r test-tmp test-tmp5
+                                                       check $?
diff --git a/tests/lha-test8 b/tests/lha-test8
new file mode 100644 (file)
index 0000000..6471155
--- /dev/null
@@ -0,0 +1,19 @@
+message testing timestamp
+$lha c test-tmp.lzh test-[abc]
+                                                       check $?
+# show time stamp
+$lha v test-tmp.lzh
+ls -l test-[abc]
+
+$lha xw=test-tmp test-tmp.lzh
+                                                       check $?
+diff -r test-1 test-tmp
+                                                       check $?
+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-b -ot test-tmp/test-b ||
+test test-c -nt test-tmp/test-c ||
+test test-c -ot test-tmp/test-c
+test $? -ne 0
+                                                       check $?