Annotation of embedaddon/rsync/testsuite/daemon.test, revision 1.1.1.3

1.1       misho       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: chkfile="$scratchdir/rsync.chk"
                     25: outfile="$scratchdir/rsync.out"
                     26: 
1.1.1.2   misho      27: SSH="src/support/lsh.sh --no-cd"
1.1       misho      28: FILE_REPL='s/^\([^d][^ ]*\) *\(..........[0-9]\) /\1 \2 /'
1.1.1.2   misho      29: DIR_REPL='s/^\(d[^ ]*\)  *[0-9][.,0-9]* /\1         DIR /'
1.1.1.3 ! misho      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] ;####/##/## ##:##:## ;g'
1.1       misho      31: 
                     32: build_rsyncd_conf
                     33: 
                     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: 
                     40: cd "$scratchdir"
                     41: 
                     42: ln -s test-rsyncd.conf rsyncd.conf
                     43: 
1.1.1.3 ! misho      44: my_uid=`get_testuid`
        !            45: root_uid=`get_rootuid`
1.1       misho      46: confopt=''
1.1.1.3 ! misho      47: if test x"$my_uid" = x"$root_uid"; then
1.1       misho      48:     # Root needs to specify the config file, or it uses /etc/rsyncd.conf.
                     49:     echo "Forcing --config=$conf"
                     50:     confopt=" --config=$conf"
1.1.1.3 ! misho      51: fi
1.1       misho      52: 
                     53: # These have a space-padded 15-char name, then a tab, then a comment.
                     54: sed 's/NOCOMMENT//' <<EOT >"$chkfile"
                     55: test-from              r/o
                     56: test-to                r/w
                     57: test-scratch           NOCOMMENT
                     58: EOT
1.1.1.2   misho      59: 
                     60: $RSYNC -ve "$SSH" --rsync-path="$RSYNC$confopt" localhost:: | tee "$outfile"
                     61: echo '===='
                     62: diff $diffopt "$chkfile" "$outfile" || test_fail "test 0 failed"
                     63: 
                     64: RSYNC_CONNECT_PROG="$RSYNC --config=$conf --daemon"
                     65: export RSYNC_CONNECT_PROG
                     66: 
                     67: $RSYNC -v localhost:: | tee "$outfile"
                     68: echo '===='
1.1       misho      69: diff $diffopt "$chkfile" "$outfile" || test_fail "test 1 failed"
                     70: 
                     71: $RSYNC -r localhost::test-hidden \
                     72:     | sed "$FILE_REPL" | sed "$DIR_REPL" | sed "$LS_REPL" \
                     73:     | tee "$outfile"
                     74: cat <<EOT >"$chkfile"
                     75: drwxr-xr-x         DIR ####/##/## ##:##:## .
                     76: drwxr-xr-x         DIR ####/##/## ##:##:## bar
                     77: -rw-r--r--           4 ####/##/## ##:##:## bar/two
                     78: drwxr-xr-x         DIR ####/##/## ##:##:## bar/baz
                     79: -rw-r--r--           6 ####/##/## ##:##:## bar/baz/three
                     80: drwxr-xr-x         DIR ####/##/## ##:##:## foo
                     81: -rw-r--r--           4 ####/##/## ##:##:## foo/one
                     82: EOT
                     83: diff $diffopt "$chkfile" "$outfile" || test_fail "test 2 failed"
                     84: 
                     85: $RSYNC -r localhost::test-from/f* \
                     86:     | sed "$FILE_REPL" | sed "$DIR_REPL" | sed "$LS_REPL" \
                     87:     | tee "$outfile"
                     88: cat <<EOT >"$chkfile"
                     89: drwxr-xr-x         DIR ####/##/## ##:##:## foo
                     90: -rw-r--r--           4 ####/##/## ##:##:## foo/one
                     91: EOT
                     92: diff $diffopt "$chkfile" "$outfile" || test_fail "test 3 failed"
                     93: 
1.1.1.3 ! misho      94: if $RSYNC --version | grep "[, ] atimes" >/dev/null; then
        !            95:     $RSYNC -rU localhost::test-from/f* \
        !            96:        | sed "$FILE_REPL" | sed "$DIR_REPL" | sed "$LS_REPL" \
        !            97:        | tee "$outfile"
        !            98:     cat <<EOT >"$chkfile"
        !            99: drwxr-xr-x         DIR ####/##/## ##:##:##                     foo
        !           100: -rw-r--r--           4 ####/##/## ##:##:## ####/##/## ##:##:## foo/one
        !           101: EOT
        !           102:     diff $diffopt "$chkfile" "$outfile" || test_fail "test 3 failed"
        !           103: fi

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>