Set up scratch directory for tests.
[rsync/rsync.git] / testsuite / master.test
index 446263c..2260386 100755 (executable)
@@ -8,34 +8,78 @@
 
 # We need a few environment variables to know what to test.
 
+# rsync_bin gives the location of the rsync binary.  This is either
+# builddir/rsync if we're testing an uninstalled copy, or
+# install_prefix/bin/rsync if we're testing an installed copy.  On the
+# build farm rsync will be installed, but into a scratch /usr.
+
+# srcdir gives the location of the source tree, which lets us find the
+# build scripts.  It might be relative, so we need to make it
+# absolute.
+
+# testdir is a scratch directory for holding temporary test files.
+
+# The pwd is undefined when this script starts.
+
+set -e
+
+if ! [ -d "$testdir" ] && ! mkdir "$testdir"
+then
+    echo "warning: testdir $testdir is not a directory!" >&2
+    exit 1
+fi
+
+testdir=`cd $testdir && pwd`
+
+srcdir=`cd $srcdir && pwd`
+
 echo "============================================================"
-echo "$0 running"
+echo "$0 running in `pwd`"
+echo "    rsync_bin=$rsync_bin"
+echo "    srcdir=$srcdir"
+echo "    testdir=$testdir"
 
 test_names="rsync-hello hands"
 
 export rsync_bin
 export testdir
 
-cd "$testdir"
+skipped=0
+missing=0
+passed=0
+failed=0
+
+suitedir="$srcdir/testsuite"
+cd "$suitedir"
+echo "    suitedir=$suitedir"
 
 for testbase in $test_names
 do
-    echo "------------------------------------------------------------"
-    echo "----- $testbase running"
-
-    testscript="$testbase.test"
+    testscript="./$testbase.test"
     if test \! -f "$testscript" 
     then
        echo "$testscript does not exist" >&2
+       missing=`expr $missing + 1`
        continue
     fi
 
+    echo "------------------------------------------------------------"
+    echo "----- $testbase running"
+
     if sh $testscript
     then
        echo "----- $testbase completed succesfully"
+       passed=`expr $passed + 1`
     else
        echo "----- $testbase failed!"
+       failed=`expr $failed + 1`
     fi 
 done
 
 echo '------------------------------------------------------------'
+echo "----- overall results:"
+echo "      $passed passed"
+echo "      $failed failed"
+echo "      $skipped skipped"
+echo "      $missing missing"
+echo '------------------------------------------------------------'