3 # Copyright (C) 2001 by Martin Pool <mbp@samba.org>
5 # This program is distributable under the terms of the GNU GPL (see
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
13 # Having started the server we try some basic operations against it:
15 # getting a list of module
16 # listing files in a module
18 # uploading to a module
19 # checking the log file
20 # password authentication
22 .
"$suitedir/rsync.fns"
24 SSH
="src/support/lsh.sh --no-cd"
25 FILE_REPL
='s/^\([^d][^ ]*\) *\(..........[0-9]\) /\1 \2 /'
26 DIR_REPL
='s/^\(d[^ ]*\) *[0-9][.,0-9]* /\1 DIR /'
27 LS_REPL
='s;[0-9][0-9][0-9][0-9]/[0-9][0-9]/[0-9][0-9] [0-9][0-9]:[0-9][0-9]:[0-9][0-9] ;####/##/## ##:##:## ;g'
31 makepath
"$fromdir/foo" "$fromdir/bar/baz"
33 echo one
>"$fromdir/foo/one"
34 echo two
>"$fromdir/bar/two"
35 echo three
>"$fromdir/bar/baz/three"
39 ln -s test-rsyncd.conf rsyncd.conf
42 root_uid
=`get_rootuid`
44 if test x
"$my_uid" = x
"$root_uid"; then
45 # Root needs to specify the config file, or it uses /etc/rsyncd.conf.
46 echo "Forcing --config=$conf"
47 confopt
=" --config=$conf"
50 # These have a space-padded 15-char name, then a tab, then a comment.
51 sed 's/NOCOMMENT//' <<EOT >"$chkfile"
54 test-scratch NOCOMMENT
57 checkdiff2
"$RSYNC -ve '$SSH' --rsync-path='$RSYNC$confopt' localhost::"
60 RSYNC_CONNECT_PROG
="$RSYNC --config=$conf --daemon"
61 export RSYNC_CONNECT_PROG
63 checkdiff2
"$RSYNC -v localhost::"
66 checkdiff
"$RSYNC -r localhost::test-hidden" \
67 "sed -e '$FILE_REPL' -e '$DIR_REPL' -e '$LS_REPL'" <<EOT
68 drwxr-xr-x DIR ####/##/## ##:##:## .
69 drwxr-xr-x DIR ####/##/## ##:##:## bar
70 -rw-r--r-- 4 ####/##/## ##:##:## bar/two
71 drwxr-xr-x DIR ####/##/## ##:##:## bar/baz
72 -rw-r--r-- 6 ####/##/## ##:##:## bar/baz/three
73 drwxr-xr-x DIR ####/##/## ##:##:## foo
74 -rw-r--r-- 4 ####/##/## ##:##:## foo/one
77 checkdiff
"$RSYNC -r localhost::test-from/f*" \
78 "sed -e '$FILE_REPL' -e '$DIR_REPL' -e '$LS_REPL'" <<EOT
79 drwxr-xr-x DIR ####/##/## ##:##:## foo
80 -rw-r--r-- 4 ####/##/## ##:##:## foo/one
82 diff $diffopt "$chkfile" "$outfile" || test_fail
"test 3 failed"
84 if $RSYNC --version |
grep "[, ] atimes" >/dev
/null
; then
85 checkdiff
"$RSYNC -rU localhost::test-from/f*" \
86 "sed -e '$FILE_REPL' -e '$DIR_REPL' -e '$LS_REPL'" <<EOT
87 drwxr-xr-x DIR ####/##/## ##:##:## foo
88 -rw-r--r-- 4 ####/##/## ##:##:## ####/##/## ##:##:## foo/one