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/" \
34 >f+++++++ bar/baz/rsync
39 cL+++++++ foo/sym -> ../bar/baz/rsync
41 diff $diffopt "$chkfile" "$outfile" || test_fail "test 1 failed"
43 # Ensure there are no accidental directory-time problems.
44 $RSYNC -a -f '-! */' "$fromdir/" "$todir"
46 cp -p "$srcdir/configure.in" "$fromdir/foo/config2"
47 chmod 601 "$fromdir/foo/config2"
48 $RSYNC -iplrH "$fromdir/" "$todir/" \
51 >f..T.... bar/baz/rsync
54 hf..T.... foo/extra => foo/config1
56 diff $diffopt "$chkfile" "$outfile" || test_fail "test 2 failed"
58 $RSYNC -a -f '-! */' "$fromdir/" "$todir"
59 sleep 1 # For directory mod below to ensure time difference
62 ln -s ../bar/baz "$todir/foo/sym"
64 cp -p "$srcdir/config.h.in" "$fromdir/foo/config2"
65 chmod 600 "$fromdir/foo/config2"
66 chmod 777 "$todir/bar/baz/rsync"
68 $RSYNC -iplrtc "$fromdir/" "$todir/" \
71 .f..tp... bar/baz/rsync
75 cL..T.... foo/sym -> ../bar/baz/rsync
77 diff $diffopt "$chkfile" "$outfile" || test_fail "test 3 failed"
79 cp -p "$srcdir/configure.in" "$fromdir/foo/config2"
80 chmod 600 "$fromdir/foo/config2"
81 # Lack of -t is for unchanged hard-link stress-test!
82 $RSYNC -vvplrH "$fromdir/" "$todir/" \
86 bar/baz/rsync is uptodate
87 foo/config1 is uptodate
89 "foo/extra" is a hard link
92 diff $diffopt "$chkfile" "$outfile" || test_fail "test 4 failed"
94 chmod 747 "$todir/bar/baz/rsync"
95 $RSYNC -a -f '-! */' "$fromdir/" "$todir"
96 $RSYNC -ivvplrtH "$fromdir/" "$todir/" \
103 .f...p... bar/baz/rsync
106 >f..t.... foo/config2
108 .L foo/sym -> ../bar/baz/rsync
110 diff $diffopt "$chkfile" "$outfile" || test_fail "test 5 failed"
112 chmod 757 "$todir/foo/config1"
113 touch "$todir/foo/config2"
114 $RSYNC -vplrtH "$fromdir/" "$todir/" \
117 cat <<EOT >"$chkfile"
120 diff $diffopt "$chkfile" "$outfile" || test_fail "test 6 failed"
122 chmod 757 "$todir/foo/config1"
123 touch "$todir/foo/config2"
124 $RSYNC -iplrtH "$fromdir/" "$todir/" \
126 cat <<EOT >"$chkfile"
127 .f...p... foo/config1
128 >f..t.... foo/config2
130 diff $diffopt "$chkfile" "$outfile" || test_fail "test 7 failed"
133 $RSYNC -ivvplrtH --copy-dest="$lddir" "$fromdir/" "$todir/" \
136 cat <<EOT >"$chkfile"
144 hf foo/extra => foo/config1
145 cL..T.... foo/sym -> ../bar/baz/rsync
147 diff $diffopt "$chkfile" "$outfile" || test_fail "test 8 failed"
150 $RSYNC -iplrtH --copy-dest="$lddir" "$fromdir/" "$todir/" \
152 cat <<EOT >"$chkfile"
157 hf foo/extra => foo/config1
159 diff $diffopt "$chkfile" "$outfile" || test_fail "test 9 failed"
162 $RSYNC -vvplrtH --copy-dest="$lddir" "$fromdir/" "$todir/" \
165 cat <<EOT >"$chkfile"
169 bar/baz/rsync is uptodate
171 foo/config1 is uptodate
172 foo/config2 is uptodate
173 "foo/extra" is a hard link
174 foo/extra => foo/config1
177 diff $diffopt "$chkfile" "$outfile" || test_fail "test 10 failed"
180 $RSYNC -ivvplrtH --link-dest="$lddir" "$fromdir/" "$todir/" \
183 cat <<EOT >"$chkfile"
191 hf foo/extra => foo/config1
192 hL foo/sym -> ../bar/baz/rsync
194 diff $diffopt "$chkfile" "$outfile" || test_fail "test 11 failed"
197 $RSYNC -iplrtH --link-dest="$lddir" "$fromdir/" "$todir/" \
199 cat <<EOT >"$chkfile"
205 diff $diffopt "$chkfile" "$outfile" || test_fail "test 12 failed"
208 $RSYNC -vvplrtH --link-dest="$lddir" "$fromdir/" "$todir/" \
211 cat <<EOT >"$chkfile"
215 bar/baz/rsync is uptodate
217 foo/config1 is uptodate
218 foo/config2 is uptodate
219 "foo/extra" is a hard link
222 diff $diffopt "$chkfile" "$outfile" || test_fail "test 13 failed"
225 $RSYNC -ivvplrtH --compare-dest="$lddir" "$fromdir/" "$todir/" \
228 # TODO fix really-old problem when combining -H with --compare-dest:
229 # missing output for foo/extra hard-link (and it might not be updated)!
230 cat <<EOT >"$chkfile"
238 .L foo/sym -> ../bar/baz/rsync
240 diff $diffopt "$chkfile" "$outfile" || test_fail "test 14 failed"
243 $RSYNC -iplrtH --compare-dest="$lddir" "$fromdir/" "$todir/" \
245 cat <<EOT >"$chkfile"
251 diff $diffopt "$chkfile" "$outfile" || test_fail "test 15 failed"
254 $RSYNC -vvplrtH --compare-dest="$lddir" "$fromdir/" "$todir/" \
257 cat <<EOT >"$chkfile"
261 bar/baz/rsync is uptodate
263 foo/config1 is uptodate
264 foo/config2 is uptodate
265 "foo/extra" is a hard link
268 diff $diffopt "$chkfile" "$outfile" || test_fail "test 16 failed"
270 # The script would have aborted on error, so getting here means we've won.