Tweaked some whitespace to match the latest version from autoconf.
[rsync/rsync.git] / testsuite / itemize.test
CommitLineData
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
13lddir="$tmpdir/ld"
14
4f3be36e 15chkfile="$scratchdir/rsync.chk"
5794112a
WD
16outfile="$scratchdir/rsync.out"
17
18makepath "$fromdir/foo"
19makepath "$fromdir/bar/baz"
309a5be8 20cp -p "$srcdir/configure.in" "$fromdir/foo/config1"
5794112a
WD
21cp -p "$srcdir/config.h.in" "$fromdir/foo/config2"
22cp -p "$srcdir/rsync.h" "$fromdir/bar/baz/rsync"
e73ad2be 23chmod 600 "$fromdir"/foo/config? "$fromdir/bar/baz/rsync"
87a57a30 24umask 0
5794112a 25ln -s ../bar/baz/rsync "$fromdir/foo/sym"
87a57a30 26umask 022
5794112a
WD
27ln "$fromdir/foo/config1" "$fromdir/foo/extra"
28
29$RSYNC -iplr "$fromdir/" "$todir/" \
30 | tee "$outfile"
4f3be36e 31cat <<EOT >"$chkfile"
503f1634
WD
32cd+++++++ bar/
33cd+++++++ bar/baz/
34>f+++++++ bar/baz/rsync
35cd+++++++ foo/
36>f+++++++ foo/config1
37>f+++++++ foo/config2
38>f+++++++ foo/extra
39cL+++++++ foo/sym -> ../bar/baz/rsync
5794112a 40EOT
4f3be36e 41diff $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 46cp -p "$srcdir/configure.in" "$fromdir/foo/config2"
e73ad2be 47chmod 601 "$fromdir/foo/config2"
5794112a
WD
48$RSYNC -iplrH "$fromdir/" "$todir/" \
49 | tee "$outfile"
4f3be36e 50cat <<EOT >"$chkfile"
503f1634
WD
51>f..T.... bar/baz/rsync
52>f..T.... foo/config1
53>f.sTp... foo/config2
54hf..T.... foo/extra => foo/config1
5794112a 55EOT
4f3be36e 56diff $diffopt "$chkfile" "$outfile" || test_fail "test 2 failed"
5794112a
WD
57
58$RSYNC -a -f '-! */' "$fromdir/" "$todir"
59sleep 1 # For directory mod below to ensure time difference
60rm "$todir/foo/sym"
a3dcb790 61umask 0
5794112a 62ln -s ../bar/baz "$todir/foo/sym"
a3dcb790 63umask 022
5794112a 64cp -p "$srcdir/config.h.in" "$fromdir/foo/config2"
e73ad2be 65chmod 600 "$fromdir/foo/config2"
5794112a
WD
66chmod 777 "$todir/bar/baz/rsync"
67
68$RSYNC -iplrtc "$fromdir/" "$todir/" \
69 | tee "$outfile"
4f3be36e 70cat <<EOT >"$chkfile"
503f1634
WD
71.f..tp... bar/baz/rsync
72.d..t.... foo/
73.f..t.... foo/config1
74>fcstp... foo/config2
75cL..T.... foo/sym -> ../bar/baz/rsync
5794112a 76EOT
4f3be36e 77diff $diffopt "$chkfile" "$outfile" || test_fail "test 3 failed"
5794112a 78
309a5be8 79cp -p "$srcdir/configure.in" "$fromdir/foo/config2"
e73ad2be 80chmod 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 84filter_outfile
4f3be36e 85cat <<EOT >"$chkfile"
5794112a
WD
86bar/baz/rsync is uptodate
87foo/config1 is uptodate
88foo/config2
89"foo/extra" is a hard link
90foo/sym is uptodate
91EOT
4f3be36e 92diff $diffopt "$chkfile" "$outfile" || test_fail "test 4 failed"
5794112a
WD
93
94chmod 747 "$todir/bar/baz/rsync"
95$RSYNC -a -f '-! */' "$fromdir/" "$todir"
96$RSYNC -ivvplrtH "$fromdir/" "$todir/" \
5794112a 97 | tee "$outfile"
8af1bc90 98filter_outfile
4f3be36e 99cat <<EOT >"$chkfile"
503f1634
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
107hf foo/extra
108.L foo/sym -> ../bar/baz/rsync
5794112a 109EOT
4f3be36e 110diff $diffopt "$chkfile" "$outfile" || test_fail "test 5 failed"
5794112a
WD
111
112chmod 757 "$todir/foo/config1"
113touch "$todir/foo/config2"
114$RSYNC -vplrtH "$fromdir/" "$todir/" \
5794112a 115 | tee "$outfile"
8af1bc90 116filter_outfile
4f3be36e 117cat <<EOT >"$chkfile"
5794112a
WD
118foo/config2
119EOT
4f3be36e 120diff $diffopt "$chkfile" "$outfile" || test_fail "test 6 failed"
5794112a
WD
121
122chmod 757 "$todir/foo/config1"
123touch "$todir/foo/config2"
124$RSYNC -iplrtH "$fromdir/" "$todir/" \
125 | tee "$outfile"
4f3be36e 126cat <<EOT >"$chkfile"
503f1634
WD
127.f...p... foo/config1
128>f..t.... foo/config2
5794112a 129EOT
4f3be36e 130diff $diffopt "$chkfile" "$outfile" || test_fail "test 7 failed"
5794112a
WD
131
132mv "$todir" "$lddir"
133$RSYNC -ivvplrtH --copy-dest="$lddir" "$fromdir/" "$todir/" \
5794112a 134 | tee "$outfile"
8af1bc90 135filter_outfile
4f3be36e 136cat <<EOT >"$chkfile"
503f1634
WD
137.d..t.... ./
138cd+++++++ bar/
139cd+++++++ bar/baz/
140cf bar/baz/rsync
141cd+++++++ foo/
142cf foo/config1
143cf foo/config2
144hf foo/extra => foo/config1
145cL..T.... foo/sym -> ../bar/baz/rsync
5794112a 146EOT
4f3be36e 147diff $diffopt "$chkfile" "$outfile" || test_fail "test 8 failed"
5794112a
WD
148
149rm -rf "$todir"
165dd4a6 150$RSYNC -iplrtH --copy-dest="$lddir" "$fromdir/" "$todir/" \
5794112a 151 | tee "$outfile"
4f3be36e 152cat <<EOT >"$chkfile"
503f1634
WD
153.d..t.... ./
154cd+++++++ bar/
155cd+++++++ bar/baz/
156cd+++++++ foo/
157hf foo/extra => foo/config1
5794112a 158EOT
4f3be36e 159diff $diffopt "$chkfile" "$outfile" || test_fail "test 9 failed"
5794112a 160
165dd4a6
WD
161rm -rf "$todir"
162$RSYNC -vvplrtH --copy-dest="$lddir" "$fromdir/" "$todir/" \
163 | tee "$outfile"
164filter_outfile
165cat <<EOT >"$chkfile"
166./
167bar/
168bar/baz/
169bar/baz/rsync is uptodate
170foo/
171foo/config1 is uptodate
172foo/config2 is uptodate
173"foo/extra" is a hard link
174foo/extra => foo/config1
175foo/sym is uptodate
176EOT
177diff $diffopt "$chkfile" "$outfile" || test_fail "test 10 failed"
178
179rm -rf "$todir"
180$RSYNC -ivvplrtH --link-dest="$lddir" "$fromdir/" "$todir/" \
181 | tee "$outfile"
182filter_outfile
183cat <<EOT >"$chkfile"
503f1634
WD
184.d..t.... ./
185cd+++++++ bar/
186cd+++++++ bar/baz/
187hf bar/baz/rsync
188cd+++++++ foo/
189hf foo/config1
190hf foo/config2
191hf foo/extra => foo/config1
192hL foo/sym -> ../bar/baz/rsync
165dd4a6
WD
193EOT
194diff $diffopt "$chkfile" "$outfile" || test_fail "test 11 failed"
195
196rm -rf "$todir"
197$RSYNC -iplrtH --link-dest="$lddir" "$fromdir/" "$todir/" \
198 | tee "$outfile"
199cat <<EOT >"$chkfile"
503f1634
WD
200.d..t.... ./
201cd+++++++ bar/
202cd+++++++ bar/baz/
203cd+++++++ foo/
165dd4a6
WD
204EOT
205diff $diffopt "$chkfile" "$outfile" || test_fail "test 12 failed"
206
207rm -rf "$todir"
208$RSYNC -vvplrtH --link-dest="$lddir" "$fromdir/" "$todir/" \
209 | tee "$outfile"
210filter_outfile
211cat <<EOT >"$chkfile"
212./
213bar/
214bar/baz/
215bar/baz/rsync is uptodate
216foo/
217foo/config1 is uptodate
218foo/config2 is uptodate
219"foo/extra" is a hard link
220foo/sym is uptodate
221EOT
222diff $diffopt "$chkfile" "$outfile" || test_fail "test 13 failed"
223
224rm -rf "$todir"
225$RSYNC -ivvplrtH --compare-dest="$lddir" "$fromdir/" "$todir/" \
226 | tee "$outfile"
227filter_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)!
230cat <<EOT >"$chkfile"
503f1634
WD
231.d..t.... ./
232cd+++++++ bar/
233cd+++++++ bar/baz/
234.f bar/baz/rsync
235cd+++++++ foo/
236.f foo/config1
237.f foo/config2
238.L foo/sym -> ../bar/baz/rsync
165dd4a6
WD
239EOT
240diff $diffopt "$chkfile" "$outfile" || test_fail "test 14 failed"
241
242rm -rf "$todir"
243$RSYNC -iplrtH --compare-dest="$lddir" "$fromdir/" "$todir/" \
244 | tee "$outfile"
245cat <<EOT >"$chkfile"
503f1634
WD
246.d..t.... ./
247cd+++++++ bar/
248cd+++++++ bar/baz/
249cd+++++++ foo/
165dd4a6
WD
250EOT
251diff $diffopt "$chkfile" "$outfile" || test_fail "test 15 failed"
252
253rm -rf "$todir"
254$RSYNC -vvplrtH --compare-dest="$lddir" "$fromdir/" "$todir/" \
255 | tee "$outfile"
256filter_outfile
257cat <<EOT >"$chkfile"
258./
259bar/
260bar/baz/
261bar/baz/rsync is uptodate
262foo/
263foo/config1 is uptodate
264foo/config2 is uptodate
265"foo/extra" is a hard link
266foo/sym is uptodate
267EOT
268diff $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.
271exit 0