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