Fix --remove-source-files sanity check w/--copy-links the right way.
[rsync.git] / runtests.sh
index c401ac4570ff171f6d8126bc649c7010c44817e0..42cd866ec54d57f5278d323cf1ab9f40d304a5cd 100755 (executable)
@@ -129,7 +129,10 @@ RUNSHFLAGS='-e'
 export RUNSHFLAGS
 
 # for Solaris
-[ -d /usr/xpg4/bin ] && PATH="/usr/xpg4/bin/:$PATH"
+if [ -d /usr/xpg4/bin ]; then
+    PATH="/usr/xpg4/bin/:$PATH"
+    export PATH
+fi
 
 if [ "x$loglevel" != x ] && [ "$loglevel" -gt 8 ]; then
     if set -x; then
@@ -154,12 +157,21 @@ fi
 RSYNC="$rsync_bin $*"
 #RSYNC="valgrind $rsync_bin $*"
 
-export POSIXLY_CORRECT TOOLDIR srcdir RSYNC
+TLS_ARGS=''
+if egrep '^#define HAVE_LUTIMES 1' config.h >/dev/null; then
+    TLS_ARGS="$TLS_ARGS -l"
+fi
+if egrep '#undef CHOWN_MODIFIES_SYMLINK' config.h >/dev/null; then
+    TLS_ARGS="$TLS_ARGS -L"
+fi
+
+export POSIXLY_CORRECT TOOLDIR srcdir RSYNC TLS_ARGS
 
 echo "============================================================"
 echo "$0 running in $TOOLDIR"
 echo "    rsync_bin=$RSYNC"
 echo "    srcdir=$srcdir"
+echo "    TLS_ARGS=$TLS_ARGS"
 
 if [ -f /usr/bin/whoami ]; then
     testuser=`/usr/bin/whoami`
@@ -220,8 +232,9 @@ echo "    scratchbase=$scratchbase"
 [ -d "$scratchbase" ] || mkdir "$scratchbase"
 
 suitedir="$srcdir/testsuite"
+TESTRUN_TIMEOUT=300
 
-export scratchdir suitedir
+export scratchdir suitedir TESTRUN_TIMEOUT
 
 prep_scratch() {
     [ -d "$scratchdir" ] && chmod -R u+rwX "$scratchdir" && rm -rf "$scratchdir"
@@ -229,7 +242,10 @@ prep_scratch() {
     # Get rid of default ACLs and dir-setgid to avoid confusing some tests.
     $setfacl_nodef "$scratchdir" || true
     chmod g-s "$scratchdir"
-    ln -s "$srcdir" "$scratchdir/src"
+    case "$srcdir" in
+    /*) ln -s "$srcdir" "$scratchdir/src" ;;
+    *)  ln -s "$TOOLDIR/$srcdir" "$scratchdir/src" ;;
+    esac
     return 0
 }
 
@@ -249,8 +265,13 @@ do
 
     prep_scratch
 
+    case "$testscript" in
+    *hardlinks*) TESTRUN_TIMEOUT=600 ;;
+    *) TESTRUN_TIMEOUT=300 ;;
+    esac
+
     set +e
-    sh $RUNSHFLAGS "$testscript" >"$scratchdir/test.log" 2>&1
+    "$TOOLDIR/"testrun $RUNSHFLAGS "$testscript" >"$scratchdir/test.log" 2>&1
     result=$?
     set -e