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 chkfile="$scratchdir/rsync.chk"
16 outfile="$scratchdir/rsync.out"
18 makepath "$fromdir/foo"
19 makepath "$fromdir/bar/baz"
20 cp -p "$srcdir/configure.in" "$fromdir/foo/config1"
21 cp -p "$srcdir/config.h.in" "$fromdir/foo/config2"
22 cp -p "$srcdir/rsync.h" "$fromdir/bar/baz/rsync"
23 chmod 600 "$fromdir"/foo/config? "$fromdir/bar/baz/rsync"
25 ln -s ../bar/baz/rsync "$fromdir/foo/sym"
27 ln "$fromdir/foo/config1" "$fromdir/foo/extra"
29 $RSYNC -iplr "$fromdir/" "$todir/" \
35 >f+++++++ bar/baz/rsync
40 cL+++++++ foo/sym -> ../bar/baz/rsync
42 diff $diffopt "$chkfile" "$outfile" || test_fail "test 1 failed"
44 # Ensure there are no accidental directory-time problems.
45 $RSYNC -a -f '-! */' "$fromdir/" "$todir"
47 cp -p "$srcdir/configure.in" "$fromdir/foo/config2"
48 chmod 601 "$fromdir/foo/config2"
49 $RSYNC -iplrH "$fromdir/" "$todir/" \
52 >f..T.... bar/baz/rsync
55 hf..T.... foo/extra => foo/config1
57 diff $diffopt "$chkfile" "$outfile" || test_fail "test 2 failed"
59 $RSYNC -a -f '-! */' "$fromdir/" "$todir"
60 sleep 1 # For directory mod below to ensure time difference
63 ln -s ../bar/baz "$todir/foo/sym"
65 cp -p "$srcdir/config.h.in" "$fromdir/foo/config2"
66 chmod 600 "$fromdir/foo/config2"
67 chmod 777 "$todir/bar/baz/rsync"
69 $RSYNC -iplrtc "$fromdir/" "$todir/" \
72 .f..tp... bar/baz/rsync
76 cL..T.... foo/sym -> ../bar/baz/rsync
78 diff $diffopt "$chkfile" "$outfile" || test_fail "test 3 failed"
80 cp -p "$srcdir/configure.in" "$fromdir/foo/config2"
81 chmod 600 "$fromdir/foo/config2"
82 # Lack of -t is for unchanged hard-link stress-test!
83 $RSYNC -vvplrH "$fromdir/" "$todir/" \
87 bar/baz/rsync is uptodate
88 foo/config1 is uptodate
90 "foo/extra" is a hard link
93 diff $diffopt "$chkfile" "$outfile" || test_fail "test 4 failed"
95 chmod 747 "$todir/bar/baz/rsync"
96 $RSYNC -a -f '-! */' "$fromdir/" "$todir"
97 $RSYNC -ivvplrtH "$fromdir/" "$todir/" \
100 cat <<EOT >"$chkfile"
104 .f...p... bar/baz/rsync
107 >f..t.... foo/config2
109 .L foo/sym -> ../bar/baz/rsync
111 diff $diffopt "$chkfile" "$outfile" || test_fail "test 5 failed"
113 chmod 757 "$todir/foo/config1"
114 touch "$todir/foo/config2"
115 $RSYNC -vplrtH "$fromdir/" "$todir/" \
118 cat <<EOT >"$chkfile"
121 diff $diffopt "$chkfile" "$outfile" || test_fail "test 6 failed"
123 chmod 757 "$todir/foo/config1"
124 touch "$todir/foo/config2"
125 $RSYNC -iplrtH "$fromdir/" "$todir/" \
127 cat <<EOT >"$chkfile"
128 .f...p... foo/config1
129 >f..t.... foo/config2
131 diff $diffopt "$chkfile" "$outfile" || test_fail "test 7 failed"
134 $RSYNC -ivvplrtH --copy-dest=../ld "$fromdir/" "$todir/" \
137 cat <<EOT >"$chkfile"
145 hf foo/extra => foo/config1
146 cL..T.... foo/sym -> ../bar/baz/rsync
148 diff $diffopt "$chkfile" "$outfile" || test_fail "test 8 failed"
151 $RSYNC -iplrtH --copy-dest=../ld "$fromdir/" "$todir/" \
153 cat <<EOT >"$chkfile"
158 hf foo/extra => foo/config1
160 diff $diffopt "$chkfile" "$outfile" || test_fail "test 9 failed"
163 $RSYNC -vvplrtH --copy-dest="$lddir" "$fromdir/" "$todir/" \
166 cat <<EOT >"$chkfile"
170 bar/baz/rsync is uptodate
172 foo/config1 is uptodate
173 foo/config2 is uptodate
174 "foo/extra" is a hard link
175 foo/extra => foo/config1
178 diff $diffopt "$chkfile" "$outfile" || test_fail "test 10 failed"
181 $RSYNC -ivvplrtH --link-dest="$lddir" "$fromdir/" "$todir/" \
184 cat <<EOT >"$chkfile"
192 hf foo/extra => foo/config1
193 hL foo/sym -> ../bar/baz/rsync
195 diff $diffopt "$chkfile" "$outfile" || test_fail "test 11 failed"
198 $RSYNC -iplrtH --dry-run --link-dest=../ld "$fromdir/" "$todir/" \
200 cat <<EOT >"$chkfile"
206 diff $diffopt "$chkfile" "$outfile" || test_fail "test 12 failed"
209 $RSYNC -iplrtH --link-dest=../ld "$fromdir/" "$todir/" \
211 cat <<EOT >"$chkfile"
217 diff $diffopt "$chkfile" "$outfile" || test_fail "test 13 failed"
220 $RSYNC -vvplrtH --link-dest="$lddir" "$fromdir/" "$todir/" \
223 cat <<EOT >"$chkfile"
227 bar/baz/rsync is uptodate
229 foo/config1 is uptodate
230 foo/config2 is uptodate
231 "foo/extra" is a hard link
234 diff $diffopt "$chkfile" "$outfile" || test_fail "test 14 failed"
237 $RSYNC -ivvplrtH --compare-dest="$lddir" "$fromdir/" "$todir/" \
240 # TODO fix really-old problem when combining -H with --compare-dest:
241 # missing output for foo/extra hard-link (and it might not be updated)!
242 cat <<EOT >"$chkfile"
250 .L foo/sym -> ../bar/baz/rsync
252 diff $diffopt "$chkfile" "$outfile" || test_fail "test 15 failed"
255 $RSYNC -iplrtH --compare-dest="$lddir" "$fromdir/" "$todir/" \
257 cat <<EOT >"$chkfile"
263 diff $diffopt "$chkfile" "$outfile" || test_fail "test 16 failed"
266 $RSYNC -vvplrtH --compare-dest="$lddir" "$fromdir/" "$todir/" \
269 cat <<EOT >"$chkfile"
273 bar/baz/rsync is uptodate
275 foo/config1 is uptodate
276 foo/config2 is uptodate
277 "foo/extra" is a hard link
280 diff $diffopt "$chkfile" "$outfile" || test_fail "test 17 failed"
282 # The script would have aborted on error, so getting here means we've won.