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