OSDN Git Service

lha-test19 is added for timestamping archive feature
authorKoji Arai <jca02266@gmail.com>
Fri, 29 Aug 2008 15:42:56 +0000 (00:42 +0900)
committerKoji Arai <jca02266@gmail.com>
Fri, 29 Aug 2008 16:00:50 +0000 (01:00 +0900)
tests/Makefile.am
tests/lha-test.in
tests/lha-test19 [new file with mode: 0644]

index 79c1c25..3bbf9c3 100644 (file)
@@ -22,6 +22,7 @@ EXTRA_DIST =  lha-test1 \
                lha-test16-l2.lzh \
                lha-test17 \
                lha-test18 \
+               lha-test19 \
                lha-test51 \
                lha-test51-2G.lzh \
                lha-test52-4G.lzh
index 4999e15..7870847 100644 (file)
@@ -114,6 +114,12 @@ change_timestamp()
     # touch $time "$@"
 }
 
+identical_timestamp()
+{
+    test "$1" -nt "$2" || test "$1" -ot "$2"
+    test $? -ne 0
+}
+
 # test start
 
 message testing $lha_cmd
@@ -143,11 +149,13 @@ else
     ;;
   *)
     testsuite lha-test14
+    ;;
   esac
   testsuite lha-test15
   testsuite lha-test16
   testsuite lha-test17
   testsuite lha-test18
+  testsuite lha-test19
   # followings will take a long time
   if [[ $perform_number = all ]]; then
     testsuite lha-test51       # extract 2G over files
diff --git a/tests/lha-test19 b/tests/lha-test19
new file mode 100644 (file)
index 0000000..04d25c2
--- /dev/null
@@ -0,0 +1,69 @@
+# -*- shell-script -*-
+message archive timestamping
+
+echo -------------------------------------------------------------------
+
+cp -r test-1 test-tmp1
+                                                       check $? $LINENO
+change_timestamp 01020304.02 test-tmp1/test-a &&
+change_timestamp 01020304.04 test-tmp1/test-b &&
+change_timestamp 01020304.06 test-tmp1/test-c
+                                                       check $? $LINENO
+
+# most recent file is test-a
+$lha c --timestamp-archive test-tmp1.lzh test-tmp1/test-a
+                                                       check $? $LINENO
+identical_timestamp test-tmp1.lzh test-tmp1/test-a
+                                                       check $? $LINENO
+
+# most recent file is test-c
+$lha a --timestamp-archive test-tmp1.lzh test-tmp1/test-c
+                                                       check $? $LINENO
+identical_timestamp test-tmp1.lzh test-tmp1/test-c
+                                                       check $? $LINENO
+
+$lha a --timestamp-archive test-tmp1.lzh test-tmp1/test-b
+                                                       check $? $LINENO
+# most recent file is test-c
+identical_timestamp test-tmp1.lzh test-tmp1/test-c
+                                                       check $? $LINENO
+
+$lha dq --timestamp-archive test-tmp1.lzh test-tmp1/test-c
+                                                       check $? $LINENO
+# most recent file is test-b
+identical_timestamp test-tmp1.lzh test-tmp1/test-b
+                                                       check $? $LINENO
+
+
+# directory is ignored
+mkdir test-tmp1/test-d &&
+$lha a --timestamp-archive test-tmp1.lzh test-tmp1/test-d
+                                                       check $? $LINENO
+# most recent file is test-b
+identical_timestamp test-tmp1.lzh test-tmp1/test-b
+                                                       check $? $LINENO
+
+case `$lha --version 2>&1` in
+*djgpp* | *-pc-mingw*)
+  ;;
+*)
+  # symbolic link is ignored
+  ln -s test-c test-tmp1/test-e
+  $lha a --timestamp-archive test-tmp1.lzh test-tmp1/test-e
+                                                       check $? $LINENO
+  ;;
+esac
+
+# most recent file is test-b
+identical_timestamp test-tmp1.lzh test-tmp1/test-b
+                                                       check $? $LINENO
+
+$lha dq --timestamp-archive test-tmp1.lzh test-tmp1/test-b
+                                                       check $? $LINENO
+# most recent file is test-a
+identical_timestamp test-tmp1.lzh test-tmp1/test-a
+                                                       check $? $LINENO
+
+
+$lha vv test-tmp1.lzh
+                                                       check $? $LINENO