Allow basic connectivity check via rrsync
[rsync.git] / testsuite / alt-dest.test
blobd2fb5a1bbe11ea4fbfb5a604555c146e1a5b94c5
1 #!/bin/sh
3 # Copyright (C) 2004-2022 Wayne Davison
5 # This program is distributable under the terms of the GNU GPL (see
6 # COPYING).
8 # Test rsync handling of --compare-dest and similar options.
10 . "$suitedir/rsync.fns"
12 alt1dir="$tmpdir/alt1"
13 alt2dir="$tmpdir/alt2"
14 alt3dir="$tmpdir/alt3"
16 SSH="$scratchdir/src/support/lsh.sh"
18 # Build some files/dirs/links to copy
20 hands_setup
22 # Setup the alt and chk dirs
23 $RSYNC -av --include=text --include='*/' --exclude='*' "$fromdir/" "$alt1dir/"
24 $RSYNC -av --include=etc-ltr-list --include='*/' --exclude='*' "$fromdir/" "$alt2dir/"
26 # Create a side dir where there is a candidate destfile of the same name as a sourcefile
27 echo "This is a test file" >"$fromdir/likely"
29 mkdir "$alt3dir"
30 echo "This is a test file" >"$alt3dir/likely"
32 sleep 1
33 touch "$fromdir/dir/text" "$fromdir/likely"
35 $RSYNC -av --exclude=/text --exclude=etc-ltr-list "$fromdir/" "$chkdir/"
37 # Let's do it!
38 checkit "$RSYNC -avv --no-whole-file \
39 --compare-dest='$alt1dir' --compare-dest='$alt2dir' \
40 '$fromdir/' '$todir/'" "$chkdir" "$todir"
42 rm -rf "$todir"
43 checkit "$RSYNC -avv --no-whole-file \
44 --copy-dest='$alt1dir' --copy-dest='$alt2dir' \
45 '$fromdir/' '$todir/'" "$fromdir" "$todir"
47 # Test that copy_file() works correctly with tmpfiles
48 for maybe_inplace in '' --inplace; do
49 rm -rf "$todir"
50 checkit "$RSYNC -av $maybe_inplace --copy-dest='$alt3dir' \
51 '$fromdir/' '$todir/'" "$fromdir" "$todir"
53 for srchost in '' 'localhost:'; do
54 if [ -z "$srchost" ]; then
55 desthost='localhost:'
56 else
57 desthost=''
60 rm -rf "$todir"
61 checkit "$RSYNC -ave '$SSH' --rsync-path='$RSYNC' $maybe_inplace \
62 --copy-dest='$alt3dir' '$srchost$fromdir/' '$desthost$todir/'" \
63 "$fromdir" "$todir"
64 done
65 done
67 # The script would have aborted on error, so getting here means we've won.
68 exit 0