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