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"
17 chkfile="$scratchdir/rsync.chk"
18 outfile="$scratchdir/rsync.out"
20 makepath "$fromdir/foo"
21 makepath "$fromdir/bar/baz"
22 cp -p "$srcdir/configure.in" "$fromdir/foo/config1"
23 cp -p "$srcdir/config.h.in" "$fromdir/foo/config2"
24 cp -p "$srcdir/rsync.h" "$fromdir/bar/baz/rsync"
25 chmod 600 "$fromdir"/foo/config? "$fromdir/bar/baz/rsync"
27 ln -s ../bar/baz/rsync "$fromdir/foo/sym"
29 ln "$fromdir/foo/config1" "$fromdir/foo/extra"
31 $RSYNC -iplr "$fromdir/" "$todir/" \
36 >f++++++ bar/baz/rsync
41 cL++++++ foo/sym -> ../bar/baz/rsync
43 diff $diffopt "$chkfile" "$outfile" || test_fail "test 1 failed"
45 # Ensure there are no accidental directory-time problems.
46 $RSYNC -a -f '-! */' "$fromdir/" "$todir"
48 cp -p "$srcdir/configure.in" "$fromdir/foo/config2"
49 chmod 601 "$fromdir/foo/config2"
50 $RSYNC -iplrH "$fromdir/" "$todir/" \
53 >f..T... bar/baz/rsync
56 hf..T... foo/extra => foo/config1
58 diff $diffopt "$chkfile" "$outfile" || test_fail "test 2 failed"
60 $RSYNC -a -f '-! */' "$fromdir/" "$todir"
61 sleep 1 # For directory mod below to ensure time difference
64 ln -s ../bar/baz "$todir/foo/sym"
66 cp -p "$srcdir/config.h.in" "$fromdir/foo/config2"
67 chmod 600 "$fromdir/foo/config2"
68 chmod 777 "$todir/bar/baz/rsync"
70 $RSYNC -iplrtc "$fromdir/" "$todir/" \
73 .f..tp.. bar/baz/rsync
77 cL..T... foo/sym -> ../bar/baz/rsync
79 diff $diffopt "$chkfile" "$outfile" || test_fail "test 3 failed"
81 cp -p "$srcdir/configure.in" "$fromdir/foo/config2"
82 chmod 600 "$fromdir/foo/config2"
83 # Lack of -t is for unchanged hard-link stress-test!
84 $RSYNC -vvplrH "$fromdir/" "$todir/" \
88 bar/baz/rsync is uptodate
89 foo/config1 is uptodate
91 "foo/extra" is a hard link
94 diff $diffopt "$chkfile" "$outfile" || test_fail "test 4 failed"
96 chmod 747 "$todir/bar/baz/rsync"
97 $RSYNC -a -f '-! */' "$fromdir/" "$todir"
98 $RSYNC -ivvplrtH "$fromdir/" "$todir/" \
101 cat <<EOT >"$chkfile"
105 .f...p.. bar/baz/rsync
110 .L foo/sym -> ../bar/baz/rsync
112 diff $diffopt "$chkfile" "$outfile" || test_fail "test 5 failed"
114 chmod 757 "$todir/foo/config1"
115 touch "$todir/foo/config2"
116 $RSYNC -vplrtH "$fromdir/" "$todir/" \
119 cat <<EOT >"$chkfile"
122 diff $diffopt "$chkfile" "$outfile" || test_fail "test 6 failed"
124 chmod 757 "$todir/foo/config1"
125 touch "$todir/foo/config2"
126 $RSYNC -iplrtH "$fromdir/" "$todir/" \
128 cat <<EOT >"$chkfile"
132 diff $diffopt "$chkfile" "$outfile" || test_fail "test 7 failed"
135 $RSYNC -ivvplrtH --copy-dest="$lddir" "$fromdir/" "$todir/" \
138 cat <<EOT >"$chkfile"
146 hf foo/extra => foo/config1
147 cL..T... foo/sym -> ../bar/baz/rsync
149 diff $diffopt "$chkfile" "$outfile" || test_fail "test 8 failed"
152 $RSYNC -iplrtH --copy-dest="$lddir" "$fromdir/" "$todir/" \
154 cat <<EOT >"$chkfile"
159 hf foo/extra => foo/config1
161 diff $diffopt "$chkfile" "$outfile" || test_fail "test 9 failed"
164 $RSYNC -vvplrtH --copy-dest="$lddir" "$fromdir/" "$todir/" \
167 cat <<EOT >"$chkfile"
171 bar/baz/rsync is uptodate
173 foo/config1 is uptodate
174 foo/config2 is uptodate
175 "foo/extra" is a hard link
176 foo/extra => foo/config1
179 diff $diffopt "$chkfile" "$outfile" || test_fail "test 10 failed"
182 $RSYNC -ivvplrtH --link-dest="$lddir" "$fromdir/" "$todir/" \
185 cat <<EOT >"$chkfile"
193 hf foo/extra => foo/config1
194 hL foo/sym -> ../bar/baz/rsync
196 diff $diffopt "$chkfile" "$outfile" || test_fail "test 11 failed"
199 $RSYNC -iplrtH --link-dest="$lddir" "$fromdir/" "$todir/" \
201 cat <<EOT >"$chkfile"
207 diff $diffopt "$chkfile" "$outfile" || test_fail "test 12 failed"
210 $RSYNC -vvplrtH --link-dest="$lddir" "$fromdir/" "$todir/" \
213 cat <<EOT >"$chkfile"
217 bar/baz/rsync is uptodate
219 foo/config1 is uptodate
220 foo/config2 is uptodate
221 "foo/extra" is a hard link
224 diff $diffopt "$chkfile" "$outfile" || test_fail "test 13 failed"
227 $RSYNC -ivvplrtH --compare-dest="$lddir" "$fromdir/" "$todir/" \
230 # TODO fix really-old problem when combining -H with --compare-dest:
231 # missing output for foo/extra hard-link (and it might not be updated)!
232 cat <<EOT >"$chkfile"
240 .L foo/sym -> ../bar/baz/rsync
242 diff $diffopt "$chkfile" "$outfile" || test_fail "test 14 failed"
245 $RSYNC -iplrtH --compare-dest="$lddir" "$fromdir/" "$todir/" \
247 cat <<EOT >"$chkfile"
253 diff $diffopt "$chkfile" "$outfile" || test_fail "test 15 failed"
256 $RSYNC -vvplrtH --compare-dest="$lddir" "$fromdir/" "$todir/" \
259 cat <<EOT >"$chkfile"
263 bar/baz/rsync is uptodate
265 foo/config1 is uptodate
266 foo/config2 is uptodate
267 "foo/extra" is a hard link
270 diff $diffopt "$chkfile" "$outfile" || test_fail "test 16 failed"
272 # The script would have aborted on error, so getting here means we've won.