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
63 ln -s ../bar/baz "$todir/foo/sym"
65 cp -p "$srcdir/config.h.in" "$fromdir/foo/config2"
66 chmod 600 "$fromdir/foo/config2"
67 chmod 777 "$todir/bar/baz/rsync"
69 $RSYNC -iplrtc "$fromdir/" "$todir/" \
71 cat <<EOT | diff $diffopt - "$outfile" || test_fail "test 3 failed"
72 .f..tp... bar/baz/rsync
76 cL..T.... foo/sym -> ../bar/baz/rsync
79 cp -p "$srcdir/config.h" "$fromdir/foo/config2"
80 chmod 600 "$fromdir/foo/config2"
81 # Lack of -t is for unchanged hard-link stress-test!
82 $RSYNC -vvplrH "$fromdir/" "$todir/" \
83 | sed -e '1,/done$/d' -e '/--whole-file/d' -e '/total:/d' -e '/^$/,$d' \
85 cat <<EOT | diff $diffopt - "$outfile" || test_fail "test 4 failed"
86 bar/baz/rsync is uptodate
87 foo/config1 is uptodate
89 "foo/extra" is a hard link
93 chmod 747 "$todir/bar/baz/rsync"
94 $RSYNC -a -f '-! */' "$fromdir/" "$todir"
95 $RSYNC -ivvplrtH "$fromdir/" "$todir/" \
98 cat <<EOT | diff $diffopt - "$outfile" || test_fail "test 5 failed"
102 .f...p... bar/baz/rsync
105 >f..t.... foo/config2
107 .L foo/sym -> ../bar/baz/rsync
110 chmod 757 "$todir/foo/config1"
111 touch "$todir/foo/config2"
112 $RSYNC -vplrtH "$fromdir/" "$todir/" \
113 | sed -e '/done$/d' -e '/^$/,$d' \
115 cat <<EOT | diff $diffopt - "$outfile" || test_fail "test 6 failed"
119 chmod 757 "$todir/foo/config1"
120 touch "$todir/foo/config2"
121 $RSYNC -iplrtH "$fromdir/" "$todir/" \
123 cat <<EOT | diff $diffopt - "$outfile" || test_fail "test 7 failed"
124 .f...p... foo/config1
125 >f..t.... foo/config2
129 $RSYNC -ivvplrtH --copy-dest="$lddir" "$fromdir/" "$todir/" \
130 | grep "$itemregex" \
132 cat <<EOT | diff $diffopt - "$outfile" || test_fail "test 8 failed"
136 cf....... bar/baz/rsync
138 cf....... foo/config1
139 cf....... foo/config2
140 hf+++++++ foo/extra => foo/config1
141 cL+++++++ foo/sym -> ../bar/baz/rsync
145 $RSYNC -iplrtH --link-dest="$lddir" "$fromdir/" "$todir/" \
147 cat <<EOT | diff $diffopt - "$outfile" || test_fail "test 9 failed"
152 hf+++++++ foo/extra => foo/config1
153 cL+++++++ foo/sym -> ../bar/baz/rsync
156 # The script would have aborted on error, so getting here means we've won.