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 -s no-such-dir
"$to2dir"
31 if ln "$to2dir" "$to2dir.test" 2>/dev
/null
; then
36 rm -f "$to2dir" "$to2dir.test"
38 $RSYNC -iplr "$fromdir/" "$todir/" \
44 >f+++++++++ bar/baz/rsync
46 >f+++++++++ foo/config1
47 >f+++++++++ foo/config2
49 cL+++++++++ foo/sym -> ../bar/baz/rsync
51 diff $diffopt "$chkfile" "$outfile" || test_fail
"test 1 failed"
53 # Ensure there are no accidental directory-time problems.
54 $RSYNC -a -f '-! */' "$fromdir/" "$todir"
56 cp -p "$srcdir/configure.in" "$fromdir/foo/config2"
57 chmod 601 "$fromdir/foo/config2"
58 $RSYNC -iplrH "$fromdir/" "$todir/" \
61 >f..T...... bar/baz/rsync
62 >f..T...... foo/config1
63 >f.sTp..... foo/config2
64 hf..T...... foo/extra => foo/config1
66 diff $diffopt "$chkfile" "$outfile" || test_fail
"test 2 failed"
68 $RSYNC -a -f '-! */' "$fromdir/" "$todir"
69 sleep 1 # For directory mod below to ensure time difference
72 ln -s ..
/bar
/baz
"$todir/foo/sym"
74 cp -p "$srcdir/config.h.in" "$fromdir/foo/config2"
75 chmod 600 "$fromdir/foo/config2"
76 chmod 777 "$todir/bar/baz/rsync"
78 $RSYNC -iplrtc "$fromdir/" "$todir/" \
81 .f..tp..... bar/baz/rsync
83 .f..t...... foo/config1
84 >fcstp..... foo/config2
85 cL..T...... foo/sym -> ../bar/baz/rsync
87 diff $diffopt "$chkfile" "$outfile" || test_fail
"test 3 failed"
89 cp -p "$srcdir/configure.in" "$fromdir/foo/config2"
90 chmod 600 "$fromdir/foo/config2"
91 # Lack of -t is for unchanged hard-link stress-test!
92 $RSYNC -vvplrH "$fromdir/" "$todir/" \
96 bar/baz/rsync is uptodate
97 foo/config1 is uptodate
102 diff $diffopt "$chkfile" "$outfile" || test_fail
"test 4 failed"
104 chmod 747 "$todir/bar/baz/rsync"
105 $RSYNC -a -f '-! */' "$fromdir/" "$todir"
106 $RSYNC -ivvplrtH "$fromdir/" "$todir/" \
109 cat <<EOT >"$chkfile"
113 .f...p..... bar/baz/rsync
116 >f..t...... foo/config2
118 .L foo/sym -> ../bar/baz/rsync
120 diff $diffopt "$chkfile" "$outfile" || test_fail
"test 5 failed"
122 chmod 757 "$todir/foo/config1"
123 touch "$todir/foo/config2"
124 $RSYNC -vplrtH "$fromdir/" "$todir/" \
127 cat <<EOT >"$chkfile"
130 diff $diffopt "$chkfile" "$outfile" || test_fail
"test 6 failed"
132 chmod 757 "$todir/foo/config1"
133 touch "$todir/foo/config2"
134 $RSYNC -iplrtH "$fromdir/" "$todir/" \
136 cat <<EOT >"$chkfile"
137 .f...p..... foo/config1
138 >f..t...... foo/config2
140 diff $diffopt "$chkfile" "$outfile" || test_fail
"test 7 failed"
142 $RSYNC -ivvplrtH --copy-dest=..
/to
"$fromdir/" "$to2dir/" \
145 cat <<EOT >"$chkfile"
153 hf foo/extra => foo/config1
154 cL foo/sym -> ../bar/baz/rsync
156 diff $diffopt "$chkfile" "$outfile" || test_fail
"test 8 failed"
159 $RSYNC -iplrtH --copy-dest=..
/to
"$fromdir/" "$to2dir/" \
161 cat <<EOT >"$chkfile"
162 hf foo/extra => foo/config1
164 diff $diffopt "$chkfile" "$outfile" || test_fail
"test 9 failed"
167 $RSYNC -vvplrtH --copy-dest="$todir" "$fromdir/" "$to2dir/" \
170 cat <<EOT >"$chkfile"
174 bar/baz/rsync is uptodate
176 foo/config1 is uptodate
177 foo/config2 is uptodate
178 foo/extra => foo/config1
181 diff $diffopt "$chkfile" "$outfile" || test_fail
"test 10 failed"
184 $RSYNC -ivvplrtH --link-dest="$todir" "$fromdir/" "$to2dir/" \
187 cat <<EOT >"$chkfile"
195 hf foo/extra => foo/config1
196 $L foo/sym -> ../bar/baz/rsync
198 diff $diffopt "$chkfile" "$outfile" || test_fail
"test 11 failed"
201 $RSYNC -iplrtH --dry-run --link-dest=..
/to
"$fromdir/" "$to2dir/" \
203 cat <<EOT >"$chkfile"
205 diff $diffopt "$chkfile" "$outfile" || test_fail
"test 12 failed"
208 $RSYNC -iplrtH --link-dest=..
/to
"$fromdir/" "$to2dir/" \
210 cat <<EOT >"$chkfile"
212 diff $diffopt "$chkfile" "$outfile" || test_fail
"test 13 failed"
215 $RSYNC -vvplrtH --link-dest="$todir" "$fromdir/" "$to2dir/" \
218 cat <<EOT >"$chkfile"
222 bar/baz/rsync is uptodate
224 foo/config1 is uptodate
225 foo/config2 is uptodate
226 foo/extra is uptodate
229 diff $diffopt "$chkfile" "$outfile" || test_fail
"test 14 failed"
232 $RSYNC -ivvplrtH --compare-dest="$todir" "$fromdir/" "$to2dir/" \
235 cat <<EOT >"$chkfile"
244 .L foo/sym -> ../bar/baz/rsync
246 diff $diffopt "$chkfile" "$outfile" || test_fail
"test 15 failed"
249 $RSYNC -iplrtH --compare-dest="$todir" "$fromdir/" "$to2dir/" \
251 cat <<EOT >"$chkfile"
253 diff $diffopt "$chkfile" "$outfile" || test_fail
"test 16 failed"
256 $RSYNC -vvplrtH --compare-dest="$todir" "$fromdir/" "$to2dir/" \
259 cat <<EOT >"$chkfile"
263 bar/baz/rsync is uptodate
265 foo/config1 is uptodate
266 foo/config2 is uptodate
267 foo/extra is uptodate
270 diff $diffopt "$chkfile" "$outfile" || test_fail
"test 17 failed"
272 # The script would have aborted on error, so getting here means we've won.