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"
21 sed -e '/^building file list /d' \
22 -e '/^created directory /d' \
24 -e '/ --whole-file$/d' \
27 <"$outfile" >"$outfile.new"
28 mv "$outfile.new" "$outfile"
31 makepath "$fromdir/foo"
32 makepath "$fromdir/bar/baz"
33 cp -p "$srcdir/config.h" "$fromdir/foo/config1"
34 cp -p "$srcdir/config.h.in" "$fromdir/foo/config2"
35 cp -p "$srcdir/rsync.h" "$fromdir/bar/baz/rsync"
36 chmod 600 "$fromdir"/foo/config? "$fromdir/bar/baz/rsync"
38 ln -s ../bar/baz/rsync "$fromdir/foo/sym"
40 ln "$fromdir/foo/config1" "$fromdir/foo/extra"
42 $RSYNC -iplr "$fromdir/" "$todir/" \
47 >f+++++++ bar/baz/rsync
52 cL+++++++ foo/sym -> ../bar/baz/rsync
54 diff $diffopt "$chkfile" "$outfile" || test_fail "test 1 failed"
56 # Ensure there are no accidental directory-time problems.
57 $RSYNC -a -f '-! */' "$fromdir/" "$todir"
59 cp -p "$srcdir/config.h" "$fromdir/foo/config2"
60 chmod 601 "$fromdir/foo/config2"
61 $RSYNC -iplrH "$fromdir/" "$todir/" \
64 >f..T.... bar/baz/rsync
67 hf..T.... foo/extra => foo/config1
69 diff $diffopt "$chkfile" "$outfile" || test_fail "test 2 failed"
71 $RSYNC -a -f '-! */' "$fromdir/" "$todir"
72 sleep 1 # For directory mod below to ensure time difference
75 ln -s ../bar/baz "$todir/foo/sym"
77 cp -p "$srcdir/config.h.in" "$fromdir/foo/config2"
78 chmod 600 "$fromdir/foo/config2"
79 chmod 777 "$todir/bar/baz/rsync"
81 $RSYNC -iplrtc "$fromdir/" "$todir/" \
84 .f..tp... bar/baz/rsync
88 cL..T.... foo/sym -> ../bar/baz/rsync
90 diff $diffopt "$chkfile" "$outfile" || test_fail "test 3 failed"
92 cp -p "$srcdir/config.h" "$fromdir/foo/config2"
93 chmod 600 "$fromdir/foo/config2"
94 # Lack of -t is for unchanged hard-link stress-test!
95 $RSYNC -vvplrH "$fromdir/" "$todir/" \
98 bar/baz/rsync is uptodate
99 foo/config1 is uptodate
101 "foo/extra" is a hard link
105 diff $diffopt "$chkfile" "$outfile" || test_fail "test 4 failed"
107 chmod 747 "$todir/bar/baz/rsync"
108 $RSYNC -a -f '-! */' "$fromdir/" "$todir"
109 $RSYNC -ivvplrtH "$fromdir/" "$todir/" \
111 cat <<EOT >"$chkfile"
115 .f...p... bar/baz/rsync
118 >f..t.... foo/config2
120 .L foo/sym -> ../bar/baz/rsync
123 diff $diffopt "$chkfile" "$outfile" || test_fail "test 5 failed"
125 chmod 757 "$todir/foo/config1"
126 touch "$todir/foo/config2"
127 $RSYNC -vplrtH "$fromdir/" "$todir/" \
129 cat <<EOT >"$chkfile"
133 diff $diffopt "$chkfile" "$outfile" || test_fail "test 6 failed"
135 chmod 757 "$todir/foo/config1"
136 touch "$todir/foo/config2"
137 $RSYNC -iplrtH "$fromdir/" "$todir/" \
139 cat <<EOT >"$chkfile"
140 .f...p... foo/config1
141 >f..t.... foo/config2
143 diff $diffopt "$chkfile" "$outfile" || test_fail "test 7 failed"
146 $RSYNC -ivvplrtH --copy-dest="$lddir" "$fromdir/" "$todir/" \
148 cat <<EOT >"$chkfile"
152 cf....... bar/baz/rsync
154 cf....... foo/config1
155 cf....... foo/config2
156 hf+++++++ foo/extra => foo/config1
157 cL+++++++ foo/sym -> ../bar/baz/rsync
160 diff $diffopt "$chkfile" "$outfile" || test_fail "test 8 failed"
163 $RSYNC -iplrtH --link-dest="$lddir" "$fromdir/" "$todir/" \
165 cat <<EOT >"$chkfile"
170 hf+++++++ foo/extra => foo/config1
171 cL+++++++ foo/sym -> ../bar/baz/rsync
173 diff $diffopt "$chkfile" "$outfile" || test_fail "test 9 failed"
175 # The script would have aborted on error, so getting here means we've won.