| 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 | # This test starts up an rsync daemon on a high-numbered port using a |
| 9 | # configuration file from the test directory. I can't think of a good |
| 10 | # way to choose it dynamically at the moment, so we just use 2612. If |
| 11 | # that's in use then you lose. |
| 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 | source "$suitedir/rsync.fns" |
| 26 | |
| 27 | # Build an appropriate configuration file |
| 28 | conf="$scratchdir/test-rsyncd.conf" |
| 29 | echo "building configuration $conf" |
| 30 | |
| 31 | port=2612 |
| 32 | pidfile="$scratchdir/rsyncd.pid" |
| 33 | logfile="$scratchdir/rsyncd.log" |
| 34 | |
| 35 | cat >$conf <<EOF |
| 36 | # rsyncd configuration file autogenerated by $0 |
| 37 | |
| 38 | pid file = $pidfile |
| 39 | use chroot = no |
| 40 | hosts allow = localhost, 127.0.0.1 |
| 41 | log file = $logfile |
| 42 | |
| 43 | [test-from] = $scratchdir/daemon-from/ |
| 44 | read only = yes |
| 45 | |
| 46 | [test-to] = $scratchdir/daemon-to/ |
| 47 | read only = no |
| 48 | |
| 49 | EOF |
| 50 | |
| 51 | |
| 52 | |
| 53 | echo starting daemon |
| 54 | $rsync_bin --daemon --port $port --config $conf |
| 55 | sleep 2 |
| 56 | pid=`cat "$pidfile"` |
| 57 | echo rsyncd running as process $pid |
| 58 | |
| 59 | |
| 60 | # We need to make sure that we always kill rsync, even if there's an |
| 61 | # error. Otherwise it might hang around, and be insecure or at any |
| 62 | # rate keep the port bound and prevent the tests running in the |
| 63 | # future. |
| 64 | |
| 65 | trap "echo killing off process $pid; kill $pid" EXIT |