3 # Copyright (C) 2005 by Wayne Davison <wayned@samba.org>
5 # This program is distributable under the terms of the GNU GPL see
8 # Test the output of various copy commands to ensure itemized output
9 # and double-verbose output is correct.
11 . "$suitedir/rsync.fns"
17 chkfile="$scratchdir/rsync.chk"
18 outfile="$scratchdir/rsync.out"
20 # This is only called if rsync was run with -v or -vv (not -i alone).
21 # Higher levels of -v would require more filtering.
23 sed -e '/^building file list /d' \
24 -e '/^created directory /d' \
26 -e '/ --whole-file$/d' \
29 <"$outfile" >"$outfile.new"
30 mv "$outfile.new" "$outfile"
33 makepath "$fromdir/foo"
34 makepath "$fromdir/bar/baz"
35 cp -p "$srcdir/configure.in" "$fromdir/foo/config1"
36 cp -p "$srcdir/config.h.in" "$fromdir/foo/config2"
37 cp -p "$srcdir/rsync.h" "$fromdir/bar/baz/rsync"
38 chmod 600 "$fromdir"/foo/config? "$fromdir/bar/baz/rsync"
40 ln -s ../bar/baz/rsync "$fromdir/foo/sym"
42 ln "$fromdir/foo/config1" "$fromdir/foo/extra"
44 $RSYNC -iplr "$fromdir/" "$todir/" \
49 >f+++++++ bar/baz/rsync
54 cL+++++++ foo/sym -> ../bar/baz/rsync
56 diff $diffopt "$chkfile" "$outfile" || test_fail "test 1 failed"
58 # Ensure there are no accidental directory-time problems.
59 $RSYNC -a -f '-! */' "$fromdir/" "$todir"
61 cp -p "$srcdir/configure.in" "$fromdir/foo/config2"
62 chmod 601 "$fromdir/foo/config2"
63 $RSYNC -iplrH "$fromdir/" "$todir/" \
66 >f..T.... bar/baz/rsync
69 hf..T.... foo/extra => foo/config1
71 diff $diffopt "$chkfile" "$outfile" || test_fail "test 2 failed"
73 $RSYNC -a -f '-! */' "$fromdir/" "$todir"
74 sleep 1 # For directory mod below to ensure time difference
77 ln -s ../bar/baz "$todir/foo/sym"
79 cp -p "$srcdir/config.h.in" "$fromdir/foo/config2"
80 chmod 600 "$fromdir/foo/config2"
81 chmod 777 "$todir/bar/baz/rsync"
83 $RSYNC -iplrtc "$fromdir/" "$todir/" \
86 .f..tp... bar/baz/rsync
90 cL..T.... foo/sym -> ../bar/baz/rsync
92 diff $diffopt "$chkfile" "$outfile" || test_fail "test 3 failed"
94 cp -p "$srcdir/configure.in" "$fromdir/foo/config2"
95 chmod 600 "$fromdir/foo/config2"
96 # Lack of -t is for unchanged hard-link stress-test!
97 $RSYNC -vvplrH "$fromdir/" "$todir/" \
100 cat <<EOT >"$chkfile"
101 bar/baz/rsync is uptodate
102 foo/config1 is uptodate
104 "foo/extra" is a hard link
107 diff $diffopt "$chkfile" "$outfile" || test_fail "test 4 failed"
109 chmod 747 "$todir/bar/baz/rsync"
110 $RSYNC -a -f '-! */' "$fromdir/" "$todir"
111 $RSYNC -ivvplrtH "$fromdir/" "$todir/" \
114 cat <<EOT >"$chkfile"
118 .f...p... bar/baz/rsync
121 >f..t.... foo/config2
123 .L foo/sym -> ../bar/baz/rsync
125 diff $diffopt "$chkfile" "$outfile" || test_fail "test 5 failed"
127 chmod 757 "$todir/foo/config1"
128 touch "$todir/foo/config2"
129 $RSYNC -vplrtH "$fromdir/" "$todir/" \
132 cat <<EOT >"$chkfile"
135 diff $diffopt "$chkfile" "$outfile" || test_fail "test 6 failed"
137 chmod 757 "$todir/foo/config1"
138 touch "$todir/foo/config2"
139 $RSYNC -iplrtH "$fromdir/" "$todir/" \
141 cat <<EOT >"$chkfile"
142 .f...p... foo/config1
143 >f..t.... foo/config2
145 diff $diffopt "$chkfile" "$outfile" || test_fail "test 7 failed"
148 $RSYNC -ivvplrtH --copy-dest="$lddir" "$fromdir/" "$todir/" \
151 cat <<EOT >"$chkfile"
155 cf....... bar/baz/rsync
157 cf....... foo/config1
158 cf....... foo/config2
159 hf+++++++ foo/extra => foo/config1
160 cL+++++++ foo/sym -> ../bar/baz/rsync
162 diff $diffopt "$chkfile" "$outfile" || test_fail "test 8 failed"
165 $RSYNC -iplrtH --link-dest="$lddir" "$fromdir/" "$todir/" \
167 cat <<EOT >"$chkfile"
172 hf+++++++ foo/extra => foo/config1
173 cL+++++++ foo/sym -> ../bar/baz/rsync
175 diff $diffopt "$chkfile" "$outfile" || test_fail "test 9 failed"
177 # The script would have aborted on error, so getting here means we've won.