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