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"
15 itemregex='^[.<>ch][dfDL][c .+][s .+][tT .+][p .+][o .+][g .+][a .+] '
19 outfile="$scratchdir/rsync.out"
21 makepath "$fromdir/foo"
22 makepath "$fromdir/bar/baz"
23 cp -p "$srcdir/config.h" "$fromdir/foo/config1"
24 cp -p "$srcdir/config.h.in" "$fromdir/foo/config2"
25 cp -p "$srcdir/rsync.h" "$fromdir/bar/baz/rsync"
26 chmod 600 "$fromdir"/foo/config? "$fromdir/bar/baz/rsync"
28 ln -s ../bar/baz/rsync "$fromdir/foo/sym"
30 ln "$fromdir/foo/config1" "$fromdir/foo/extra"
32 $RSYNC -iplr "$fromdir/" "$todir/" \
34 cat <<EOT | diff $diffopt - "$outfile" || test_fail "test 1 failed"
37 >f+++++++ bar/baz/rsync
42 cL+++++++ foo/sym -> ../bar/baz/rsync
45 # Ensure there are no accidental directory-time problems.
46 $RSYNC -a -f '-! */' "$fromdir/" "$todir"
48 cp -p "$srcdir/config.h" "$fromdir/foo/config2"
49 chmod 601 "$fromdir/foo/config2"
50 $RSYNC -iplrH "$fromdir/" "$todir/" \
52 cat <<EOT | diff $diffopt - "$outfile" || test_fail "test 2 failed"
53 >f..T.... bar/baz/rsync
56 hf..T.... foo/extra => foo/config1
59 $RSYNC -a -f '-! */' "$fromdir/" "$todir"
60 sleep 1 # For directory mod below to ensure time difference
62 ln -s ../bar/baz "$todir/foo/sym"
63 cp -p "$srcdir/config.h.in" "$fromdir/foo/config2"
64 chmod 600 "$fromdir/foo/config2"
65 chmod 777 "$todir/bar/baz/rsync"
67 $RSYNC -iplrtc "$fromdir/" "$todir/" \
69 cat <<EOT | diff $diffopt - "$outfile" || test_fail "test 3 failed"
70 .f..tp... bar/baz/rsync
74 cL..T.... foo/sym -> ../bar/baz/rsync
77 cp -p "$srcdir/config.h" "$fromdir/foo/config2"
78 chmod 600 "$fromdir/foo/config2"
79 # Lack of -t is for unchanged hard-link stress-test!
80 $RSYNC -vvplrH "$fromdir/" "$todir/" \
81 | sed -e '1,/done$/d' -e '/--whole-file/d' -e '/total:/d' -e '/^$/,$d' \
83 cat <<EOT | diff $diffopt - "$outfile" || test_fail "test 4 failed"
84 bar/baz/rsync is uptodate
85 foo/config1 is uptodate
87 "foo/extra" is a hard link
91 chmod 747 "$todir/bar/baz/rsync"
92 $RSYNC -a -f '-! */' "$fromdir/" "$todir"
93 $RSYNC -ivvplrtH "$fromdir/" "$todir/" \
96 cat <<EOT | diff $diffopt - "$outfile" || test_fail "test 5 failed"
100 .f...p... bar/baz/rsync
103 >f..t.... foo/config2
105 .L foo/sym -> ../bar/baz/rsync
108 chmod 757 "$todir/foo/config1"
109 touch "$todir/foo/config2"
110 $RSYNC -vplrtH "$fromdir/" "$todir/" \
111 | sed -e '/done$/d' -e '/^$/,$d' \
113 cat <<EOT | diff $diffopt - "$outfile" || test_fail "test 6 failed"
117 chmod 757 "$todir/foo/config1"
118 touch "$todir/foo/config2"
119 $RSYNC -iplrtH "$fromdir/" "$todir/" \
121 cat <<EOT | diff $diffopt - "$outfile" || test_fail "test 7 failed"
122 .f...p... foo/config1
123 >f..t.... foo/config2
127 $RSYNC -ivvplrtH --copy-dest="$lddir" "$fromdir/" "$todir/" \
128 | grep "$itemregex" \
130 cat <<EOT | diff $diffopt - "$outfile" || test_fail "test 8 failed"
134 cf....... bar/baz/rsync
136 cf....... foo/config1
137 cf....... foo/config2
138 hf+++++++ foo/extra => foo/config1
139 cL+++++++ foo/sym -> ../bar/baz/rsync
143 $RSYNC -iplrtH --link-dest="$lddir" "$fromdir/" "$todir/" \
145 cat <<EOT | diff $diffopt - "$outfile" || test_fail "test 9 failed"
150 hf+++++++ foo/extra => foo/config1
151 cL+++++++ foo/sym -> ../bar/baz/rsync
154 # The script would have aborted on error, so getting here means we've won.