Fix compile w/o openssl; disable sha256 & sha512 for --checksum.
[rsync.git] / testsuite / daemon.test
blob80d2baf656894a375912622aeec727266a6297b5
1 #!/bin/sh
3 # Copyright (C) 2001 by Martin Pool <mbp@samba.org>
5 # This program is distributable under the terms of the GNU GPL (see
6 # COPYING)
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.
13 # Having started the server we try some basic operations against it:
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
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'
29 build_rsyncd_conf
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"
37 cd "$scratchdir"
39 ln -s test-rsyncd.conf rsyncd.conf
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"
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
57 checkdiff2 "$RSYNC -ve '$SSH' --rsync-path='$RSYNC$confopt' localhost::"
58 echo '===='
60 RSYNC_CONNECT_PROG="$RSYNC --config=$conf --daemon"
61 export RSYNC_CONNECT_PROG
63 checkdiff2 "$RSYNC -v localhost::"
64 echo '===='
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
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"
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
89 EOT