Make use of -VV when checking rsync capabilities.
[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 . "$suitedir/rsync.fns"
23
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'
28
29 build_rsyncd_conf
30
31 makepath "$fromdir/foo" "$fromdir/bar/baz"
32 makepath "$todir"
33 echo one >"$fromdir/foo/one"
34 echo two >"$fromdir/bar/two"
35 echo three >"$fromdir/bar/baz/three"
36
37 cd "$scratchdir"
38
39 ln -s test-rsyncd.conf rsyncd.conf
40
41 my_uid=`get_testuid`
42 root_uid=`get_rootuid`
43 confopt=''
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"
48 fi
49
50 # These have a space-padded 15-char name, then a tab, then a comment.
51 sed 's/NOCOMMENT//' <<EOT >"$chkfile"
52 test-from       r/o
53 test-to         r/w
54 test-scratch    NOCOMMENT
55 EOT
56
57 checkdiff2 "$RSYNC -ve '$SSH' --rsync-path='$RSYNC$confopt' localhost::"
58 echo '===='
59
60 RSYNC_CONNECT_PROG="$RSYNC --config=$conf --daemon"
61 export RSYNC_CONNECT_PROG
62
63 checkdiff2 "$RSYNC -v localhost::"
64 echo '===='
65
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
75 EOT
76
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
81 EOT
82 diff $diffopt "$chkfile" "$outfile" || test_fail "test 3 failed"
83
84 if $RSYNC -VV | grep '"atimes": true' >/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
89 EOT
90 fi