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