3 # Copyright (C) 2005 by Wayne Davison <wayned@samba.org>
5 # This program is distributable under the terms of the GNU GPL see
8 # Test the output of various copy commands to ensure itemized output
9 # and double-verbose output is correct.
11 . "$suitedir/rsync.fns"
15 itemregex='^[.<>ch][dfDL][c .+][s .+][tT .+][p .+][o .+][g .+][a .+] '
19 outfile="$scratchdir/rsync.out"
21 makepath "$fromdir/foo"
22 makepath "$fromdir/bar/baz"
23 cp -p "$srcdir/config.h" "$fromdir/foo/config1"
24 cp -p "$srcdir/config.h.in" "$fromdir/foo/config2"
25 cp -p "$srcdir/rsync.h" "$fromdir/bar/baz/rsync"
26 ln -s ../bar/baz/rsync "$fromdir/foo/sym"
27 ln "$fromdir/foo/config1" "$fromdir/foo/extra"
29 $RSYNC -iplr "$fromdir/" "$todir/" \
31 cat <<EOT | diff $diffopt - "$outfile" || test_fail "test 1 failed"
34 >f+++++++ bar/baz/rsync
39 cL+++++++ foo/sym -> ../bar/baz/rsync
42 # Ensure there are no accidental directory-time problems.
43 $RSYNC -a -f '-! */' "$fromdir/" "$todir"
45 cp -p "$srcdir/config.h" "$fromdir/foo/config2"
46 $RSYNC -iplrH "$fromdir/" "$todir/" \
48 cat <<EOT | diff $diffopt - "$outfile" || test_fail "test 2 failed"
49 >f..T.... bar/baz/rsync
52 hf..T.... foo/extra => foo/config1
55 $RSYNC -a -f '-! */' "$fromdir/" "$todir"
56 sleep 1 # For directory mod below to ensure time difference
58 ln -s ../bar/baz "$todir/foo/sym"
59 cp -p "$srcdir/config.h.in" "$fromdir/foo/config2"
60 chmod 777 "$todir/bar/baz/rsync"
62 $RSYNC -iplrtc "$fromdir/" "$todir/" \
64 cat <<EOT | diff $diffopt - "$outfile" || test_fail "test 3 failed"
65 .f..tp... bar/baz/rsync
69 cL..T.... foo/sym -> ../bar/baz/rsync
72 cp -p "$srcdir/config.h" "$fromdir/foo/config2"
73 # Lack of -t is for unchanged hard-link stress-test!
74 $RSYNC -vvplrH "$fromdir/" "$todir/" \
75 | sed -e '0,/done$/d' -e '/--whole-file/d' -e '/total:/d' -e '/^$/,$d' \
77 cat <<EOT | diff $diffopt - "$outfile" || test_fail "test 4 failed"
78 bar/baz/rsync is uptodate
79 foo/config1 is uptodate
81 "foo/extra" is a hard link
85 chmod 747 "$todir/bar/baz/rsync"
86 $RSYNC -a -f '-! */' "$fromdir/" "$todir"
87 $RSYNC -ivvplrtH "$fromdir/" "$todir/" \
90 cat <<EOT | diff $diffopt - "$outfile" || test_fail "test 5 failed"
94 .f...p... bar/baz/rsync
99 .L foo/sym -> ../bar/baz/rsync
102 chmod 757 "$todir/foo/config1"
103 touch "$todir/foo/config2"
104 $RSYNC -vplrtH "$fromdir/" "$todir/" \
105 | sed -e '0,/done$/d' -e '/^$/,$d' \
107 cat <<EOT | diff $diffopt - "$outfile" || test_fail "test 6 failed"
111 chmod 757 "$todir/foo/config1"
112 touch "$todir/foo/config2"
113 $RSYNC -iplrtH "$fromdir/" "$todir/" \
115 cat <<EOT | diff $diffopt - "$outfile" || test_fail "test 7 failed"
116 .f...p... foo/config1
117 >f..t.... foo/config2
121 $RSYNC -ivvplrtH --copy-dest="$lddir" "$fromdir/" "$todir/" \
122 | grep "$itemregex" \
124 cat <<EOT | diff $diffopt - "$outfile" || test_fail "test 8 failed"
128 cf....... bar/baz/rsync
130 cf....... foo/config1
131 cf....... foo/config2
132 hf+++++++ foo/extra => foo/config1
133 cL+++++++ foo/sym -> ../bar/baz/rsync
137 $RSYNC -iplrtH --link-dest="$lddir" "$fromdir/" "$todir/" \
139 cat <<EOT | diff $diffopt - "$outfile" || test_fail "test 9 failed"
144 hf+++++++ foo/extra => foo/config1
145 cL+++++++ foo/sym -> ../bar/baz/rsync
148 # The script would have aborted on error, so getting here means we've won.