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 sed_cmd='/_P30_/d; s/_P29_//'
18 sed_cmd='/_P29_/d; s/_P30_//'
24 chkfile="$scratchdir/rsync.chk"
25 outfile="$scratchdir/rsync.out"
27 makepath "$fromdir/foo"
28 makepath "$fromdir/bar/baz"
29 cp -p "$srcdir/configure.in" "$fromdir/foo/config1"
30 cp -p "$srcdir/config.h.in" "$fromdir/foo/config2"
31 cp -p "$srcdir/rsync.h" "$fromdir/bar/baz/rsync"
32 chmod 600 "$fromdir"/foo/config? "$fromdir/bar/baz/rsync"
34 ln -s ../bar/baz/rsync "$fromdir/foo/sym"
36 ln "$fromdir/foo/config1" "$fromdir/foo/extra"
38 # Check if the OS can hard-link symlinks or not
39 ln -s no-such-dir "$to2dir"
40 if ln "$to2dir" "$to2dir.test" 2>/dev/null; then
45 rm -f "$to2dir" "$to2dir.test"
47 $RSYNC -iplr "$fromdir/" "$todir/" \
49 sed -e "$sed_cmd" <<EOT >"$chkfile"
54 >f+++++++++ bar/baz/rsync
56 >f+++++++++ foo/config1
57 >f+++++++++ foo/config2
59 cL+++++++++ foo/sym -> ../bar/baz/rsync
61 diff $diffopt "$chkfile" "$outfile" || test_fail "test 1 failed"
63 # Ensure there are no accidental directory-time problems.
64 $RSYNC -a -f '-! */' "$fromdir/" "$todir"
66 cp -p "$srcdir/configure.in" "$fromdir/foo/config2"
67 chmod 601 "$fromdir/foo/config2"
68 $RSYNC -iplrH "$fromdir/" "$todir/" \
70 sed -e "$sed_cmd" <<EOT >"$chkfile"
71 >f..T...... bar/baz/rsync
72 >f..T...... foo/config1
73 >f.sTp..... foo/config2
74 hf..T...... foo/extra => foo/config1
76 diff $diffopt "$chkfile" "$outfile" || test_fail "test 2 failed"
78 $RSYNC -a -f '-! */' "$fromdir/" "$todir"
79 sleep 1 # For directory mod below to ensure time difference
82 ln -s ../bar/baz "$todir/foo/sym"
84 cp -p "$srcdir/config.h.in" "$fromdir/foo/config2"
85 chmod 600 "$fromdir/foo/config2"
86 chmod 777 "$todir/bar/baz/rsync"
88 $RSYNC -iplrtc "$fromdir/" "$todir/" \
90 sed -e "$sed_cmd" <<EOT >"$chkfile"
92 .f..tp..... bar/baz/rsync
94 .f..t...... foo/config1
95 >fcstp..... foo/config2
96 cL..T...... foo/sym -> ../bar/baz/rsync
98 diff $diffopt "$chkfile" "$outfile" || test_fail "test 3 failed"
100 cp -p "$srcdir/configure.in" "$fromdir/foo/config2"
101 chmod 600 "$fromdir/foo/config2"
102 # Lack of -t is for unchanged hard-link stress-test!
103 $RSYNC -vvplrH "$fromdir/" "$todir/" \
106 sed -e "$sed_cmd" <<EOT >"$chkfile"
107 bar/baz/rsync is uptodate
108 foo/config1 is uptodate
110 foo/extra is uptodate
113 diff $diffopt "$chkfile" "$outfile" || test_fail "test 4 failed"
115 chmod 747 "$todir/bar/baz/rsync"
116 $RSYNC -a -f '-! */' "$fromdir/" "$todir"
117 $RSYNC -ivvplrtH "$fromdir/" "$todir/" \
120 sed -e "$sed_cmd" <<EOT >"$chkfile"
124 .f...p..... bar/baz/rsync
127 >f..t...... foo/config2
129 .L foo/sym -> ../bar/baz/rsync
131 diff $diffopt "$chkfile" "$outfile" || test_fail "test 5 failed"
133 chmod 757 "$todir/foo/config1"
134 touch "$todir/foo/config2"
135 $RSYNC -vplrtH "$fromdir/" "$todir/" \
138 sed -e "$sed_cmd" <<EOT >"$chkfile"
141 diff $diffopt "$chkfile" "$outfile" || test_fail "test 6 failed"
143 chmod 757 "$todir/foo/config1"
144 touch "$todir/foo/config2"
145 $RSYNC -iplrtH "$fromdir/" "$todir/" \
147 sed -e "$sed_cmd" <<EOT >"$chkfile"
148 .f...p..... foo/config1
149 >f..t...... foo/config2
151 diff $diffopt "$chkfile" "$outfile" || test_fail "test 7 failed"
153 $RSYNC -ivvplrtH --copy-dest=../to "$fromdir/" "$to2dir/" \
156 sed -e "$sed_cmd" <<EOT >"$chkfile"
164 hf foo/extra => foo/config1
165 cL foo/sym -> ../bar/baz/rsync
167 diff $diffopt "$chkfile" "$outfile" || test_fail "test 8 failed"
170 $RSYNC -iplrtH --copy-dest=../to "$fromdir/" "$to2dir/" \
172 sed -e "$sed_cmd" <<EOT >"$chkfile"
173 hf foo/extra => foo/config1
175 diff $diffopt "$chkfile" "$outfile" || test_fail "test 9 failed"
178 $RSYNC -vvplrtH --copy-dest="$todir" "$fromdir/" "$to2dir/" \
181 sed -e "$sed_cmd" <<EOT >"$chkfile"
185 bar/baz/rsync is uptodate
187 foo/config1 is uptodate
188 foo/config2 is uptodate
189 foo/extra => foo/config1
192 diff $diffopt "$chkfile" "$outfile" || test_fail "test 10 failed"
195 $RSYNC -ivvplrtH --link-dest="$todir" "$fromdir/" "$to2dir/" \
198 sed -e "$sed_cmd" <<EOT >"$chkfile"
206 hf foo/extra => foo/config1
207 $L foo/sym -> ../bar/baz/rsync
209 diff $diffopt "$chkfile" "$outfile" || test_fail "test 11 failed"
212 $RSYNC -iplrtH --dry-run --link-dest=../to "$fromdir/" "$to2dir/" \
214 sed -e "$sed_cmd" <<EOT >"$chkfile"
216 diff $diffopt "$chkfile" "$outfile" || test_fail "test 12 failed"
219 $RSYNC -iplrtH --link-dest=../to "$fromdir/" "$to2dir/" \
221 sed -e "$sed_cmd" <<EOT >"$chkfile"
223 diff $diffopt "$chkfile" "$outfile" || test_fail "test 13 failed"
226 $RSYNC -vvplrtH --link-dest="$todir" "$fromdir/" "$to2dir/" \
229 sed -e "$sed_cmd" <<EOT >"$chkfile"
233 bar/baz/rsync is uptodate
235 foo/config1 is uptodate
236 foo/config2 is uptodate
237 foo/extra is uptodate
240 diff $diffopt "$chkfile" "$outfile" || test_fail "test 14 failed"
243 $RSYNC -ivvplrtH --compare-dest="$todir" "$fromdir/" "$to2dir/" \
246 sed -e "$sed_cmd" <<EOT >"$chkfile"
255 .L foo/sym -> ../bar/baz/rsync
257 diff $diffopt "$chkfile" "$outfile" || test_fail "test 15 failed"
260 $RSYNC -iplrtH --compare-dest="$todir" "$fromdir/" "$to2dir/" \
262 sed -e "$sed_cmd" <<EOT >"$chkfile"
264 diff $diffopt "$chkfile" "$outfile" || test_fail "test 16 failed"
267 $RSYNC -vvplrtH --compare-dest="$todir" "$fromdir/" "$to2dir/" \
270 sed -e "$sed_cmd" <<EOT >"$chkfile"
274 bar/baz/rsync is uptodate
276 foo/config1 is uptodate
277 foo/config2 is uptodate
278 foo/extra is uptodate
281 diff $diffopt "$chkfile" "$outfile" || test_fail "test 17 failed"
283 # The script would have aborted on error, so getting here means we've won.