OSDN Git Service

Add a compiler clang
[lha/lha.git] / tests / lha-test.in
index a57c3f2..e9826ec 100644 (file)
@@ -1,8 +1,20 @@
 #!/bin/bash
 
+print_usage()
+{
+  cat <<EOF
+usage: $0 [-n] [test number]
+
+option:
+   -n:   do not cleanup.
+EOF
+  exit
+}
+
 for _opt
 do
    case $_opt in
+   --help) print_usage ;;
    -n) no_cleanup=true; shift ;;
    *) perform_number=$1; shift ;;
    esac
@@ -27,7 +39,8 @@ DUALCASE=1; export DUALCASE # for MKS sh
 : ${builddir=$(cd @builddir@ && pwd)}
 
 if [[ x$no_cleanup = x ]]; then
-  trap '_stat=$?; rm -rf test-*; exit $_stat' 0 1 2 3 15
+  trap '_stat=$?; chmod -R 755 test-* 2>/dev/null;
+        rm -rf test-*; exit $_stat' 0 1 2 3 15
 fi
 
 typeset -i i   # for loop
@@ -68,9 +81,22 @@ check()
   fi
 }
 
+# On HP-UX 11.23, "chmod -R" cannot change the file permission in
+# non-writable and non-executable directory.
+chmod_R()
+{
+  typeset mode="$1"; shift
+  for x in "$@"
+  do
+    chmod $mode "$x"
+    test -d "$x" && (cd "$x" && chmod_R $mode *)
+  done
+}
+
 cleanup()
 {
   if [[ x$no_cleanup = x ]]; then
+    chmod_R 755 test-tmp* 2>/dev/null
     rm -rf test-tmp*
   fi
 }
@@ -100,6 +126,12 @@ change_timestamp()
     # touch $time "$@"
 }
 
+identical_timestamp()
+{
+    test "$1" -nt "$2" || test "$1" -ot "$2"
+    test $? -ne 0
+}
+
 # test start
 
 message testing $lha_cmd
@@ -129,10 +161,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
@@ -143,6 +178,8 @@ fi
 if (( $error_num != 0 )); then
   message $error_num tests failed!
   message test number: $error_tests
+else
+  message All tests succeeded.
 fi
 
 exit $result