Commit | Line | Data |
---|---|---|
5794112a WD |
1 | #! /bin/sh |
2 | ||
3 | # Copyright (C) 2005 by Wayne Davison <wayned@samba.org> | |
4 | ||
c8d19f90 | 5 | # This program is distributable under the terms of the GNU GPL (see |
5794112a WD |
6 | # COPYING). |
7 | ||
8 | # Test the output of various copy commands to ensure itemized output | |
9 | # and double-verbose output is correct. | |
10 | ||
11 | . "$suitedir/rsync.fns" | |
12 | ||
5794112a WD |
13 | lddir="$tmpdir/ld" |
14 | ||
4f3be36e | 15 | chkfile="$scratchdir/rsync.chk" |
5794112a WD |
16 | outfile="$scratchdir/rsync.out" |
17 | ||
18 | makepath "$fromdir/foo" | |
19 | makepath "$fromdir/bar/baz" | |
309a5be8 | 20 | cp -p "$srcdir/configure.in" "$fromdir/foo/config1" |
5794112a WD |
21 | cp -p "$srcdir/config.h.in" "$fromdir/foo/config2" |
22 | cp -p "$srcdir/rsync.h" "$fromdir/bar/baz/rsync" | |
e73ad2be | 23 | chmod 600 "$fromdir"/foo/config? "$fromdir/bar/baz/rsync" |
87a57a30 | 24 | umask 0 |
5794112a | 25 | ln -s ../bar/baz/rsync "$fromdir/foo/sym" |
87a57a30 | 26 | umask 022 |
5794112a WD |
27 | ln "$fromdir/foo/config1" "$fromdir/foo/extra" |
28 | ||
29 | $RSYNC -iplr "$fromdir/" "$todir/" \ | |
30 | | tee "$outfile" | |
4f3be36e | 31 | cat <<EOT >"$chkfile" |
418b6a27 | 32 | cd+++++++ ./ |
503f1634 WD |
33 | cd+++++++ bar/ |
34 | cd+++++++ bar/baz/ | |
35 | >f+++++++ bar/baz/rsync | |
36 | cd+++++++ foo/ | |
37 | >f+++++++ foo/config1 | |
38 | >f+++++++ foo/config2 | |
39 | >f+++++++ foo/extra | |
40 | cL+++++++ foo/sym -> ../bar/baz/rsync | |
5794112a | 41 | EOT |
4f3be36e | 42 | diff $diffopt "$chkfile" "$outfile" || test_fail "test 1 failed" |
5794112a WD |
43 | |
44 | # Ensure there are no accidental directory-time problems. | |
45 | $RSYNC -a -f '-! */' "$fromdir/" "$todir" | |
46 | ||
309a5be8 | 47 | cp -p "$srcdir/configure.in" "$fromdir/foo/config2" |
e73ad2be | 48 | chmod 601 "$fromdir/foo/config2" |
5794112a WD |
49 | $RSYNC -iplrH "$fromdir/" "$todir/" \ |
50 | | tee "$outfile" | |
4f3be36e | 51 | cat <<EOT >"$chkfile" |
503f1634 WD |
52 | >f..T.... bar/baz/rsync |
53 | >f..T.... foo/config1 | |
54 | >f.sTp... foo/config2 | |
55 | hf..T.... foo/extra => foo/config1 | |
5794112a | 56 | EOT |
4f3be36e | 57 | diff $diffopt "$chkfile" "$outfile" || test_fail "test 2 failed" |
5794112a WD |
58 | |
59 | $RSYNC -a -f '-! */' "$fromdir/" "$todir" | |
60 | sleep 1 # For directory mod below to ensure time difference | |
61 | rm "$todir/foo/sym" | |
a3dcb790 | 62 | umask 0 |
5794112a | 63 | ln -s ../bar/baz "$todir/foo/sym" |
a3dcb790 | 64 | umask 022 |
5794112a | 65 | cp -p "$srcdir/config.h.in" "$fromdir/foo/config2" |
e73ad2be | 66 | chmod 600 "$fromdir/foo/config2" |
5794112a WD |
67 | chmod 777 "$todir/bar/baz/rsync" |
68 | ||
69 | $RSYNC -iplrtc "$fromdir/" "$todir/" \ | |
70 | | tee "$outfile" | |
4f3be36e | 71 | cat <<EOT >"$chkfile" |
503f1634 WD |
72 | .f..tp... bar/baz/rsync |
73 | .d..t.... foo/ | |
74 | .f..t.... foo/config1 | |
75 | >fcstp... foo/config2 | |
76 | cL..T.... foo/sym -> ../bar/baz/rsync | |
5794112a | 77 | EOT |
4f3be36e | 78 | diff $diffopt "$chkfile" "$outfile" || test_fail "test 3 failed" |
5794112a | 79 | |
309a5be8 | 80 | cp -p "$srcdir/configure.in" "$fromdir/foo/config2" |
e73ad2be | 81 | chmod 600 "$fromdir/foo/config2" |
5794112a WD |
82 | # Lack of -t is for unchanged hard-link stress-test! |
83 | $RSYNC -vvplrH "$fromdir/" "$todir/" \ | |
5794112a | 84 | | tee "$outfile" |
8af1bc90 | 85 | filter_outfile |
4f3be36e | 86 | cat <<EOT >"$chkfile" |
5794112a WD |
87 | bar/baz/rsync is uptodate |
88 | foo/config1 is uptodate | |
89 | foo/config2 | |
90 | "foo/extra" is a hard link | |
91 | foo/sym is uptodate | |
92 | EOT | |
4f3be36e | 93 | diff $diffopt "$chkfile" "$outfile" || test_fail "test 4 failed" |
5794112a WD |
94 | |
95 | chmod 747 "$todir/bar/baz/rsync" | |
96 | $RSYNC -a -f '-! */' "$fromdir/" "$todir" | |
97 | $RSYNC -ivvplrtH "$fromdir/" "$todir/" \ | |
5794112a | 98 | | tee "$outfile" |
8af1bc90 | 99 | filter_outfile |
4f3be36e | 100 | cat <<EOT >"$chkfile" |
503f1634 WD |
101 | .d ./ |
102 | .d bar/ | |
103 | .d bar/baz/ | |
104 | .f...p... bar/baz/rsync | |
105 | .d foo/ | |
106 | .f foo/config1 | |
107 | >f..t.... foo/config2 | |
108 | hf foo/extra | |
109 | .L foo/sym -> ../bar/baz/rsync | |
5794112a | 110 | EOT |
4f3be36e | 111 | diff $diffopt "$chkfile" "$outfile" || test_fail "test 5 failed" |
5794112a WD |
112 | |
113 | chmod 757 "$todir/foo/config1" | |
114 | touch "$todir/foo/config2" | |
115 | $RSYNC -vplrtH "$fromdir/" "$todir/" \ | |
5794112a | 116 | | tee "$outfile" |
8af1bc90 | 117 | filter_outfile |
4f3be36e | 118 | cat <<EOT >"$chkfile" |
5794112a WD |
119 | foo/config2 |
120 | EOT | |
4f3be36e | 121 | diff $diffopt "$chkfile" "$outfile" || test_fail "test 6 failed" |
5794112a WD |
122 | |
123 | chmod 757 "$todir/foo/config1" | |
124 | touch "$todir/foo/config2" | |
125 | $RSYNC -iplrtH "$fromdir/" "$todir/" \ | |
126 | | tee "$outfile" | |
4f3be36e | 127 | cat <<EOT >"$chkfile" |
503f1634 WD |
128 | .f...p... foo/config1 |
129 | >f..t.... foo/config2 | |
5794112a | 130 | EOT |
4f3be36e | 131 | diff $diffopt "$chkfile" "$outfile" || test_fail "test 7 failed" |
5794112a WD |
132 | |
133 | mv "$todir" "$lddir" | |
db3ae95c | 134 | $RSYNC -ivvplrtH --copy-dest=../ld "$fromdir/" "$todir/" \ |
5794112a | 135 | | tee "$outfile" |
8af1bc90 | 136 | filter_outfile |
4f3be36e | 137 | cat <<EOT >"$chkfile" |
418b6a27 | 138 | cd+++++++ ./ |
503f1634 WD |
139 | cd+++++++ bar/ |
140 | cd+++++++ bar/baz/ | |
141 | cf bar/baz/rsync | |
142 | cd+++++++ foo/ | |
143 | cf foo/config1 | |
144 | cf foo/config2 | |
145 | hf foo/extra => foo/config1 | |
146 | cL..T.... foo/sym -> ../bar/baz/rsync | |
5794112a | 147 | EOT |
4f3be36e | 148 | diff $diffopt "$chkfile" "$outfile" || test_fail "test 8 failed" |
5794112a WD |
149 | |
150 | rm -rf "$todir" | |
db3ae95c | 151 | $RSYNC -iplrtH --copy-dest=../ld "$fromdir/" "$todir/" \ |
5794112a | 152 | | tee "$outfile" |
4f3be36e | 153 | cat <<EOT >"$chkfile" |
418b6a27 | 154 | cd+++++++ ./ |
503f1634 WD |
155 | cd+++++++ bar/ |
156 | cd+++++++ bar/baz/ | |
157 | cd+++++++ foo/ | |
158 | hf foo/extra => foo/config1 | |
5794112a | 159 | EOT |
4f3be36e | 160 | diff $diffopt "$chkfile" "$outfile" || test_fail "test 9 failed" |
5794112a | 161 | |
165dd4a6 WD |
162 | rm -rf "$todir" |
163 | $RSYNC -vvplrtH --copy-dest="$lddir" "$fromdir/" "$todir/" \ | |
164 | | tee "$outfile" | |
165 | filter_outfile | |
166 | cat <<EOT >"$chkfile" | |
167 | ./ | |
168 | bar/ | |
169 | bar/baz/ | |
170 | bar/baz/rsync is uptodate | |
171 | foo/ | |
172 | foo/config1 is uptodate | |
173 | foo/config2 is uptodate | |
174 | "foo/extra" is a hard link | |
175 | foo/extra => foo/config1 | |
176 | foo/sym is uptodate | |
177 | EOT | |
178 | diff $diffopt "$chkfile" "$outfile" || test_fail "test 10 failed" | |
179 | ||
180 | rm -rf "$todir" | |
181 | $RSYNC -ivvplrtH --link-dest="$lddir" "$fromdir/" "$todir/" \ | |
182 | | tee "$outfile" | |
183 | filter_outfile | |
184 | cat <<EOT >"$chkfile" | |
418b6a27 | 185 | cd+++++++ ./ |
503f1634 WD |
186 | cd+++++++ bar/ |
187 | cd+++++++ bar/baz/ | |
188 | hf bar/baz/rsync | |
189 | cd+++++++ foo/ | |
190 | hf foo/config1 | |
191 | hf foo/config2 | |
192 | hf foo/extra => foo/config1 | |
193 | hL foo/sym -> ../bar/baz/rsync | |
165dd4a6 WD |
194 | EOT |
195 | diff $diffopt "$chkfile" "$outfile" || test_fail "test 11 failed" | |
196 | ||
197 | rm -rf "$todir" | |
db3ae95c WD |
198 | $RSYNC -iplrtH --dry-run --link-dest=../ld "$fromdir/" "$todir/" \ |
199 | | tee "$outfile" | |
200 | cat <<EOT >"$chkfile" | |
201 | cd+++++++ ./ | |
202 | cd+++++++ bar/ | |
203 | cd+++++++ bar/baz/ | |
204 | cd+++++++ foo/ | |
205 | EOT | |
206 | diff $diffopt "$chkfile" "$outfile" || test_fail "test 12 failed" | |
207 | ||
208 | rm -rf "$todir" | |
209 | $RSYNC -iplrtH --link-dest=../ld "$fromdir/" "$todir/" \ | |
165dd4a6 WD |
210 | | tee "$outfile" |
211 | cat <<EOT >"$chkfile" | |
418b6a27 | 212 | cd+++++++ ./ |
503f1634 WD |
213 | cd+++++++ bar/ |
214 | cd+++++++ bar/baz/ | |
215 | cd+++++++ foo/ | |
165dd4a6 | 216 | EOT |
558d482c | 217 | diff $diffopt "$chkfile" "$outfile" || test_fail "test 13 failed" |
165dd4a6 WD |
218 | |
219 | rm -rf "$todir" | |
220 | $RSYNC -vvplrtH --link-dest="$lddir" "$fromdir/" "$todir/" \ | |
221 | | tee "$outfile" | |
222 | filter_outfile | |
223 | cat <<EOT >"$chkfile" | |
224 | ./ | |
225 | bar/ | |
226 | bar/baz/ | |
227 | bar/baz/rsync is uptodate | |
228 | foo/ | |
229 | foo/config1 is uptodate | |
230 | foo/config2 is uptodate | |
231 | "foo/extra" is a hard link | |
232 | foo/sym is uptodate | |
233 | EOT | |
558d482c | 234 | diff $diffopt "$chkfile" "$outfile" || test_fail "test 14 failed" |
165dd4a6 WD |
235 | |
236 | rm -rf "$todir" | |
237 | $RSYNC -ivvplrtH --compare-dest="$lddir" "$fromdir/" "$todir/" \ | |
238 | | tee "$outfile" | |
239 | filter_outfile | |
240 | # TODO fix really-old problem when combining -H with --compare-dest: | |
241 | # missing output for foo/extra hard-link (and it might not be updated)! | |
242 | cat <<EOT >"$chkfile" | |
418b6a27 | 243 | cd+++++++ ./ |
503f1634 WD |
244 | cd+++++++ bar/ |
245 | cd+++++++ bar/baz/ | |
246 | .f bar/baz/rsync | |
247 | cd+++++++ foo/ | |
248 | .f foo/config1 | |
249 | .f foo/config2 | |
250 | .L foo/sym -> ../bar/baz/rsync | |
165dd4a6 | 251 | EOT |
558d482c | 252 | diff $diffopt "$chkfile" "$outfile" || test_fail "test 15 failed" |
165dd4a6 WD |
253 | |
254 | rm -rf "$todir" | |
255 | $RSYNC -iplrtH --compare-dest="$lddir" "$fromdir/" "$todir/" \ | |
256 | | tee "$outfile" | |
257 | cat <<EOT >"$chkfile" | |
418b6a27 | 258 | cd+++++++ ./ |
503f1634 WD |
259 | cd+++++++ bar/ |
260 | cd+++++++ bar/baz/ | |
261 | cd+++++++ foo/ | |
165dd4a6 | 262 | EOT |
558d482c | 263 | diff $diffopt "$chkfile" "$outfile" || test_fail "test 16 failed" |
165dd4a6 WD |
264 | |
265 | rm -rf "$todir" | |
266 | $RSYNC -vvplrtH --compare-dest="$lddir" "$fromdir/" "$todir/" \ | |
267 | | tee "$outfile" | |
268 | filter_outfile | |
269 | cat <<EOT >"$chkfile" | |
270 | ./ | |
271 | bar/ | |
272 | bar/baz/ | |
273 | bar/baz/rsync is uptodate | |
274 | foo/ | |
275 | foo/config1 is uptodate | |
276 | foo/config2 is uptodate | |
277 | "foo/extra" is a hard link | |
278 | foo/sym is uptodate | |
279 | EOT | |
558d482c | 280 | diff $diffopt "$chkfile" "$outfile" || test_fail "test 17 failed" |
165dd4a6 | 281 | |
5794112a WD |
282 | # The script would have aborted on error, so getting here means we've won. |
283 | exit 0 |