If the daemon test is run as root, use a --config option.
[rsync/rsync.git] / testsuite / daemon.test
1 #!/bin/sh
2
3 # Copyright (C) 2001 by Martin Pool <mbp@samba.org>
4
5 # This program is distributable under the terms of the GNU GPL (see
6 # COPYING)
7
8 # We don't really want to start the server listening, because that
9 # might interfere with the security or operation of the test machine.
10 # Instead we use the fake-connect feature to dynamically assign a pair
11 # of ports.
12
13 # Having started the server we try some basic operations against it:
14
15 # getting a list of module
16 # listing files in a module
17 # retrieving a module
18 # uploading to a module
19 # checking the log file
20 # password authentication
21
22 # TODO: Put the common framework in a common file, so that we can have
23 # subtests fail and keep going.
24
25 . "$suitedir/rsync.fns"
26
27 SSH="$scratchdir/pretend-ssh"
28
29 cat >"$SSH" <<'EOT'
30 while : ; do
31     case "$1" in
32     -*) shift ;;
33     localhost) shift; break ;;
34     *) exit 1 ;;
35     esac
36 done
37
38 eval "${@}"
39 EOT
40 chmod +x "$SSH"
41
42 build_rsyncd_conf
43
44 cd "$scratchdir"
45
46 ln -s test-rsyncd.conf rsyncd.conf
47
48 confopt=''
49 case `id -u` in
50 0)
51     # Root needs to specify the config file, or it uses /etc/rsyncd.conf.
52     echo "Forcing --config=$conf"
53     confopt=" --config=$conf"
54     ;;
55 esac
56
57 $RSYNC -ve $SSH --rsync-path="$RSYNC$confopt" localhost::
58
59 RSYNC_CONNECT_PROG="$RSYNC --config=$conf --daemon"
60 export RSYNC_CONNECT_PROG
61
62 $RSYNC -v localhost::