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"
27 ln -s ../bar/baz/rsync "$fromdir/foo/sym"
28 ln "$fromdir/foo/config1" "$fromdir/foo/extra"
30 $RSYNC -iplr "$fromdir/" "$todir/" \
32 cat <<EOT | diff $diffopt - "$outfile" || test_fail "test 1 failed"
35 >f+++++++ bar/baz/rsync
40 cL+++++++ foo/sym -> ../bar/baz/rsync
43 # Ensure there are no accidental directory-time problems.
44 $RSYNC -a -f '-! */' "$fromdir/" "$todir"
46 cp -p "$srcdir/config.h" "$fromdir/foo/config2"
47 chmod 601 "$fromdir/foo/config2"
48 $RSYNC -iplrH "$fromdir/" "$todir/" \
50 cat <<EOT | diff $diffopt - "$outfile" || test_fail "test 2 failed"
51 >f..T.... bar/baz/rsync
54 hf..T.... foo/extra => foo/config1
57 $RSYNC -a -f '-! */' "$fromdir/" "$todir"
58 sleep 1 # For directory mod below to ensure time difference
60 ln -s ../bar/baz "$todir/foo/sym"
61 cp -p "$srcdir/config.h.in" "$fromdir/foo/config2"
62 chmod 600 "$fromdir/foo/config2"
63 chmod 777 "$todir/bar/baz/rsync"
65 $RSYNC -iplrtc "$fromdir/" "$todir/" \
67 cat <<EOT | diff $diffopt - "$outfile" || test_fail "test 3 failed"
68 .f..tp... bar/baz/rsync
72 cL..T.... foo/sym -> ../bar/baz/rsync
75 cp -p "$srcdir/config.h" "$fromdir/foo/config2"
76 chmod 600 "$fromdir/foo/config2"
77 # Lack of -t is for unchanged hard-link stress-test!
78 $RSYNC -vvplrH "$fromdir/" "$todir/" \
79 | sed -e '0,/done$/d' -e '/--whole-file/d' -e '/total:/d' -e '/^$/,$d' \
81 cat <<EOT | diff $diffopt - "$outfile" || test_fail "test 4 failed"
82 bar/baz/rsync is uptodate
83 foo/config1 is uptodate
85 "foo/extra" is a hard link
89 chmod 747 "$todir/bar/baz/rsync"
90 $RSYNC -a -f '-! */' "$fromdir/" "$todir"
91 $RSYNC -ivvplrtH "$fromdir/" "$todir/" \
94 cat <<EOT | diff $diffopt - "$outfile" || test_fail "test 5 failed"
98 .f...p... bar/baz/rsync
101 >f..t.... foo/config2
103 .L foo/sym -> ../bar/baz/rsync
106 chmod 757 "$todir/foo/config1"
107 touch "$todir/foo/config2"
108 $RSYNC -vplrtH "$fromdir/" "$todir/" \
109 | sed -e '0,/done$/d' -e '/^$/,$d' \
111 cat <<EOT | diff $diffopt - "$outfile" || test_fail "test 6 failed"
115 chmod 757 "$todir/foo/config1"
116 touch "$todir/foo/config2"
117 $RSYNC -iplrtH "$fromdir/" "$todir/" \
119 cat <<EOT | diff $diffopt - "$outfile" || test_fail "test 7 failed"
120 .f...p... foo/config1
121 >f..t.... foo/config2
125 $RSYNC -ivvplrtH --copy-dest="$lddir" "$fromdir/" "$todir/" \
126 | grep "$itemregex" \
128 cat <<EOT | diff $diffopt - "$outfile" || test_fail "test 8 failed"
132 cf....... bar/baz/rsync
134 cf....... foo/config1
135 cf....... foo/config2
136 hf+++++++ foo/extra => foo/config1
137 cL+++++++ foo/sym -> ../bar/baz/rsync
141 $RSYNC -iplrtH --link-dest="$lddir" "$fromdir/" "$todir/" \
143 cat <<EOT | diff $diffopt - "$outfile" || test_fail "test 9 failed"
148 hf+++++++ foo/extra => foo/config1
149 cL+++++++ foo/sym -> ../bar/baz/rsync
152 # The script would have aborted on error, so getting here means we've won.