+# 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. At the moment we assume we are invoked from the
+# source directory.
+
+# testdir is a scratch directory for holding temporary test files.
+
+# The pwd is undefined when this script starts.
+
+set -x
+
+set -e
+
+if ! [ -d "$testdir" ] && ! mkdir "$testdir"
+then
+ echo "warning: testdir $testdir is not a directory!" >&2
+ exit 1
+fi
+
+testdir=`cd $testdir && pwd`
+
+echo "srcdir is originally \"$srcdir\""
+if [ "$srcdir" != "" ]
+then
+ srcdir=`cd "$srcdir" && pwd`
+fi
+