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