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 if ln "$fromdir/foo/sym" "$to2dir" 2>/dev/null; then
37 # Check if rsync can preserve time on symlinks
43 if $RSYNC --version | grep ", symtimes" >/dev/null; then
51 $RSYNC -iplr "$fromdir/" "$todir/" \
57 >f+++++++++ bar/baz/rsync
59 >f+++++++++ foo/config1
60 >f+++++++++ foo/config2
62 cL+++++++++ foo/sym -> ../bar/baz/rsync
64 diff $diffopt "$chkfile" "$outfile" || test_fail "test 1 failed"
66 # Ensure there are no accidental directory-time problems.
67 $RSYNC -a -f '-! */' "$fromdir/" "$todir"
69 cp -p "$srcdir/configure.in" "$fromdir/foo/config2"
70 chmod 601 "$fromdir/foo/config2"
71 $RSYNC -iplrH "$fromdir/" "$todir/" \
74 >f..T...... bar/baz/rsync
75 >f..T...... foo/config1
76 >f.sTp..... foo/config2
77 hf..T...... foo/extra => foo/config1
79 diff $diffopt "$chkfile" "$outfile" || test_fail "test 2 failed"
81 $RSYNC -a -f '-! */' "$fromdir/" "$todir"
82 sleep 1 # For directory mod below to ensure time difference
85 ln -s ../bar/baz "$todir/foo/sym"
87 cp -p "$srcdir/config.h.in" "$fromdir/foo/config2"
88 chmod 600 "$fromdir/foo/config2"
89 chmod 777 "$todir/bar/baz/rsync"
91 $RSYNC -iplrtc "$fromdir/" "$todir/" \
94 .f..tp..... bar/baz/rsync
96 .f..t...... foo/config1
97 >fcstp..... foo/config2
98 cL.$T...... foo/sym -> ../bar/baz/rsync
100 diff $diffopt "$chkfile" "$outfile" || test_fail "test 3 failed"
102 cp -p "$srcdir/configure.in" "$fromdir/foo/config2"
103 chmod 600 "$fromdir/foo/config2"
104 # Lack of -t is for unchanged hard-link stress-test!
105 $RSYNC -vvplrH "$fromdir/" "$todir/" \
108 cat <<EOT >"$chkfile"
109 bar/baz/rsync is uptodate
110 foo/config1 is uptodate
112 foo/extra is uptodate
115 diff $diffopt "$chkfile" "$outfile" || test_fail "test 4 failed"
117 chmod 747 "$todir/bar/baz/rsync"
118 $RSYNC -a -f '-! */' "$fromdir/" "$todir"
119 $RSYNC -ivvplrtH "$fromdir/" "$todir/" \
122 cat <<EOT >"$chkfile"
126 .f...p..... bar/baz/rsync
129 >f..t...... foo/config2
131 .L foo/sym -> ../bar/baz/rsync
133 diff $diffopt "$chkfile" "$outfile" || test_fail "test 5 failed"
135 chmod 757 "$todir/foo/config1"
136 touch "$todir/foo/config2"
137 $RSYNC -vplrtH "$fromdir/" "$todir/" \
140 cat <<EOT >"$chkfile"
143 diff $diffopt "$chkfile" "$outfile" || test_fail "test 6 failed"
145 chmod 757 "$todir/foo/config1"
146 touch "$todir/foo/config2"
147 $RSYNC -iplrtH "$fromdir/" "$todir/" \
149 cat <<EOT >"$chkfile"
150 .f...p..... foo/config1
151 >f..t...... foo/config2
153 diff $diffopt "$chkfile" "$outfile" || test_fail "test 7 failed"
155 $RSYNC -ivvplrtH --copy-dest=../to "$fromdir/" "$to2dir/" \
158 case `tail -1 "$outfile"` in
161 L_sym_dots='cL..t......'
162 is_uptodate='-> ../bar/baz/rsync'
163 echo "cL$sym_dots foo/sym $is_uptodate" >"$chkfile.extra"
169 is_uptodate='is uptodate'
170 touch "$chkfile.extra"
173 cat <<EOT >"$chkfile"
181 hf foo/extra => foo/config1
182 cL$sym_dots foo/sym -> ../bar/baz/rsync
184 diff $diffopt "$chkfile" "$outfile" || test_fail "test 8 failed"
187 $RSYNC -iplrtH --copy-dest=../to "$fromdir/" "$to2dir/" \
189 cat - "$chkfile.extra" <<EOT >"$chkfile"
190 hf foo/extra => foo/config1
192 diff $diffopt "$chkfile" "$outfile" || test_fail "test 9 failed"
195 $RSYNC -vvplrtH --copy-dest="$todir" "$fromdir/" "$to2dir/" \
198 cat <<EOT >"$chkfile"
202 bar/baz/rsync is uptodate
204 foo/config1 is uptodate
205 foo/config2 is uptodate
206 foo/extra => foo/config1
209 diff $diffopt "$chkfile" "$outfile" || test_fail "test 10 failed"
212 $RSYNC -ivvplrtH --link-dest="$todir" "$fromdir/" "$to2dir/" \
215 cat <<EOT >"$chkfile"
223 hf foo/extra => foo/config1
224 $L$sym_dots foo/sym -> ../bar/baz/rsync
226 diff $diffopt "$chkfile" "$outfile" || test_fail "test 11 failed"
229 $RSYNC -iplrtH --dry-run --link-dest=../to "$fromdir/" "$to2dir/" \
231 cat - "$chkfile.extra" <<EOT >"$chkfile"
233 diff $diffopt "$chkfile" "$outfile" || test_fail "test 12 failed"
236 $RSYNC -iplrtH --link-dest=../to "$fromdir/" "$to2dir/" \
238 cat - "$chkfile.extra" <<EOT >"$chkfile"
240 diff $diffopt "$chkfile" "$outfile" || test_fail "test 13 failed"
243 $RSYNC -vvplrtH --link-dest="$todir" "$fromdir/" "$to2dir/" \
246 cat <<EOT >"$chkfile"
250 bar/baz/rsync is uptodate
252 foo/config1 is uptodate
253 foo/config2 is uptodate
254 foo/extra is uptodate
257 diff $diffopt "$chkfile" "$outfile" || test_fail "test 14 failed"
260 $RSYNC -ivvplrtH --compare-dest="$todir" "$fromdir/" "$to2dir/" \
263 cat <<EOT >"$chkfile"
272 $L_sym_dots foo/sym -> ../bar/baz/rsync
274 diff $diffopt "$chkfile" "$outfile" || test_fail "test 15 failed"
277 $RSYNC -iplrtH --compare-dest="$todir" "$fromdir/" "$to2dir/" \
279 cat - "$chkfile.extra" <<EOT >"$chkfile"
281 diff $diffopt "$chkfile" "$outfile" || test_fail "test 16 failed"
284 $RSYNC -vvplrtH --compare-dest="$todir" "$fromdir/" "$to2dir/" \
287 cat <<EOT >"$chkfile"
291 bar/baz/rsync is uptodate
293 foo/config1 is uptodate
294 foo/config2 is uptodate
295 foo/extra is uptodate
298 diff $diffopt "$chkfile" "$outfile" || test_fail "test 17 failed"
300 # The script would have aborted on error, so getting here means we've won.