Fix compile w/o openssl; disable sha256 & sha512 for --checksum.
[rsync.git] / testsuite / itemize.test
blob7c29f696c129331a6ca02c1ab3b724ea9618461e
1 #!/bin/sh
3 # Copyright (C) 2005-2022 Wayne Davison
5 # This program is distributable under the terms of the GNU GPL (see
6 # COPYING).
8 # Test the output of various copy commands to ensure itemized output
9 # and double-verbose output is correct.
11 . "$suitedir/rsync.fns"
13 to2dir="$tmpdir/to2"
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"
21 umask 0
22 ln -s ../bar/baz/rsync "$fromdir/foo/sym"
23 umask 022
24 ln "$fromdir/foo/config1" "$fromdir/foo/extra"
25 rm -f "$to2dir"
27 # Check if rsync is set to hard-link symlinks.
28 if $RSYNC --version | grep "[, ] hardlink-symlinks" >/dev/null; then
29 L=hL
30 sym_dots="$allspace"
31 L_sym_dots=".L$allspace"
32 is_uptodate='is uptodate'
33 touch "$chkfile.extra"
34 else
35 L=cL
36 sym_dots="c.t.$dots"
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
43 case "$RSYNC" in
44 *protocol=2*)
45 T=.T
48 if $RSYNC --version | grep "[, ] symtimes" >/dev/null; then
49 T=.t
50 else
51 T=.T
54 esac
56 checkdiff "$RSYNC -iplr '$fromdir/' '$todir/'" <<EOT
57 created directory $todir
58 cd$all_plus ./
59 cd$all_plus bar/
60 cd$all_plus bar/baz/
61 >f$all_plus bar/baz/rsync
62 cd$all_plus foo/
63 >f$all_plus foo/config1
64 >f$all_plus foo/config2
65 >f$all_plus foo/extra
66 cL$all_plus foo/sym -> ../bar/baz/rsync
67 EOT
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
79 EOT
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
84 rm "$todir/foo/sym"
85 umask 0
86 ln -s ../bar/baz "$todir/foo/sym"
87 umask 022
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
93 .d..t.$dots foo/
94 .f..t.$dots foo/config1
95 >fcstp$dots foo/config2
96 cLc$T.$dots foo/sym -> ../bar/baz/rsync
97 EOT
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/'" \
103 v_filt <<EOT
104 bar/baz/rsync is uptodate
105 foo/config1 is uptodate
106 foo/extra is uptodate
107 foo/sym is uptodate
108 foo/config2
111 chmod 747 "$todir/bar/baz/rsync"
112 $RSYNC -a -f '-! */' "$fromdir/" "$todir"
113 checkdiff "$RSYNC -ivvplrtH '$fromdir/' '$todir/'" \
114 v_filt <<EOT
115 .d$allspace ./
116 .d$allspace bar/
117 .d$allspace bar/baz/
118 .f...p$dots bar/baz/rsync
119 .d$allspace foo/
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/'" \
129 v_filt <<EOT
130 foo/config2
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/'" \
141 v_filt <<EOT
142 cd$allspace ./
143 cd$allspace bar/
144 cd$allspace bar/baz/
145 cf$allspace bar/baz/rsync
146 cd$allspace foo/
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
153 rm -rf "$to2dir"
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/'"
160 rm -rf "$to2dir"
161 checkdiff "$RSYNC -vvplrtH --copy-dest='$todir' '$fromdir/' '$to2dir/'" \
162 v_filt <<EOT
163 ./ is uptodate
164 bar/ is uptodate
165 bar/baz/ is uptodate
166 bar/baz/rsync is uptodate
167 foo/ is uptodate
168 foo/config1 is uptodate
169 foo/config2 is uptodate
170 foo/sym $is_uptodate
171 foo/extra => foo/config1
174 rm -rf "$to2dir"
175 checkdiff "$RSYNC -ivvplrtH --link-dest='$todir' '$fromdir/' '$to2dir/'" \
176 v_filt <<EOT
177 cd$allspace ./
178 cd$allspace bar/
179 cd$allspace bar/baz/
180 hf$allspace bar/baz/rsync
181 cd$allspace foo/
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
188 rm -rf "$to2dir"
189 cat - "$chkfile.extra" <<EOT >"$chkfile"
190 created directory $to2dir
192 checkdiff2 "$RSYNC -iplrtH --dry-run --link-dest=../to '$fromdir/' '$to2dir/'"
194 rm -rf "$to2dir"
195 checkdiff2 "$RSYNC -iplrtH --link-dest=../to '$fromdir/' '$to2dir/'"
197 rm -rf "$to2dir"
198 checkdiff "$RSYNC -vvplrtH --link-dest='$todir' '$fromdir/' '$to2dir/'" \
199 v_filt <<EOT
200 ./ is uptodate
201 bar/ is uptodate
202 bar/baz/ is uptodate
203 bar/baz/rsync is uptodate
204 foo/ is uptodate
205 foo/config1 is uptodate
206 foo/config2 is uptodate
207 foo/extra is uptodate
208 foo/sym $is_uptodate
211 rm -rf "$to2dir"
212 checkdiff "$RSYNC -ivvplrtH --compare-dest='$todir' '$fromdir/' '$to2dir/'" \
213 v_filt <<EOT
214 cd$allspace ./
215 cd$allspace bar/
216 cd$allspace bar/baz/
217 .f$allspace bar/baz/rsync
218 cd$allspace foo/
219 .f$allspace foo/config1
220 .f$allspace foo/config2
221 .f$allspace foo/extra
222 $L_sym_dots foo/sym -> ../bar/baz/rsync
225 rm -rf "$to2dir"
226 cat - "$chkfile.extra" <<EOT >"$chkfile"
227 created directory $to2dir
229 checkdiff2 "$RSYNC -iplrtH --compare-dest='$todir' '$fromdir/' '$to2dir/'"
231 rm -rf "$to2dir"
232 checkdiff "$RSYNC -vvplrtH --compare-dest='$todir' '$fromdir/' '$to2dir/'" \
233 v_filt <<EOT
234 ./ is uptodate
235 bar/ is uptodate
236 bar/baz/ is uptodate
237 bar/baz/rsync is uptodate
238 foo/ is uptodate
239 foo/config1 is uptodate
240 foo/config2 is uptodate
241 foo/extra is uptodate
242 foo/sym $is_uptodate
245 # The script would have aborted on error, so getting here means we've won.
246 exit 0