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