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