3 # Copyright (C) 2005-2022 Wayne Davison
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 makepath
"$fromdir/foo"
16 makepath
"$fromdir/bar/baz"
17 cp_p
"$srcdir/configure.ac" "$fromdir/foo/config1"
18 cp_p
"$srcdir/config.sub" "$fromdir/foo/config2"
19 cp_p
"$srcdir/rsync.h" "$fromdir/bar/baz/rsync"
20 chmod 600 "$fromdir"/foo
/config?
"$fromdir/bar/baz/rsync"
22 ln -s ..
/bar
/baz
/rsync
"$fromdir/foo/sym"
24 ln "$fromdir/foo/config1" "$fromdir/foo/extra"
27 # Check if rsync is set to hard-link symlinks.
28 if $RSYNC --version |
grep "[, ] hardlink-symlinks" >/dev
/null
; then
31 L_sym_dots
=".L$allspace"
32 is_uptodate
='is uptodate'
33 touch "$chkfile.extra"
37 L_sym_dots
="cL$sym_dots"
38 is_uptodate
='-> ../bar/baz/rsync'
39 echo "cL$sym_dots foo/sym $is_uptodate" >"$chkfile.extra"
42 # Check if rsync can preserve time on symlinks
48 if $RSYNC --version |
grep "[, ] symtimes" >/dev
/null
; then
56 checkdiff
"$RSYNC -iplr '$fromdir/' '$todir/'" <<EOT
57 created directory $todir
61 >f$all_plus bar/baz/rsync
63 >f$all_plus foo/config1
64 >f$all_plus foo/config2
66 cL$all_plus foo/sym -> ../bar/baz/rsync
69 # Ensure there are no accidental directory-time problems.
70 $RSYNC -a -f '-! */' "$fromdir/" "$todir"
72 cp_p
"$srcdir/configure.ac" "$fromdir/foo/config2"
73 chmod 601 "$fromdir/foo/config2"
74 checkdiff
"$RSYNC -iplrH '$fromdir/' '$todir/'" <<EOT
75 >f..T.$dots bar/baz/rsync
76 >f..T.$dots foo/config1
77 >f.sTp$dots foo/config2
78 hf..T.$dots foo/extra => foo/config1
81 $RSYNC -a -f '-! */' "$fromdir/" "$todir"
82 cp_p
"$srcdir/config.sub" "$fromdir/foo/config2"
83 sleep 1 # For directory mod below to ensure time difference
86 ln -s ..
/bar
/baz
"$todir/foo/sym"
88 chmod 600 "$fromdir/foo/config2"
89 chmod 777 "$todir/bar/baz/rsync"
91 checkdiff
"$RSYNC -iplrtc '$fromdir/' '$todir/'" <<EOT
92 .f..tp$dots bar/baz/rsync
94 .f..t.$dots foo/config1
95 >fcstp$dots foo/config2
96 cLc$T.$dots foo/sym -> ../bar/baz/rsync
99 cp_p
"$srcdir/configure.ac" "$fromdir/foo/config2"
100 chmod 600 "$fromdir/foo/config2"
101 # Lack of -t is for unchanged hard-link stress-test!
102 checkdiff
"$RSYNC -vvplrH '$fromdir/' '$todir/'" \
104 bar/baz/rsync is uptodate
105 foo/config1 is uptodate
106 foo/extra is uptodate
111 chmod 747 "$todir/bar/baz/rsync"
112 $RSYNC -a -f '-! */' "$fromdir/" "$todir"
113 checkdiff
"$RSYNC -ivvplrtH '$fromdir/' '$todir/'" \
118 .f...p$dots bar/baz/rsync
120 .f$allspace foo/config1
121 >f..t.$dots foo/config2
122 hf$allspace foo/extra
123 .L$allspace foo/sym -> ../bar/baz/rsync
126 chmod 757 "$todir/foo/config1"
127 touch "$todir/foo/config2"
128 checkdiff
"$RSYNC -vplrtH '$fromdir/' '$todir/'" \
133 chmod 757 "$todir/foo/config1"
134 touch "$todir/foo/config2"
135 checkdiff
"$RSYNC -iplrtH '$fromdir/' '$todir/'" <<EOT
136 .f...p$dots foo/config1
137 >f..t.$dots foo/config2
140 checkdiff
"$RSYNC -ivvplrtH --copy-dest=../to '$fromdir/' '$to2dir/'" \
145 cf$allspace bar/baz/rsync
147 cf$allspace foo/config1
148 cf$allspace foo/config2
149 hf$allspace foo/extra => foo/config1
150 cL$sym_dots foo/sym -> ../bar/baz/rsync
154 cat - "$chkfile.extra" <<EOT >"$chkfile"
155 created directory $to2dir
156 hf$allspace foo/extra => foo/config1
158 checkdiff2
"$RSYNC -iplrtH --copy-dest=../to '$fromdir/' '$to2dir/'"
161 checkdiff
"$RSYNC -vvplrtH --copy-dest='$todir' '$fromdir/' '$to2dir/'" \
166 bar/baz/rsync is uptodate
168 foo/config1 is uptodate
169 foo/config2 is uptodate
171 foo/extra => foo/config1
175 checkdiff
"$RSYNC -ivvplrtH --link-dest='$todir' '$fromdir/' '$to2dir/'" \
180 hf$allspace bar/baz/rsync
182 hf$allspace foo/config1
183 hf$allspace foo/config2
184 hf$allspace foo/extra => foo/config1
185 $L$sym_dots foo/sym -> ../bar/baz/rsync
189 cat - "$chkfile.extra" <<EOT >"$chkfile"
190 created directory $to2dir
192 checkdiff2
"$RSYNC -iplrtH --dry-run --link-dest=../to '$fromdir/' '$to2dir/'"
195 checkdiff2
"$RSYNC -iplrtH --link-dest=../to '$fromdir/' '$to2dir/'"
198 checkdiff
"$RSYNC -vvplrtH --link-dest='$todir' '$fromdir/' '$to2dir/'" \
203 bar/baz/rsync is uptodate
205 foo/config1 is uptodate
206 foo/config2 is uptodate
207 foo/extra is uptodate
212 checkdiff
"$RSYNC -ivvplrtH --compare-dest='$todir' '$fromdir/' '$to2dir/'" \
217 .f$allspace bar/baz/rsync
219 .f$allspace foo/config1
220 .f$allspace foo/config2
221 .f$allspace foo/extra
222 $L_sym_dots foo/sym -> ../bar/baz/rsync
226 cat - "$chkfile.extra" <<EOT >"$chkfile"
227 created directory $to2dir
229 checkdiff2
"$RSYNC -iplrtH --compare-dest='$todir' '$fromdir/' '$to2dir/'"
232 checkdiff
"$RSYNC -vvplrtH --compare-dest='$todir' '$fromdir/' '$to2dir/'" \
237 bar/baz/rsync is uptodate
239 foo/config1 is uptodate
240 foo/config2 is uptodate
241 foo/extra is uptodate
245 # The script would have aborted on error, so getting here means we've won.