Verify the module list output of the daemon-via-ssh check.
[rsync/rsync.git] / testsuite / daemon.test
CommitLineData
232ce2b2
MP
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
8fef0245
MP
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.
232ce2b2
MP
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
c13ad7ec 22. "$suitedir/rsync.fns"
232ce2b2 23
0e9c3564
WD
24chkfile="$scratchdir/rsync.chk"
25outfile="$scratchdir/rsync.out"
26
276cc455 27SSH="src/support/lsh --no-cd"
adc2476f
WD
28FILE_REPL='s/^\([^d][^ ]*\) *\(..........[0-9]\) /\1 \2 /'
29DIR_REPL='s/^\(d[^ ]*\) *[0-9][.,0-9]* /\1 DIR /'
0e9c3564 30LS_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];####/##/## ##:##:##;'
d1c06c21 31
3aae15ec 32build_rsyncd_conf
232ce2b2 33
0e9c3564
WD
34makepath "$fromdir/foo" "$fromdir/bar/baz"
35makepath "$todir"
36echo one >"$fromdir/foo/one"
37echo two >"$fromdir/bar/two"
38echo three >"$fromdir/bar/baz/three"
39
d1c06c21
WD
40cd "$scratchdir"
41
42ln -s test-rsyncd.conf rsyncd.conf
43
09ad9053 44confopt=''
8e7f3107 45case `get_testuid` in
09ad9053
WD
460)
47 # Root needs to specify the config file, or it uses /etc/rsyncd.conf.
48 echo "Forcing --config=$conf"
49 confopt=" --config=$conf"
50 ;;
51esac
52
0e9c3564
WD
53# These have a space-padded 15-char name, then a tab, then a comment.
54sed 's/NOCOMMENT//' <<EOT >"$chkfile"
55test-from r/o
56test-to r/w
57test-scratch NOCOMMENT
58EOT
98ec67d7
WD
59
60$RSYNC -ve "$SSH" --rsync-path="$RSYNC$confopt" localhost:: | tee "$outfile"
61echo '===='
62diff $diffopt "$chkfile" "$outfile" || test_fail "test 0 failed"
63
64RSYNC_CONNECT_PROG="$RSYNC --config=$conf --daemon"
65export RSYNC_CONNECT_PROG
66
67$RSYNC -v localhost:: | tee "$outfile"
68echo '===='
0e9c3564
WD
69diff $diffopt "$chkfile" "$outfile" || test_fail "test 1 failed"
70
71$RSYNC -r localhost::test-hidden \
adc2476f 72 | sed "$FILE_REPL" | sed "$DIR_REPL" | sed "$LS_REPL" \
0e9c3564
WD
73 | tee "$outfile"
74cat <<EOT >"$chkfile"
75drwxr-xr-x DIR ####/##/## ##:##:## .
76drwxr-xr-x DIR ####/##/## ##:##:## bar
77-rw-r--r-- 4 ####/##/## ##:##:## bar/two
78drwxr-xr-x DIR ####/##/## ##:##:## bar/baz
79-rw-r--r-- 6 ####/##/## ##:##:## bar/baz/three
80drwxr-xr-x DIR ####/##/## ##:##:## foo
81-rw-r--r-- 4 ####/##/## ##:##:## foo/one
82EOT
83diff $diffopt "$chkfile" "$outfile" || test_fail "test 2 failed"
84
85$RSYNC -r localhost::test-from/f* \
adc2476f 86 | sed "$FILE_REPL" | sed "$DIR_REPL" | sed "$LS_REPL" \
0e9c3564
WD
87 | tee "$outfile"
88cat <<EOT >"$chkfile"
89drwxr-xr-x DIR ####/##/## ##:##:## foo
90-rw-r--r-- 4 ####/##/## ##:##:## foo/one
91EOT
92diff $diffopt "$chkfile" "$outfile" || test_fail "test 3 failed"
93