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 \|^created directory \|^done$/d' \
22 -e '/ --whole-file\|total: /d' \
24 <"$outfile" >"$outfile.new"
25 mv "$outfile.new" "$outfile"
28 makepath "$fromdir/foo"
29 makepath "$fromdir/bar/baz"
30 cp -p "$srcdir/config.h" "$fromdir/foo/config1"
31 cp -p "$srcdir/config.h.in" "$fromdir/foo/config2"
32 cp -p "$srcdir/rsync.h" "$fromdir/bar/baz/rsync"
33 chmod 600 "$fromdir"/foo/config? "$fromdir/bar/baz/rsync"
35 ln -s ../bar/baz/rsync "$fromdir/foo/sym"
37 ln "$fromdir/foo/config1" "$fromdir/foo/extra"
39 $RSYNC -iplr "$fromdir/" "$todir/" \
44 >f+++++++ bar/baz/rsync
49 cL+++++++ foo/sym -> ../bar/baz/rsync
51 diff $diffopt "$chkfile" "$outfile" || test_fail "test 1 failed"
53 # Ensure there are no accidental directory-time problems.
54 $RSYNC -a -f '-! */' "$fromdir/" "$todir"
56 cp -p "$srcdir/config.h" "$fromdir/foo/config2"
57 chmod 601 "$fromdir/foo/config2"
58 $RSYNC -iplrH "$fromdir/" "$todir/" \
61 >f..T.... bar/baz/rsync
64 hf..T.... foo/extra => foo/config1
66 diff $diffopt "$chkfile" "$outfile" || test_fail "test 2 failed"
68 $RSYNC -a -f '-! */' "$fromdir/" "$todir"
69 sleep 1 # For directory mod below to ensure time difference
72 ln -s ../bar/baz "$todir/foo/sym"
74 cp -p "$srcdir/config.h.in" "$fromdir/foo/config2"
75 chmod 600 "$fromdir/foo/config2"
76 chmod 777 "$todir/bar/baz/rsync"
78 $RSYNC -iplrtc "$fromdir/" "$todir/" \
81 .f..tp... bar/baz/rsync
85 cL..T.... foo/sym -> ../bar/baz/rsync
87 diff $diffopt "$chkfile" "$outfile" || test_fail "test 3 failed"
89 cp -p "$srcdir/config.h" "$fromdir/foo/config2"
90 chmod 600 "$fromdir/foo/config2"
91 # Lack of -t is for unchanged hard-link stress-test!
92 $RSYNC -vvplrH "$fromdir/" "$todir/" \
95 bar/baz/rsync is uptodate
96 foo/config1 is uptodate
98 "foo/extra" is a hard link
102 diff $diffopt "$chkfile" "$outfile" || test_fail "test 4 failed"
104 chmod 747 "$todir/bar/baz/rsync"
105 $RSYNC -a -f '-! */' "$fromdir/" "$todir"
106 $RSYNC -ivvplrtH "$fromdir/" "$todir/" \
108 cat <<EOT >"$chkfile"
112 .f...p... bar/baz/rsync
115 >f..t.... foo/config2
117 .L foo/sym -> ../bar/baz/rsync
120 diff $diffopt "$chkfile" "$outfile" || test_fail "test 5 failed"
122 chmod 757 "$todir/foo/config1"
123 touch "$todir/foo/config2"
124 $RSYNC -vplrtH "$fromdir/" "$todir/" \
126 cat <<EOT >"$chkfile"
130 diff $diffopt "$chkfile" "$outfile" || test_fail "test 6 failed"
132 chmod 757 "$todir/foo/config1"
133 touch "$todir/foo/config2"
134 $RSYNC -iplrtH "$fromdir/" "$todir/" \
136 cat <<EOT >"$chkfile"
137 .f...p... foo/config1
138 >f..t.... foo/config2
140 diff $diffopt "$chkfile" "$outfile" || test_fail "test 7 failed"
143 $RSYNC -ivvplrtH --copy-dest="$lddir" "$fromdir/" "$todir/" \
145 cat <<EOT >"$chkfile"
149 cf....... bar/baz/rsync
151 cf....... foo/config1
152 cf....... foo/config2
153 hf+++++++ foo/extra => foo/config1
154 cL+++++++ foo/sym -> ../bar/baz/rsync
157 diff $diffopt "$chkfile" "$outfile" || test_fail "test 8 failed"
160 $RSYNC -iplrtH --link-dest="$lddir" "$fromdir/" "$todir/" \
162 cat <<EOT >"$chkfile"
167 hf+++++++ foo/extra => foo/config1
168 cL+++++++ foo/sym -> ../bar/baz/rsync
170 diff $diffopt "$chkfile" "$outfile" || test_fail "test 9 failed"
172 # The script would have aborted on error, so getting here means we've won.