+
+# In fact, we need a more general feature of capturing all stderr/log files,
+# and dumping them if something goes wrong.
+
+checkforlogs() {
+ # skip it if we're under debian-test
+ if test -n "${Debian}" ; then return 0 ; fi
+
+ if [ -f $1 -a -s $1 ] ; then
+ echo "Failures have occurred. $1 follows:" >&2
+ cat $1 >&2
+ exit 1
+ fi
+}
+
+
+build_rsyncd_conf() {
+ # Build an appropriate configuration file
+ conf="$scratchdir/test-rsyncd.conf"
+ echo "building configuration $conf"
+
+ port=2612
+ pidfile="$scratchdir/rsyncd.pid"
+ logfile="$scratchdir/rsyncd.log"
+
+ cat >$conf <<EOF
+# rsyncd configuration file autogenerated by $0
+
+pid file = $pidfile
+use chroot = no
+hosts allow = localhost, 127.0.0.1
+log file = $logfile
+
+[test-from] = $scratchdir/daemon-from/
+ read only = yes
+
+[test-to] = $scratchdir/daemon-to/
+ read only = no
+EOF
+}
+
+
+build_symlinks() {
+ fromdir="$scratchdir/from"
+ todir="$scratchdir/to"
+ mkdir "$fromdir"
+ date >"$fromdir/referent"
+ ln -s referent "$fromdir/relative"
+ ln -s "$fromdir/referent" "$fromdir/absolute"
+ ln -s nonexistent "$fromdir/dangling"
+ ln -s "$srcdir/rsync.c" "$fromdir/unsafe"
+}
+
+test_fail() {
+ echo "$@" >&2
+ exit 1
+}
+
+# It failed, but we expected that. don't dump out error logs,
+# because most users won't want to see them. But do leave
+# the working directory around.
+test_xfail() {
+ echo "$@" >&2
+ exit 78
+}
+
+# be reproducible
+umask 077
\ No newline at end of file