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 # This is only called if rsync was run with -v or -vv (not -i alone).
21 # Higher levels of -v would require more filtering.
23 sed -e '/^building file list /d' \
24 -e '/^created directory /d' \
26 -e '/ --whole-file$/d' \
29 <"$outfile" >"$outfile.new"
30 mv "$outfile.new" "$outfile"
33 makepath "$fromdir/foo"
34 makepath "$fromdir/bar/baz"
35 cp -p "$srcdir/configure.in" "$fromdir/foo/config1"
36 cp -p "$srcdir/config.h.in" "$fromdir/foo/config2"
37 cp -p "$srcdir/rsync.h" "$fromdir/bar/baz/rsync"
38 chmod 600 "$fromdir"/foo/config? "$fromdir/bar/baz/rsync"
40 ln -s ../bar/baz/rsync "$fromdir/foo/sym"
42 ln "$fromdir/foo/config1" "$fromdir/foo/extra"
44 $RSYNC -iplr "$fromdir/" "$todir/" \
49 >f+++++++ bar/baz/rsync
54 cL+++++++ foo/sym -> ../bar/baz/rsync
56 diff $diffopt "$chkfile" "$outfile" || test_fail "test 1 failed"
58 # Ensure there are no accidental directory-time problems.
59 $RSYNC -a -f '-! */' "$fromdir/" "$todir"
61 cp -p "$srcdir/configure.in" "$fromdir/foo/config2"
62 chmod 601 "$fromdir/foo/config2"
63 $RSYNC -iplrH "$fromdir/" "$todir/" \
66 >f..T.... bar/baz/rsync
69 hf..T.... foo/extra => foo/config1
71 diff $diffopt "$chkfile" "$outfile" || test_fail "test 2 failed"
73 $RSYNC -a -f '-! */' "$fromdir/" "$todir"
74 sleep 1 # For directory mod below to ensure time difference
77 ln -s ../bar/baz "$todir/foo/sym"
79 cp -p "$srcdir/config.h.in" "$fromdir/foo/config2"
80 chmod 600 "$fromdir/foo/config2"
81 chmod 777 "$todir/bar/baz/rsync"
83 $RSYNC -iplrtc "$fromdir/" "$todir/" \
86 .f..tp... bar/baz/rsync
90 cL..T.... foo/sym -> ../bar/baz/rsync
92 diff $diffopt "$chkfile" "$outfile" || test_fail "test 3 failed"
94 cp -p "$srcdir/configure.in" "$fromdir/foo/config2"
95 chmod 600 "$fromdir/foo/config2"
96 # Lack of -t is for unchanged hard-link stress-test!
97 $RSYNC -vvplrH "$fromdir/" "$todir/" \
100 cat <<EOT >"$chkfile"
101 bar/baz/rsync is uptodate
102 foo/config1 is uptodate
104 "foo/extra" is a hard link
107 diff $diffopt "$chkfile" "$outfile" || test_fail "test 4 failed"
109 chmod 747 "$todir/bar/baz/rsync"
110 $RSYNC -a -f '-! */' "$fromdir/" "$todir"
111 $RSYNC -ivvplrtH "$fromdir/" "$todir/" \
114 cat <<EOT >"$chkfile"
118 .f...p... bar/baz/rsync
121 >f..t.... foo/config2
123 .L foo/sym -> ../bar/baz/rsync
125 diff $diffopt "$chkfile" "$outfile" || test_fail "test 5 failed"
127 chmod 757 "$todir/foo/config1"
128 touch "$todir/foo/config2"
129 $RSYNC -vplrtH "$fromdir/" "$todir/" \
132 cat <<EOT >"$chkfile"
135 diff $diffopt "$chkfile" "$outfile" || test_fail "test 6 failed"
137 chmod 757 "$todir/foo/config1"
138 touch "$todir/foo/config2"
139 $RSYNC -iplrtH "$fromdir/" "$todir/" \
141 cat <<EOT >"$chkfile"
142 .f...p... foo/config1
143 >f..t.... foo/config2
145 diff $diffopt "$chkfile" "$outfile" || test_fail "test 7 failed"
148 $RSYNC -ivvplrtH --copy-dest="$lddir" "$fromdir/" "$todir/" \
151 cat <<EOT >"$chkfile"
159 hf foo/extra => foo/config1
160 cL..T.... foo/sym -> ../bar/baz/rsync
162 diff $diffopt "$chkfile" "$outfile" || test_fail "test 8 failed"
165 $RSYNC -iplrtH --copy-dest="$lddir" "$fromdir/" "$todir/" \
167 cat <<EOT >"$chkfile"
172 hf foo/extra => foo/config1
174 diff $diffopt "$chkfile" "$outfile" || test_fail "test 9 failed"
177 $RSYNC -vvplrtH --copy-dest="$lddir" "$fromdir/" "$todir/" \
180 cat <<EOT >"$chkfile"
184 bar/baz/rsync is uptodate
186 foo/config1 is uptodate
187 foo/config2 is uptodate
188 "foo/extra" is a hard link
189 foo/extra => foo/config1
192 diff $diffopt "$chkfile" "$outfile" || test_fail "test 10 failed"
195 $RSYNC -ivvplrtH --link-dest="$lddir" "$fromdir/" "$todir/" \
198 cat <<EOT >"$chkfile"
206 hf foo/extra => foo/config1
207 hL foo/sym -> ../bar/baz/rsync
209 diff $diffopt "$chkfile" "$outfile" || test_fail "test 11 failed"
212 $RSYNC -iplrtH --link-dest="$lddir" "$fromdir/" "$todir/" \
214 cat <<EOT >"$chkfile"
220 diff $diffopt "$chkfile" "$outfile" || test_fail "test 12 failed"
223 $RSYNC -vvplrtH --link-dest="$lddir" "$fromdir/" "$todir/" \
226 cat <<EOT >"$chkfile"
230 bar/baz/rsync is uptodate
232 foo/config1 is uptodate
233 foo/config2 is uptodate
234 "foo/extra" is a hard link
237 diff $diffopt "$chkfile" "$outfile" || test_fail "test 13 failed"
240 $RSYNC -ivvplrtH --compare-dest="$lddir" "$fromdir/" "$todir/" \
243 # TODO fix really-old problem when combining -H with --compare-dest:
244 # missing output for foo/extra hard-link (and it might not be updated)!
245 cat <<EOT >"$chkfile"
253 .L foo/sym -> ../bar/baz/rsync
255 diff $diffopt "$chkfile" "$outfile" || test_fail "test 14 failed"
258 $RSYNC -iplrtH --compare-dest="$lddir" "$fromdir/" "$todir/" \
260 cat <<EOT >"$chkfile"
266 diff $diffopt "$chkfile" "$outfile" || test_fail "test 15 failed"
269 $RSYNC -vvplrtH --compare-dest="$lddir" "$fromdir/" "$todir/" \
272 cat <<EOT >"$chkfile"
276 bar/baz/rsync is uptodate
278 foo/config1 is uptodate
279 foo/config2 is uptodate
280 "foo/extra" is a hard link
283 diff $diffopt "$chkfile" "$outfile" || test_fail "test 16 failed"
285 # The script would have aborted on error, so getting here means we've won.