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 # Check if the OS can hard-link symlinks or not
30 ln "$fromdir/foo/sym" "$fromdir/foo/sym.test" && L=hL || L=cL
31 rm -f "$fromdir/foo/sym.test"
33 $RSYNC -iplr "$fromdir/" "$todir/" \
39 >f+++++++ bar/baz/rsync
44 cL+++++++ foo/sym -> ../bar/baz/rsync
46 diff $diffopt "$chkfile" "$outfile" || test_fail "test 1 failed"
48 # Ensure there are no accidental directory-time problems.
49 $RSYNC -a -f '-! */' "$fromdir/" "$todir"
51 cp -p "$srcdir/configure.in" "$fromdir/foo/config2"
52 chmod 601 "$fromdir/foo/config2"
53 $RSYNC -iplrH "$fromdir/" "$todir/" \
56 >f..T.... bar/baz/rsync
59 hf..T.... foo/extra => foo/config1
61 diff $diffopt "$chkfile" "$outfile" || test_fail "test 2 failed"
63 $RSYNC -a -f '-! */' "$fromdir/" "$todir"
64 sleep 1 # For directory mod below to ensure time difference
67 ln -s ../bar/baz "$todir/foo/sym"
69 cp -p "$srcdir/config.h.in" "$fromdir/foo/config2"
70 chmod 600 "$fromdir/foo/config2"
71 chmod 777 "$todir/bar/baz/rsync"
73 $RSYNC -iplrtc "$fromdir/" "$todir/" \
76 .f..tp... bar/baz/rsync
80 cL..T.... foo/sym -> ../bar/baz/rsync
82 diff $diffopt "$chkfile" "$outfile" || test_fail "test 3 failed"
84 cp -p "$srcdir/configure.in" "$fromdir/foo/config2"
85 chmod 600 "$fromdir/foo/config2"
86 # Lack of -t is for unchanged hard-link stress-test!
87 $RSYNC -vvplrH "$fromdir/" "$todir/" \
91 bar/baz/rsync is uptodate
92 foo/config1 is uptodate
94 "foo/extra" is a hard link
97 diff $diffopt "$chkfile" "$outfile" || test_fail "test 4 failed"
99 chmod 747 "$todir/bar/baz/rsync"
100 $RSYNC -a -f '-! */' "$fromdir/" "$todir"
101 $RSYNC -ivvplrtH "$fromdir/" "$todir/" \
104 cat <<EOT >"$chkfile"
108 .f...p... bar/baz/rsync
111 >f..t.... foo/config2
113 .L foo/sym -> ../bar/baz/rsync
115 diff $diffopt "$chkfile" "$outfile" || test_fail "test 5 failed"
117 chmod 757 "$todir/foo/config1"
118 touch "$todir/foo/config2"
119 $RSYNC -vplrtH "$fromdir/" "$todir/" \
122 cat <<EOT >"$chkfile"
125 diff $diffopt "$chkfile" "$outfile" || test_fail "test 6 failed"
127 chmod 757 "$todir/foo/config1"
128 touch "$todir/foo/config2"
129 $RSYNC -iplrtH "$fromdir/" "$todir/" \
131 cat <<EOT >"$chkfile"
132 .f...p... foo/config1
133 >f..t.... foo/config2
135 diff $diffopt "$chkfile" "$outfile" || test_fail "test 7 failed"
137 $RSYNC -ivvplrtH --copy-dest=../to "$fromdir/" "$to2dir/" \
140 cat <<EOT >"$chkfile"
148 hf foo/extra => foo/config1
149 cL foo/sym -> ../bar/baz/rsync
151 diff $diffopt "$chkfile" "$outfile" || test_fail "test 8 failed"
154 $RSYNC -iplrtH --copy-dest=../to "$fromdir/" "$to2dir/" \
156 cat <<EOT >"$chkfile"
157 hf foo/extra => foo/config1
159 diff $diffopt "$chkfile" "$outfile" || test_fail "test 9 failed"
162 $RSYNC -vvplrtH --copy-dest="$todir" "$fromdir/" "$to2dir/" \
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="$todir" "$fromdir/" "$to2dir/" \
183 cat <<EOT >"$chkfile"
191 hf foo/extra => foo/config1
192 $L foo/sym -> ../bar/baz/rsync
194 diff $diffopt "$chkfile" "$outfile" || test_fail "test 11 failed"
197 $RSYNC -iplrtH --dry-run --link-dest=../to "$fromdir/" "$to2dir/" \
199 cat <<EOT >"$chkfile"
201 diff $diffopt "$chkfile" "$outfile" || test_fail "test 12 failed"
204 $RSYNC -iplrtH --link-dest=../to "$fromdir/" "$to2dir/" \
206 cat <<EOT >"$chkfile"
208 diff $diffopt "$chkfile" "$outfile" || test_fail "test 13 failed"
211 $RSYNC -vvplrtH --link-dest="$todir" "$fromdir/" "$to2dir/" \
214 cat <<EOT >"$chkfile"
218 bar/baz/rsync is uptodate
220 foo/config1 is uptodate
221 foo/config2 is uptodate
222 "foo/extra" is a hard link
225 diff $diffopt "$chkfile" "$outfile" || test_fail "test 14 failed"
228 $RSYNC -ivvplrtH --compare-dest="$todir" "$fromdir/" "$to2dir/" \
231 # TODO fix really-old problem when combining -H with --compare-dest:
232 # missing output for foo/extra hard-link (and it might not be updated)!
233 cat <<EOT >"$chkfile"
241 .L foo/sym -> ../bar/baz/rsync
243 diff $diffopt "$chkfile" "$outfile" || test_fail "test 15 failed"
246 $RSYNC -iplrtH --compare-dest="$todir" "$fromdir/" "$to2dir/" \
248 cat <<EOT >"$chkfile"
250 diff $diffopt "$chkfile" "$outfile" || test_fail "test 16 failed"
253 $RSYNC -vvplrtH --compare-dest="$todir" "$fromdir/" "$to2dir/" \
256 cat <<EOT >"$chkfile"
260 bar/baz/rsync is uptodate
262 foo/config1 is uptodate
263 foo/config2 is uptodate
264 "foo/extra" is a hard link
267 diff $diffopt "$chkfile" "$outfile" || test_fail "test 17 failed"
269 # The script would have aborted on error, so getting here means we've won.