Added a missing '(' in the opening comments.
[rsync/rsync.git] / testsuite / itemize.test
... / ...
CommitLineData
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
13lddir="$tmpdir/ld"
14
15chkfile="$scratchdir/rsync.chk"
16outfile="$scratchdir/rsync.out"
17
18makepath "$fromdir/foo"
19makepath "$fromdir/bar/baz"
20cp -p "$srcdir/configure.in" "$fromdir/foo/config1"
21cp -p "$srcdir/config.h.in" "$fromdir/foo/config2"
22cp -p "$srcdir/rsync.h" "$fromdir/bar/baz/rsync"
23chmod 600 "$fromdir"/foo/config? "$fromdir/bar/baz/rsync"
24umask 0
25ln -s ../bar/baz/rsync "$fromdir/foo/sym"
26umask 022
27ln "$fromdir/foo/config1" "$fromdir/foo/extra"
28
29$RSYNC -iplr "$fromdir/" "$todir/" \
30 | tee "$outfile"
31cat <<EOT >"$chkfile"
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
40EOT
41diff $diffopt "$chkfile" "$outfile" || test_fail "test 1 failed"
42
43# Ensure there are no accidental directory-time problems.
44$RSYNC -a -f '-! */' "$fromdir/" "$todir"
45
46cp -p "$srcdir/configure.in" "$fromdir/foo/config2"
47chmod 601 "$fromdir/foo/config2"
48$RSYNC -iplrH "$fromdir/" "$todir/" \
49 | tee "$outfile"
50cat <<EOT >"$chkfile"
51>f..T... bar/baz/rsync
52>f..T... foo/config1
53>f.sTp.. foo/config2
54hf..T... foo/extra => foo/config1
55EOT
56diff $diffopt "$chkfile" "$outfile" || test_fail "test 2 failed"
57
58$RSYNC -a -f '-! */' "$fromdir/" "$todir"
59sleep 1 # For directory mod below to ensure time difference
60rm "$todir/foo/sym"
61umask 0
62ln -s ../bar/baz "$todir/foo/sym"
63umask 022
64cp -p "$srcdir/config.h.in" "$fromdir/foo/config2"
65chmod 600 "$fromdir/foo/config2"
66chmod 777 "$todir/bar/baz/rsync"
67
68$RSYNC -iplrtc "$fromdir/" "$todir/" \
69 | tee "$outfile"
70cat <<EOT >"$chkfile"
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
76EOT
77diff $diffopt "$chkfile" "$outfile" || test_fail "test 3 failed"
78
79cp -p "$srcdir/configure.in" "$fromdir/foo/config2"
80chmod 600 "$fromdir/foo/config2"
81# Lack of -t is for unchanged hard-link stress-test!
82$RSYNC -vvplrH "$fromdir/" "$todir/" \
83 | tee "$outfile"
84filter_outfile
85cat <<EOT >"$chkfile"
86bar/baz/rsync is uptodate
87foo/config1 is uptodate
88foo/config2
89"foo/extra" is a hard link
90foo/sym is uptodate
91EOT
92diff $diffopt "$chkfile" "$outfile" || test_fail "test 4 failed"
93
94chmod 747 "$todir/bar/baz/rsync"
95$RSYNC -a -f '-! */' "$fromdir/" "$todir"
96$RSYNC -ivvplrtH "$fromdir/" "$todir/" \
97 | tee "$outfile"
98filter_outfile
99cat <<EOT >"$chkfile"
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
109EOT
110diff $diffopt "$chkfile" "$outfile" || test_fail "test 5 failed"
111
112chmod 757 "$todir/foo/config1"
113touch "$todir/foo/config2"
114$RSYNC -vplrtH "$fromdir/" "$todir/" \
115 | tee "$outfile"
116filter_outfile
117cat <<EOT >"$chkfile"
118foo/config2
119EOT
120diff $diffopt "$chkfile" "$outfile" || test_fail "test 6 failed"
121
122chmod 757 "$todir/foo/config1"
123touch "$todir/foo/config2"
124$RSYNC -iplrtH "$fromdir/" "$todir/" \
125 | tee "$outfile"
126cat <<EOT >"$chkfile"
127.f...p.. foo/config1
128>f..t... foo/config2
129EOT
130diff $diffopt "$chkfile" "$outfile" || test_fail "test 7 failed"
131
132mv "$todir" "$lddir"
133$RSYNC -ivvplrtH --copy-dest="$lddir" "$fromdir/" "$todir/" \
134 | tee "$outfile"
135filter_outfile
136cat <<EOT >"$chkfile"
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
146EOT
147diff $diffopt "$chkfile" "$outfile" || test_fail "test 8 failed"
148
149rm -rf "$todir"
150$RSYNC -iplrtH --copy-dest="$lddir" "$fromdir/" "$todir/" \
151 | tee "$outfile"
152cat <<EOT >"$chkfile"
153.d..t... ./
154cd++++++ bar/
155cd++++++ bar/baz/
156cd++++++ foo/
157hf foo/extra => foo/config1
158EOT
159diff $diffopt "$chkfile" "$outfile" || test_fail "test 9 failed"
160
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"
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
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"
200.d..t... ./
201cd++++++ bar/
202cd++++++ bar/baz/
203cd++++++ foo/
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"
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
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"
246.d..t... ./
247cd++++++ bar/
248cd++++++ bar/baz/
249cd++++++ foo/
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
270# The script would have aborted on error, so getting here means we've won.
271exit 0