Debian Codegraph @

runtests.sh

raw symbols SCIP
1 #!/bin/bashscip-shell filesystem . . `/bin/bash`.
2
3 #
4 # Copyright 2012-2018 BloomReach, Inc.
5 #
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
9 #
10 # http://www.apache.org/licenses/LICENSE-2.0
11 #
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
17 #
18
19 #
20 # Tests for s4cmd command line tool
21 #
22
23 # Python settings, can be python 2 or 3
24 PYTHON=${PYTHON:-python}
25 PYTHONPATH=${PYTHONPATH:-$(pwdscip-shell system . . pwd.)}
26 BUILD_ID=${BUILD_ID:-0}
27 LOCALDIR=./test-tmp
28 REMOTEDIR=${REMOTEDIR:-"s3://bucket/path"}
29 REMOTEDIR="${REMOTEDIR}/${BUILD_ID}/$(${PYTHON} --version 2>&1 | cutscip-shell system . . cut. -d' ' -f 2)"
30 S4CMD="${PYTHON} $(pwdscip-shell system . . pwd.)/s4cmd.py"
31 S4CMD_OPTS=${S4CMD_OPTS:-"--debug"}
32 FILESIZE=1M
33 TEST_FAILED=false
34
35 function initializescip-shell shell shell-project 0.0.0 initialize(). {
36 # Create testing data locally
37 rmscip-shell system . . rm. -rf $LOCALDIR
38 mkdirscip-shell system . . mkdir. $LOCALDIR
39 pushd $LOCALDIR
40
41 mkdirscip-shell system . . mkdir. source
42 pushd source
43 ddscip-shell system . . dd. if=/dev/urandomscip-shell filesystem . . `/dev/urandom`. of=001 bs=$FILESIZE count=2
44 ddscip-shell system . . dd. if=/dev/urandomscip-shell filesystem . . `/dev/urandom`. of=010 bs=$FILESIZE count=2
45 ddscip-shell system . . dd. if=/dev/urandomscip-shell filesystem . . `/dev/urandom`. of=101 bs=$FILESIZE count=2
46 touchscip-shell system . . touch. 011
47 chmodscip-shell system . . chmod. 700 001
48 chmodscip-shell system . . chmod. 770 010
49 chmodscip-shell system . . chmod. 707 101
50 mkdirscip-shell system . . mkdir. a
51 pushd a
52 mkdirscip-shell system . . mkdir. a
53 pushd a
54 ddscip-shell system . . dd. if=/dev/urandomscip-shell filesystem . . `/dev/urandom`. of=a-001 bs=$FILESIZE count=2
55 ddscip-shell system . . dd. if=/dev/urandomscip-shell filesystem . . `/dev/urandom`. of=a-010 bs=$FILESIZE count=2
56 ddscip-shell system . . dd. if=/dev/urandomscip-shell filesystem . . `/dev/urandom`. of=a-101 bs=$FILESIZE count=2
57 popd
58 mkdirscip-shell system . . mkdir. a1
59 pushd a1
60 ddscip-shell system . . dd. if=/dev/urandomscip-shell filesystem . . `/dev/urandom`. of=a1-001 bs=$FILESIZE count=2
61 ddscip-shell system . . dd. if=/dev/urandomscip-shell filesystem . . `/dev/urandom`. of=a1-010 bs=$FILESIZE count=2
62 ddscip-shell system . . dd. if=/dev/urandomscip-shell filesystem . . `/dev/urandom`. of=a1-101 bs=$FILESIZE count=2
63 popd
64 mkdirscip-shell system . . mkdir. a2
65 pushd a2
66 ddscip-shell system . . dd. if=/dev/urandomscip-shell filesystem . . `/dev/urandom`. of=a2-001 bs=$FILESIZE count=2
67 ddscip-shell system . . dd. if=/dev/urandomscip-shell filesystem . . `/dev/urandom`. of=a2-010 bs=$FILESIZE count=2
68 ddscip-shell system . . dd. if=/dev/urandomscip-shell filesystem . . `/dev/urandom`. of=a2-101 bs=$FILESIZE count=2
69 popd
70 mkdirscip-shell system . . mkdir. a3
71 pushd a3
72 ddscip-shell system . . dd. if=/dev/urandomscip-shell filesystem . . `/dev/urandom`. of=a3-001 bs=$FILESIZE count=2
73 ddscip-shell system . . dd. if=/dev/urandomscip-shell filesystem . . `/dev/urandom`. of=a3-010 bs=$FILESIZE count=2
74 ddscip-shell system . . dd. if=/dev/urandomscip-shell filesystem . . `/dev/urandom`. of=a3-101 bs=$FILESIZE count=2
75 popd
76 popd
77
78 mkdirscip-shell system . . mkdir. b
79 pushd b
80 mkdirscip-shell system . . mkdir. b
81 pushd b
82 ddscip-shell system . . dd. if=/dev/urandomscip-shell filesystem . . `/dev/urandom`. of=b-001 bs=$FILESIZE count=2
83 ddscip-shell system . . dd. if=/dev/urandomscip-shell filesystem . . `/dev/urandom`. of=b-010 bs=$FILESIZE count=2
84 ddscip-shell system . . dd. if=/dev/urandomscip-shell filesystem . . `/dev/urandom`. of=b-101 bs=$FILESIZE count=2
85 popd
86 mkdirscip-shell system . . mkdir. b1
87 pushd b1
88 ddscip-shell system . . dd. if=/dev/urandomscip-shell filesystem . . `/dev/urandom`. of=b1-001 bs=$FILESIZE count=2
89 ddscip-shell system . . dd. if=/dev/urandomscip-shell filesystem . . `/dev/urandom`. of=b1-010 bs=$FILESIZE count=2
90 ddscip-shell system . . dd. if=/dev/urandomscip-shell filesystem . . `/dev/urandom`. of=b1-101 bs=$FILESIZE count=2
91 popd
92 mkdirscip-shell system . . mkdir. b2
93 pushd b2
94 ddscip-shell system . . dd. if=/dev/urandomscip-shell filesystem . . `/dev/urandom`. of=b2-001 bs=$FILESIZE count=2
95 ddscip-shell system . . dd. if=/dev/urandomscip-shell filesystem . . `/dev/urandom`. of=b2-010 bs=$FILESIZE count=2
96 ddscip-shell system . . dd. if=/dev/urandomscip-shell filesystem . . `/dev/urandom`. of=b2-101 bs=$FILESIZE count=2
97 popd
98 mkdirscip-shell system . . mkdir. b3
99 pushd b3
100 ddscip-shell system . . dd. if=/dev/urandomscip-shell filesystem . . `/dev/urandom`. of=b3-001 bs=$FILESIZE count=2
101 ddscip-shell system . . dd. if=/dev/urandomscip-shell filesystem . . `/dev/urandom`. of=b3-010 bs=$FILESIZE count=2
102 ddscip-shell system . . dd. if=/dev/urandomscip-shell filesystem . . `/dev/urandom`. of=b3-101 bs=$FILESIZE count=2
103 popd
104 popd
105
106 mkdirscip-shell system . . mkdir. c
107 pushd c
108 mkdirscip-shell system . . mkdir. c
109 pushd c
110 ddscip-shell system . . dd. if=/dev/urandomscip-shell filesystem . . `/dev/urandom`. of=c-001 bs=$FILESIZE count=2
111 ddscip-shell system . . dd. if=/dev/urandomscip-shell filesystem . . `/dev/urandom`. of=c-010 bs=$FILESIZE count=2
112 ddscip-shell system . . dd. if=/dev/urandomscip-shell filesystem . . `/dev/urandom`. of=c-101 bs=$FILESIZE count=2
113 popd
114 mkdirscip-shell system . . mkdir. c1
115 pushd c1
116 ddscip-shell system . . dd. if=/dev/urandomscip-shell filesystem . . `/dev/urandom`. of=c1-001 bs=$FILESIZE count=2
117 ddscip-shell system . . dd. if=/dev/urandomscip-shell filesystem . . `/dev/urandom`. of=c1-010 bs=$FILESIZE count=2
118 ddscip-shell system . . dd. if=/dev/urandomscip-shell filesystem . . `/dev/urandom`. of=c1-101 bs=$FILESIZE count=2
119 popd
120 mkdirscip-shell system . . mkdir. c2
121 pushd c2
122 ddscip-shell system . . dd. if=/dev/urandomscip-shell filesystem . . `/dev/urandom`. of=c2-001 bs=$FILESIZE count=2
123 ddscip-shell system . . dd. if=/dev/urandomscip-shell filesystem . . `/dev/urandom`. of=c2-010 bs=$FILESIZE count=2
124 ddscip-shell system . . dd. if=/dev/urandomscip-shell filesystem . . `/dev/urandom`. of=c2-101 bs=$FILESIZE count=2
125 popd
126 mkdirscip-shell system . . mkdir. c3
127 pushd c3
128 ddscip-shell system . . dd. if=/dev/urandomscip-shell filesystem . . `/dev/urandom`. of=c3-001 bs=$FILESIZE count=2
129 ddscip-shell system . . dd. if=/dev/urandomscip-shell filesystem . . `/dev/urandom`. of=c3-010 bs=$FILESIZE count=2
130 ddscip-shell system . . dd. if=/dev/urandomscip-shell filesystem . . `/dev/urandom`. of=c3-101 bs=$FILESIZE count=2
131 popd
132 popd
133
134 popd
135
136 # Clear target testing directory
137 $S4CMD del ${S4CMD_OPTS} -r $REMOTEDIR/
138
139 echoscip-shell system . . echo. 'Start test cases'
140
141 tree source | tailscip-shell system . . tail. -n +2 > source.tree
142
143 popd # from local-tmp
144 }
145
146 function case1-1scip-shell shell shell-project 0.0.0 case1-1(). {
147 #####################################################################
148 CASE_ID=${FUNCNAME[0]}
149 echoscip-shell system . . echo. "Test $CASE_ID: single file upload/download"
150 #####################################################################
151 mkdirscip-shell system . . mkdir. $CASE_ID
152 $S4CMD put ${S4CMD_OPTS} source/001 $REMOTEDIR/$CASE_ID/001 >> $CASE_ID.log 2>&1
153 $S4CMD get ${S4CMD_OPTS} $REMOTEDIR/$CASE_ID/001 $CASE_ID/001 >> $CASE_ID.log 2>&1
154
155 md5sumscip-shell system . . md5sum. source/001 | cutscip-shell system . . cut. -f1 -d' ' >> $CASE_ID.md5
156 md5sumscip-shell system . . md5sum. $CASE_ID/001 | cutscip-shell system . . cut. -f1 -d' ' >> $CASE_ID.chk
157 result=$(diffscip-shell system . . diff. $CASE_ID.md5 $CASE_ID.chk)
158 if [[ -z "$result" ]]; then
159 echoscip-shell system . . echo. " - OK"
160 else
161 echoscip-shell system . . echo. " - Failed"
162 TEST_FAILED=true
163 fi
164 }
165
166 function case1-2scip-shell shell shell-project 0.0.0 case1-2(). {
167 #####################################################################
168 CASE_ID=${FUNCNAME[0]}
169 echoscip-shell system . . echo. "Test $CASE_ID: single file upload/download (Trailing slash)"
170 #####################################################################
171 mkdirscip-shell system . . mkdir. $CASE_ID
172 $S4CMD put ${S4CMD_OPTS} source/001 $REMOTEDIR/$CASE_ID/001-1/ >> $CASE_ID.log 2>&1
173 $S4CMD get ${S4CMD_OPTS} $REMOTEDIR/$CASE_ID/001-1/001 $CASE_ID/001-1 >> $CASE_ID.log 2>&1
174
175 md5sumscip-shell system . . md5sum. source/001 | cutscip-shell system . . cut. -f1 -d' ' >> $CASE_ID.md5
176 md5sumscip-shell system . . md5sum. $CASE_ID/001-1 | cutscip-shell system . . cut. -f1 -d' ' >> $CASE_ID.chk
177 result=$(diffscip-shell system . . diff. $CASE_ID.md5 $CASE_ID.chk)
178 if [[ -z "$result" ]]; then
179 echoscip-shell system . . echo. " - OK"
180 else
181 echoscip-shell system . . echo. " - Failed"
182 TEST_FAILED=true
183 fi
184 }
185
186 function case1-3scip-shell shell shell-project 0.0.0 case1-3(). {
187 #####################################################################
188 CASE_ID=${FUNCNAME[0]}
189 echoscip-shell system . . echo. "Test $CASE_ID: Empty file upload/download"
190 #####################################################################
191 mkdirscip-shell system . . mkdir. $CASE_ID
192 $S4CMD put ${S4CMD_OPTS} source/011 $REMOTEDIR/$CASE_ID/011 >> $CASE_ID.log 2>&1
193 $S4CMD get ${S4CMD_OPTS} $REMOTEDIR/$CASE_ID/011 $CASE_ID/011 >> $CASE_ID.log 2>&1
194
195 md5sumscip-shell system . . md5sum. source/011 | cutscip-shell system . . cut. -f1 -d' ' >> $CASE_ID.md5
196 md5sumscip-shell system . . md5sum. $CASE_ID/011 | cutscip-shell system . . cut. -f1 -d' ' >> $CASE_ID.chk
197 result=$(diffscip-shell system . . diff. $CASE_ID.md5 $CASE_ID.chk)
198 if [[ -z "$result" ]]; then
199 echoscip-shell system . . echo. " - OK"
200 else
201 echoscip-shell system . . echo. " - Failed"
202 TEST_FAILED=true
203 fi
204 }
205
206 function case2-1scip-shell shell shell-project 0.0.0 case2-1(). {
207 #####################################################################
208 CASE_ID=${FUNCNAME[0]}
209 echoscip-shell system . . echo. "Test $CASE_ID: wildcards upload"
210 #####################################################################
211 mkdirscip-shell system . . mkdir. $CASE_ID
212 $S4CMD put ${S4CMD_OPTS} source/*/?2/*-??1 $REMOTEDIR/$CASE_ID/ >> $CASE_ID.log 2>&1
213 $S4CMD get ${S4CMD_OPTS} $REMOTEDIR/$CASE_ID/* $CASE_ID/ >> $CASE_ID.log 2>&1
214
215 md5sumscip-shell system . . md5sum. source/*/?2/*-??1 | cutscip-shell system . . cut. -f1 -d' ' >> $CASE_ID.md5
216 md5sumscip-shell system . . md5sum. $CASE_ID/* | cutscip-shell system . . cut. -f1 -d' ' >> $CASE_ID.chk
217 result=$(diffscip-shell system . . diff. $CASE_ID.md5 $CASE_ID.chk)
218 if [[ -z "$result" ]]; then
219 echoscip-shell system . . echo. " - OK"
220 else
221 echoscip-shell system . . echo. " - Failed"
222 TEST_FAILED=true
223 fi
224 }
225
226 function case2-2scip-shell shell shell-project 0.0.0 case2-2(). {
227 #####################################################################
228 CASE_ID=${FUNCNAME[0]}
229 echoscip-shell system . . echo. "Test $CASE_ID: wildcards upload (trailing slash)"
230 #####################################################################
231 mkdirscip-shell system . . mkdir. $CASE_ID
232 $S4CMD put ${S4CMD_OPTS} source/*/?2/b?-1?1 $REMOTEDIR/$CASE_ID/a >> $CASE_ID.log 2>&1
233 $S4CMD get ${S4CMD_OPTS} $REMOTEDIR/$CASE_ID/a $CASE_ID/ >> $CASE_ID.log 2>&1
234
235 md5sumscip-shell system . . md5sum. source/*/?2/b?-1?1 | cutscip-shell system . . cut. -f1 -d' ' >> $CASE_ID.md5
236 md5sumscip-shell system . . md5sum. $CASE_ID/* | cutscip-shell system . . cut. -f1 -d' ' >> $CASE_ID.chk
237 result=$(diffscip-shell system . . diff. $CASE_ID.md5 $CASE_ID.chk)
238 if [[ -z "$result" ]]; then
239 echoscip-shell system . . echo. " - OK"
240 else
241 echoscip-shell system . . echo. " - Failed"
242 TEST_FAILED=true
243 fi
244 }
245
246 function case3-1scip-shell shell shell-project 0.0.0 case3-1(). {
247 #####################################################################
248 CASE_ID=${FUNCNAME[0]}
249 echoscip-shell system . . echo. "Test $CASE_ID: list files"
250 #####################################################################
251 $S4CMD put ${S4CMD_OPTS} source/*/?2/*-??1 $REMOTEDIR/$CASE_ID/ >> $CASE_ID.log 2>&1
252 $S4CMD ls ${S4CMD_OPTS} $REMOTEDIR/$CASE_ID/ >> $CASE_ID.out 2> $CASE_ID.err
253
254 n1=$(lsscip-shell system . . ls. source/*/?2/*-??1 | wcscip-shell system . . wc. -l)
255 n2=$(catscip-shell system . . cat. $CASE_ID.out | wcscip-shell system . . wc. -l)
256 if [[ "$n1" -eq "$n2" ]]; then
257 echoscip-shell system . . echo. " - OK"
258 else
259 echoscip-shell system . . echo. " - Failed"
260 TEST_FAILED=true
261 fi
262 }
263
264 function case3-2scip-shell shell shell-project 0.0.0 case3-2(). {
265 #####################################################################
266 CASE_ID=${FUNCNAME[0]}
267 echoscip-shell system . . echo. "Test $CASE_ID: list files (show directory)"
268 #####################################################################
269 $S4CMD put ${S4CMD_OPTS} source/*/?2/*-??1 $REMOTEDIR/$CASE_ID/ >> $CASE_ID.log 2>&1
270 $S4CMD ls ${S4CMD_OPTS} -d $REMOTEDIR/$CASE_ID >> $CASE_ID.out 2> $CASE_ID.err
271
272 n1=$(catscip-shell system . . cat. $CASE_ID.out | wcscip-shell system . . wc. -l)
273 if [[ "$n1" -eq "1" ]]; then
274 echoscip-shell system . . echo. " - OK"
275 else
276 echoscip-shell system . . echo. " - Failed"
277 TEST_FAILED=true
278 fi
279 }
280
281 function case4-1scip-shell shell shell-project 0.0.0 case4-1(). {
282 #####################################################################
283 CASE_ID=${FUNCNAME[0]}
284 echoscip-shell system . . echo. "Test $CASE_ID: single directory (upload and download)"
285 #####################################################################
286 $S4CMD put ${S4CMD_OPTS} -r source/a/a1/ $REMOTEDIR/$CASE_ID >> $CASE_ID.log 2>&1
287 $S4CMD get ${S4CMD_OPTS} -r $REMOTEDIR/$CASE_ID/ $CASE_ID >> $CASE_ID.log 2>&1
288
289 md5sumscip-shell system . . md5sum. source/a/a1/* | cutscip-shell system . . cut. -f1 -d' ' >> $CASE_ID.md5
290 md5sumscip-shell system . . md5sum. $CASE_ID/* | cutscip-shell system . . cut. -f1 -d' ' >> $CASE_ID.chk
291 result=$(diffscip-shell system . . diff. $CASE_ID.md5 $CASE_ID.chk)
292 if [[ -z "$result" ]]; then
293 echoscip-shell system . . echo. " - OK"
294 else
295 echoscip-shell system . . echo. " - Failed"
296 TEST_FAILED=true
297 fi
298 }
299
300 function case4-2scip-shell shell shell-project 0.0.0 case4-2(). {
301 #####################################################################
302 CASE_ID=${FUNCNAME[0]}
303 echoscip-shell system . . echo. "Test $CASE_ID: single directory (Trailing slash)"
304 #####################################################################
305 $S4CMD put ${S4CMD_OPTS} -r source/a/a1/ $REMOTEDIR/$CASE_ID/ >> $CASE_ID.log 2>&1
306 $S4CMD get ${S4CMD_OPTS} -r $REMOTEDIR/$CASE_ID/a1/ $CASE_ID >> $CASE_ID.log 2>&1
307
308 md5sumscip-shell system . . md5sum. source/a/a1/* | cutscip-shell system . . cut. -f1 -d' ' >> $CASE_ID.md5
309 md5sumscip-shell system . . md5sum. $CASE_ID/* | cutscip-shell system . . cut. -f1 -d' ' >> $CASE_ID.chk
310 result=$(diffscip-shell system . . diff. $CASE_ID.md5 $CASE_ID.chk)
311 if [[ -z "$result" ]]; then
312 echoscip-shell system . . echo. " - OK"
313 else
314 echoscip-shell system . . echo. " - Failed"
315 TEST_FAILED=true
316 fi
317 }
318
319 function case4-3scip-shell shell shell-project 0.0.0 case4-3(). {
320 #####################################################################
321 CASE_ID=${FUNCNAME[0]}
322 echoscip-shell system . . echo. "Test $CASE_ID: single directory (Wildcards)"
323 #####################################################################
324 mkdirscip-shell system . . mkdir. $CASE_ID
325 $S4CMD put ${S4CMD_OPTS} -r source/a/a?/ $REMOTEDIR/$CASE_ID/ >> $CASE_ID.log 2>&1
326 $S4CMD get ${S4CMD_OPTS} -r $REMOTEDIR/$CASE_ID/a?/ $CASE_ID >> $CASE_ID.log 2>&1
327
328 md5sumscip-shell system . . md5sum. source/a/a?/* | cutscip-shell system . . cut. -f1 -d' ' >> $CASE_ID.md5
329 md5sumscip-shell system . . md5sum. $CASE_ID/*/* | cutscip-shell system . . cut. -f1 -d' ' >> $CASE_ID.chk
330 result=$(diffscip-shell system . . diff. $CASE_ID.md5 $CASE_ID.chk)
331 if [[ -z "$result" ]]; then
332 echoscip-shell system . . echo. " - OK"
333 else
334 echoscip-shell system . . echo. " - Failed"
335 TEST_FAILED=true
336 fi
337 }
338
339 function case4-4scip-shell shell shell-project 0.0.0 case4-4(). {
340 #####################################################################
341 CASE_ID=${FUNCNAME[0]}
342 echoscip-shell system . . echo. "Test $CASE_ID: single directory (prefix)"
343 #####################################################################
344 mkdirscip-shell system . . mkdir. $CASE_ID
345 $S4CMD put ${S4CMD_OPTS} -r source/a/a $REMOTEDIR/$CASE_ID/ >> $CASE_ID.log 2>&1
346 $S4CMD get ${S4CMD_OPTS} -r $REMOTEDIR/$CASE_ID/a $CASE_ID >> $CASE_ID.log 2>&1
347
348 md5sumscip-shell system . . md5sum. source/a/a/* | cutscip-shell system . . cut. -f1 -d' ' >> $CASE_ID.md5
349 md5sumscip-shell system . . md5sum. $CASE_ID/*/* | cutscip-shell system . . cut. -f1 -d' ' >> $CASE_ID.chk
350 result=$(diffscip-shell system . . diff. $CASE_ID.md5 $CASE_ID.chk)
351 if [[ -z "$result" ]]; then
352 echoscip-shell system . . echo. " - OK"
353 else
354 echoscip-shell system . . echo. " - Failed"
355 TEST_FAILED=true
356 fi
357 }
358
359 function case5-1scip-shell shell shell-project 0.0.0 case5-1(). {
360 #####################################################################
361 CASE_ID=${FUNCNAME[0]}
362 echoscip-shell system . . echo. "Test $CASE_ID: trailing slash"
363 #####################################################################
364 $S4CMD put ${S4CMD_OPTS} -r source/a/a1 $REMOTEDIR/$CASE_ID >> $CASE_ID.log 2>&1
365 $S4CMD get ${S4CMD_OPTS} -r $REMOTEDIR/$CASE_ID $CASE_ID >> $CASE_ID.log 2>&1
366
367 md5sumscip-shell system . . md5sum. source/a/a1/* | cutscip-shell system . . cut. -f1 -d' ' >> $CASE_ID.md5
368 md5sumscip-shell system . . md5sum. $CASE_ID/* | cutscip-shell system . . cut. -f1 -d' ' >> $CASE_ID.chk
369 result=$(diffscip-shell system . . diff. $CASE_ID.md5 $CASE_ID.chk)
370 if [[ -z "$result" ]]; then
371 echoscip-shell system . . echo. " - OK"
372 else
373 echoscip-shell system . . echo. " - Failed"
374 TEST_FAILED=true
375 fi
376 }
377
378 function case5-2scip-shell shell shell-project 0.0.0 case5-2(). {
379 #####################################################################
380 CASE_ID=${FUNCNAME[0]}
381 echoscip-shell system . . echo. "Test $CASE_ID: trailing slash (normalization)"
382 #####################################################################
383 $S4CMD put ${S4CMD_OPTS} -r source/a/a1/ $REMOTEDIR/$CASE_ID >> $CASE_ID.log 2>&1
384 $S4CMD get ${S4CMD_OPTS} -r $REMOTEDIR/$CASE_ID $CASE_ID/ >> $CASE_ID.log 2>&1
385
386 md5sumscip-shell system . . md5sum. source/a/a1/* | cutscip-shell system . . cut. -f1 -d' ' >> $CASE_ID.md5
387 md5sumscip-shell system . . md5sum. $CASE_ID/* | cutscip-shell system . . cut. -f1 -d' ' >> $CASE_ID.chk
388 result=$(diffscip-shell system . . diff. $CASE_ID.md5 $CASE_ID.chk)
389 if [[ -z "$result" ]]; then
390 echoscip-shell system . . echo. " - OK"
391 else
392 echoscip-shell system . . echo. " - Failed"
393 TEST_FAILED=true
394 fi
395 }
396
397 function case6-1scip-shell shell shell-project 0.0.0 case6-1(). {
398 #####################################################################
399 CASE_ID=${FUNCNAME[0]}
400 echoscip-shell system . . echo. "Test $CASE_ID: syncing up and down"
401 #####################################################################
402 $S4CMD sync ${S4CMD_OPTS} source $REMOTEDIR/$CASE_ID/ >> $CASE_ID.log 2>&1
403 $S4CMD sync ${S4CMD_OPTS} $REMOTEDIR/$CASE_ID/ $CASE_ID/ >> $CASE_ID.log 2>&1
404 tree $CASE_ID/source | tailscip-shell system . . tail. -n +2 >> $CASE_ID.tree
405
406 result=$(diffscip-shell system . . diff. source.tree $CASE_ID.tree)
407 if [[ -z "$result" ]]; then
408 echoscip-shell system . . echo. " - OK"
409 else
410 echoscip-shell system . . echo. " - Failed"
411 TEST_FAILED=true
412 fi
413 }
414
415 function case6-2scip-shell shell shell-project 0.0.0 case6-2(). {
416 #####################################################################
417 CASE_ID=${FUNCNAME[0]}
418 echoscip-shell system . . echo. "Test $CASE_ID: syncing up and down (current directory)"
419 #####################################################################
420 cd source
421 $S4CMD sync ${S4CMD_OPTS} ./ $REMOTEDIR/$CASE_ID/source >> ../$CASE_ID.log 2>&1
422 cd ..
423 mkdirscip-shell system . . mkdir. $CASE_ID
424 cd $CASE_ID
425 $S4CMD sync ${S4CMD_OPTS} $REMOTEDIR/$CASE_ID/source ./ >> ../$CASE_ID.log 2>&1
426 cd ..
427 tree $CASE_ID/source | tailscip-shell system . . tail. -n +2 >> $CASE_ID.tree
428
429 result=$(diffscip-shell system . . diff. source.tree $CASE_ID.tree)
430 if [[ -z "$result" ]]; then
431 echoscip-shell system . . echo. " - OK"
432 else
433 echoscip-shell system . . echo. " - Failed"
434 TEST_FAILED=true
435 fi
436 }
437
438 function obsolete_case6-xscip-shell shell shell-project 0.0.0 obsolete_case6-x(). {
439 #####################################################################
440 CASE_ID=${FUNCNAME[0]}
441 echoscip-shell system . . echo. "Test $CASE_ID: syncing up and down (--delete-removed)"
442 #####################################################################
443 mkdirscip-shell system . . mkdir. $CASE_ID-1
444 mkdirscip-shell system . . mkdir. $CASE_ID-2
445 cpscip-shell system . . cp. -r source/a $CASE_ID-1/
446 $S4CMD sync ${S4CMD_OPTS} $CASE_ID-1/a $REMOTEDIR/$CASE_ID-1/ >> $CASE_ID.log 2>&1
447 $S4CMD sync ${S4CMD_OPTS} $REMOTEDIR/$CASE_ID-1/a $REMOTEDIR/$CASE_ID-2/ >> $CASE_ID.log 2>&1
448 $S4CMD sync ${S4CMD_OPTS} $REMOTEDIR/$CASE_ID-2/a $CASE_ID-2/ >> $CASE_ID.log 2>&1
449
450 rmscip-shell system . . rm. $CASE_ID-1/a/*/*-010
451
452 $S4CMD sync ${S4CMD_OPTS} --delete-removed $CASE_ID-1/a $REMOTEDIR/$CASE_ID-1/ >> $CASE_ID.log 2>&1
453 $S4CMD sync ${S4CMD_OPTS} --delete-removed $REMOTEDIR/$CASE_ID-1/a $REMOTEDIR/$CASE_ID-2/ >> $CASE_ID.log 2>&1
454 $S4CMD sync ${S4CMD_OPTS} --delete-removed $REMOTEDIR/$CASE_ID-2/a $CASE_ID-2/ >> $CASE_ID.log 2>&1
455
456 tree $CASE_ID-1/a | tailscip-shell system . . tail. -n +2 >> $CASE_ID.tree1
457 tree $CASE_ID-2/a | tailscip-shell system . . tail. -n +2 >> $CASE_ID.tree2
458
459 result=$(diffscip-shell system . . diff. $CASE_ID.tree1 $CASE_ID.tree2)
460 if [[ -z "$result" ]]; then
461 echoscip-shell system . . echo. " - OK"
462 else
463 echoscip-shell system . . echo. " - Failed"
464 TEST_FAILED=true
465 fi
466 }
467
468 function case6-3scip-shell shell shell-project 0.0.0 case6-3(). {
469 #####################################################################
470 CASE_ID=${FUNCNAME[0]}
471 echoscip-shell system . . echo. "Test $CASE_ID: dsyncing up and down"
472 #####################################################################
473 $S4CMD dsync ${S4CMD_OPTS} source $REMOTEDIR/$CASE_ID/source >> $CASE_ID.log 2>&1
474 $S4CMD dsync ${S4CMD_OPTS} $REMOTEDIR/$CASE_ID/ $CASE_ID/ >> $CASE_ID.log 2>&1
475 tree $CASE_ID/source | tailscip-shell system . . tail. -n +2 >> $CASE_ID.tree
476
477 result=$(diffscip-shell system . . diff. source.tree $CASE_ID.tree)
478 if [[ -z "$result" ]]; then
479 echoscip-shell system . . echo. " - OK"
480 else
481 echoscip-shell system . . echo. " - Failed"
482 TEST_FAILED=true
483 fi
484 }
485
486 function case6-4scip-shell shell shell-project 0.0.0 case6-4(). {
487 #####################################################################
488 CASE_ID=${FUNCNAME[0]}
489 echoscip-shell system . . echo. "Test $CASE_ID: dsyncing up and down (current directory)"
490 #####################################################################
491 cd source
492 $S4CMD dsync ${S4CMD_OPTS} ./ $REMOTEDIR/$CASE_ID/source >> ../$CASE_ID.log 2>&1
493 cd ..
494 mkdirscip-shell system . . mkdir. $CASE_ID
495 cd $CASE_ID
496 $S4CMD dsync ${S4CMD_OPTS} $REMOTEDIR/$CASE_ID/source ./ >> ../$CASE_ID.log 2>&1
497 cd ..
498 tree $CASE_ID/ | tailscip-shell system . . tail. -n +2 >> $CASE_ID.tree
499
500 result=$(diffscip-shell system . . diff. source.tree $CASE_ID.tree)
501 if [[ -z "$result" ]]; then
502 echoscip-shell system . . echo. " - OK"
503 else
504 echoscip-shell system . . echo. " - Failed"
505 TEST_FAILED=true
506 fi
507 }
508
509 function case6-5scip-shell shell shell-project 0.0.0 case6-5(). {
510 #####################################################################
511 CASE_ID=${FUNCNAME[0]}
512 echoscip-shell system . . echo. "Test $CASE_ID: dsyncing up and down (--delete-removed)"
513 #####################################################################
514 mkdirscip-shell system . . mkdir. $CASE_ID-1
515 mkdirscip-shell system . . mkdir. $CASE_ID-2
516 cpscip-shell system . . cp. -r source/a $CASE_ID-1/
517 $S4CMD dsync ${S4CMD_OPTS} $CASE_ID-1/a $REMOTEDIR/$CASE_ID-1/a >> $CASE_ID.log 2>&1
518 $S4CMD dsync ${S4CMD_OPTS} $REMOTEDIR/$CASE_ID-1/a $REMOTEDIR/$CASE_ID-2/a >> $CASE_ID.log 2>&1
519 $S4CMD dsync ${S4CMD_OPTS} $REMOTEDIR/$CASE_ID-2/a $CASE_ID-2/a >> $CASE_ID.log 2>&1
520
521 rmscip-shell system . . rm. $CASE_ID-1/a/*/*-010
522
523 $S4CMD dsync ${S4CMD_OPTS} --delete-removed $CASE_ID-1/a $REMOTEDIR/$CASE_ID-1/a >> $CASE_ID.log 2>&1
524 $S4CMD dsync ${S4CMD_OPTS} --delete-removed $REMOTEDIR/$CASE_ID-1/a $REMOTEDIR/$CASE_ID-2/a >> $CASE_ID.log 2>&1
525 $S4CMD dsync ${S4CMD_OPTS} --delete-removed $REMOTEDIR/$CASE_ID-2/a $CASE_ID-2/a >> $CASE_ID.log 2>&1
526
527 tree $CASE_ID-1/a | tailscip-shell system . . tail. -n +2 >> $CASE_ID.tree1
528 tree $CASE_ID-2/a | tailscip-shell system . . tail. -n +2 >> $CASE_ID.tree2
529
530 result=$(diffscip-shell system . . diff. $CASE_ID.tree1 $CASE_ID.tree2)
531 if [[ -z "$result" ]]; then
532 echoscip-shell system . . echo. " - OK"
533 else
534 echoscip-shell system . . echo. " - Failed"
535 TEST_FAILED=true
536 fi
537 }
538
539 function case7-1scip-shell shell shell-project 0.0.0 case7-1(). {
540 #####################################################################
541 CASE_ID=${FUNCNAME[0]}
542 echoscip-shell system . . echo. "Test $CASE_ID: wildcard download"
543 #####################################################################
544 mkdirscip-shell system . . mkdir. $CASE_ID
545 $S4CMD sync ${S4CMD_OPTS} source $REMOTEDIR/$CASE_ID/ >> $CASE_ID.log 2>&1
546 $S4CMD get ${S4CMD_OPTS} $REMOTEDIR/$CASE_ID/source/*/?2/*-??1 $CASE_ID/ >> $CASE_ID.log 2>&1
547
548 md5sumscip-shell system . . md5sum. source/*/?2/*-??1 | cutscip-shell system . . cut. -f1 -d' ' >> $CASE_ID.md5
549 md5sumscip-shell system . . md5sum. $CASE_ID/* | cutscip-shell system . . cut. -f1 -d' ' >> $CASE_ID.chk
550 result=$(diffscip-shell system . . diff. $CASE_ID.md5 $CASE_ID.chk)
551 if [[ -z "$result" ]]; then
552 echoscip-shell system . . echo. " - OK"
553 else
554 echoscip-shell system . . echo. " - Failed"
555 TEST_FAILED=true
556 fi
557 }
558
559 function case7-2scip-shell shell shell-project 0.0.0 case7-2(). {
560 #####################################################################
561 CASE_ID=${FUNCNAME[0]}
562 echoscip-shell system . . echo. "Test $CASE_ID: wildcard download (trailing slash)"
563 #####################################################################
564 mkdirscip-shell system . . mkdir. $CASE_ID
565 $S4CMD sync ${S4CMD_OPTS} source/ $REMOTEDIR/$CASE_ID/ >> $CASE_ID.log 2>&1
566 $S4CMD get ${S4CMD_OPTS} $REMOTEDIR/$CASE_ID/source/*/?2/*-??1 $CASE_ID >> $CASE_ID.log 2>&1
567
568 md5sumscip-shell system . . md5sum. source/*/?2/*-??1 | cutscip-shell system . . cut. -f1 -d' ' >> $CASE_ID.md5
569 md5sumscip-shell system . . md5sum. $CASE_ID/* | cutscip-shell system . . cut. -f1 -d' ' >> $CASE_ID.chk
570 result=$(diffscip-shell system . . diff. $CASE_ID.md5 $CASE_ID.chk)
571 if [[ -z "$result" ]]; then
572 echoscip-shell system . . echo. " - OK"
573 else
574 echoscip-shell system . . echo. " - Failed"
575 TEST_FAILED=true
576 fi
577 }
578
579 function case8-1scip-shell shell shell-project 0.0.0 case8-1(). {
580 #####################################################################
581 CASE_ID=${FUNCNAME[0]}
582 echoscip-shell system . . echo. "Test $CASE_ID: single file copy"
583 #####################################################################
584 mkdirscip-shell system . . mkdir. $CASE_ID
585 $S4CMD put ${S4CMD_OPTS} source/001 $REMOTEDIR/$CASE_ID/001_copy >> $CASE_ID.log 2>&1
586 $S4CMD cp ${S4CMD_OPTS} $REMOTEDIR/$CASE_ID/001_copy $REMOTEDIR/$CASE_ID/001 >> $CASE_ID.log 2>&1
587 $S4CMD get ${S4CMD_OPTS} $REMOTEDIR/$CASE_ID/001 $CASE_ID/001 >> $CASE_ID.log 2>&1
588
589 md5sumscip-shell system . . md5sum. source/001 | cutscip-shell system . . cut. -f1 -d' ' >> $CASE_ID.md5
590 md5sumscip-shell system . . md5sum. $CASE_ID/001 | cutscip-shell system . . cut. -f1 -d' ' >> $CASE_ID.chk
591 result=$(diffscip-shell system . . diff. $CASE_ID.md5 $CASE_ID.chk)
592 if [[ -z "$result" ]]; then
593 echoscip-shell system . . echo. " - OK"
594 else
595 echoscip-shell system . . echo. " - Failed"
596 TEST_FAILED=true
597 fi
598 }
599
600 function case8-2scip-shell shell shell-project 0.0.0 case8-2(). {
601 #####################################################################
602 CASE_ID=${FUNCNAME[0]}
603 echoscip-shell system . . echo. "Test $CASE_ID: recursive copy"
604 #####################################################################
605 mkdirscip-shell system . . mkdir. $CASE_ID
606 $S4CMD sync ${S4CMD_OPTS} source $REMOTEDIR/$CASE_ID-copy/ >> $CASE_ID.log 2>&1
607 $S4CMD cp ${S4CMD_OPTS} -r $REMOTEDIR/$CASE_ID-copy $REMOTEDIR/$CASE_ID >> $CASE_ID.log 2>&1
608 $S4CMD get ${S4CMD_OPTS} $REMOTEDIR/$CASE_ID/source/*/?2/*-??1 $CASE_ID/ >> $CASE_ID.log 2>&1
609
610 md5sumscip-shell system . . md5sum. source/*/?2/*-??1 | cutscip-shell system . . cut. -f1 -d' ' >> $CASE_ID.md5
611 md5sumscip-shell system . . md5sum. $CASE_ID/* | cutscip-shell system . . cut. -f1 -d' ' >> $CASE_ID.chk
612 result=$(diffscip-shell system . . diff. $CASE_ID.md5 $CASE_ID.chk)
613 if [[ -z "$result" ]]; then
614 echoscip-shell system . . echo. " - OK"
615 else
616 echoscip-shell system . . echo. " - Failed"
617 TEST_FAILED=true
618 fi
619 }
620
621 function case8-3scip-shell shell shell-project 0.0.0 case8-3(). {
622 #####################################################################
623 CASE_ID=${FUNCNAME[0]}
624 echoscip-shell system . . echo. "Test $CASE_ID: wildcards copy"
625 #####################################################################
626 mkdirscip-shell system . . mkdir. $CASE_ID
627 $S4CMD sync ${S4CMD_OPTS} source $REMOTEDIR/$CASE_ID-copy/ >> $CASE_ID.log 2>&1
628 $S4CMD cp ${S4CMD_OPTS} -r $REMOTEDIR/$CASE_ID-copy/source/*/?2/*-??1 $REMOTEDIR/$CASE_ID/ >> $CASE_ID.log 2>&1
629 $S4CMD get ${S4CMD_OPTS} $REMOTEDIR/$CASE_ID/* $CASE_ID/ >> $CASE_ID.log 2>&1
630
631 md5sumscip-shell system . . md5sum. source/*/?2/*-??1 | cutscip-shell system . . cut. -f1 -d' ' >> $CASE_ID.md5
632 md5sumscip-shell system . . md5sum. $CASE_ID/* | cutscip-shell system . . cut. -f1 -d' ' >> $CASE_ID.chk
633 result=$(diffscip-shell system . . diff. $CASE_ID.md5 $CASE_ID.chk)
634 if [[ -z "$result" ]]; then
635 echoscip-shell system . . echo. " - OK"
636 else
637 echoscip-shell system . . echo. " - Failed"
638 TEST_FAILED=true
639 fi
640 }
641
642 function case9-1scip-shell shell shell-project 0.0.0 case9-1(). {
643 #####################################################################
644 CASE_ID=${FUNCNAME[0]}
645 echoscip-shell system . . echo. "Test $CASE_ID: single file move"
646 #####################################################################
647 mkdirscip-shell system . . mkdir. $CASE_ID
648 $S4CMD put ${S4CMD_OPTS} source/001 $REMOTEDIR/$CASE_ID/001_copy >> $CASE_ID.log 2>&1
649 $S4CMD mv ${S4CMD_OPTS} $REMOTEDIR/$CASE_ID/001_copy $REMOTEDIR/$CASE_ID/001 >> $CASE_ID.log 2>&1
650 $S4CMD get ${S4CMD_OPTS} $REMOTEDIR/$CASE_ID/001 $CASE_ID/001 >> $CASE_ID.log 2>&1
651
652 md5sumscip-shell system . . md5sum. source/001 | cutscip-shell system . . cut. -f1 -d' ' >> $CASE_ID.md5
653 md5sumscip-shell system . . md5sum. $CASE_ID/001 | cutscip-shell system . . cut. -f1 -d' ' >> $CASE_ID.chk
654 result=$(diffscip-shell system . . diff. $CASE_ID.md5 $CASE_ID.chk)
655 if [[ -z "$result" ]]; then
656 echoscip-shell system . . echo. " - OK"
657 else
658 echoscip-shell system . . echo. " - Failed"
659 TEST_FAILED=true
660 fi
661 }
662
663 function case9-2scip-shell shell shell-project 0.0.0 case9-2(). {
664 #####################################################################
665 CASE_ID=${FUNCNAME[0]}
666 echoscip-shell system . . echo. "Test $CASE_ID: recursive move"
667 #####################################################################
668 mkdirscip-shell system . . mkdir. $CASE_ID
669 $S4CMD sync ${S4CMD_OPTS} source $REMOTEDIR/$CASE_ID-copy/ >> $CASE_ID.log 2>&1
670 $S4CMD mv ${S4CMD_OPTS} -r $REMOTEDIR/$CASE_ID-copy $REMOTEDIR/$CASE_ID >> $CASE_ID.log 2>&1
671 $S4CMD get ${S4CMD_OPTS} $REMOTEDIR/$CASE_ID/source/*/?2/*-??1 $CASE_ID/ >> $CASE_ID.log 2>&1
672
673 md5sumscip-shell system . . md5sum. source/*/?2/*-??1 | cutscip-shell system . . cut. -f1 -d' ' >> $CASE_ID.md5
674 md5sumscip-shell system . . md5sum. $CASE_ID/* | cutscip-shell system . . cut. -f1 -d' ' >> $CASE_ID.chk
675 result=$(diffscip-shell system . . diff. $CASE_ID.md5 $CASE_ID.chk)
676 if [[ -z "$result" ]]; then
677 echoscip-shell system . . echo. " - OK"
678 else
679 echoscip-shell system . . echo. " - Failed"
680 TEST_FAILED=true
681 fi
682 }
683
684 function case9-3scip-shell shell shell-project 0.0.0 case9-3(). {
685 #####################################################################
686 CASE_ID=${FUNCNAME[0]}
687 echoscip-shell system . . echo. "Test $CASE_ID: wildcards move"
688 #####################################################################
689 mkdirscip-shell system . . mkdir. $CASE_ID
690 $S4CMD sync ${S4CMD_OPTS} source $REMOTEDIR/$CASE_ID-copy/ >> $CASE_ID.log 2>&1
691 $S4CMD mv ${S4CMD_OPTS} -r $REMOTEDIR/$CASE_ID-copy/source/*/?2/*-??1 $REMOTEDIR/$CASE_ID/ >> $CASE_ID.log 2>&1
692 $S4CMD get ${S4CMD_OPTS} $REMOTEDIR/$CASE_ID/* $CASE_ID/ >> $CASE_ID.log 2>&1
693
694 md5sumscip-shell system . . md5sum. source/*/?2/*-??1 | cutscip-shell system . . cut. -f1 -d' ' >> $CASE_ID.md5
695 md5sumscip-shell system . . md5sum. $CASE_ID/* | cutscip-shell system . . cut. -f1 -d' ' >> $CASE_ID.chk
696 result=$(diffscip-shell system . . diff. $CASE_ID.md5 $CASE_ID.chk)
697 if [[ -z "$result" ]]; then
698 echoscip-shell system . . echo. " - OK"
699 else
700 echoscip-shell system . . echo. " - Failed"
701 TEST_FAILED=true
702 fi
703 }
704
705 function case10-1scip-shell shell shell-project 0.0.0 case10-1(). {
706 #####################################################################
707 CASE_ID=${FUNCNAME[0]}
708 echoscip-shell system . . echo. "Test $CASE_ID: get size with du"
709 #####################################################################
710 $S4CMD put ${S4CMD_OPTS} source/*/?2/*-??1 $REMOTEDIR/$CASE_ID/ >> $CASE_ID.log 2>&1
711 $S4CMD du ${S4CMD_OPTS} $REMOTEDIR/$CASE_ID/ >> $CASE_ID.out 2> $CASE_ID.err
712
713 s=$(catscip-shell system . . cat. $CASE_ID.out | cutscip-shell system . . cut. -f1)
714 if [[ "$s" -eq "12582912" ]]; then
715 echoscip-shell system . . echo. " - OK"
716 else
717 echoscip-shell system . . echo. " - Failed"
718 TEST_FAILED=true
719 fi
720 }
721
722 function case10-2scip-shell shell shell-project 0.0.0 case10-2(). {
723 #####################################################################
724 CASE_ID=${FUNCNAME[0]}
725 echoscip-shell system . . echo. "Test $CASE_ID: get total size (experimental)"
726 #####################################################################
727 $S4CMD put ${S4CMD_OPTS} source/*/?2/*-??1 $REMOTEDIR/$CASE_ID/ >> $CASE_ID.log 2>&1
728 $S4CMD _totalsize ${S4CMD_OPTS} $REMOTEDIR/$CASE_ID $REMOTEDIR/$CASE_ID >> $CASE_ID.out 2> $CASE_ID.err
729
730 s=$(catscip-shell system . . cat. $CASE_ID.out | cutscip-shell system . . cut. -f1)
731 if [[ "$s" -eq "25165824" ]]; then
732 echoscip-shell system . . echo. " - OK"
733 else
734 echoscip-shell system . . echo. " - Failed"
735 TEST_FAILED=true
736 fi
737 }
738
739 function case11scip-shell shell shell-project 0.0.0 case11(). {
740 #####################################################################
741 CASE_ID=${FUNCNAME[0]}
742 echoscip-shell system . . echo. "Test $CASE_ID: large files put/mv/get (multipart upload) with permission"
743 #####################################################################
744 mkdirscip-shell system . . mkdir. $CASE_ID
745 large=$CASE_ID/large-source
746 ddscip-shell system . . dd. if=/dev/urandomscip-shell filesystem . . `/dev/urandom`. of=$large bs=10M count=10 iflag=fullblock >> $CASE_ID.log 2>&1
747 chmodscip-shell system . . chmod. 444 $large
748
749 MULTIPART_OPT="--multipart-split-size=5242880 --max-singlepart-upload-size=10485760 --max-singlepart-upload-size=10485760 --max-singlepart-download-size=10485760"
750
751 $S4CMD put ${S4CMD_OPTS} ${MULTIPART_OPT} $large $REMOTEDIR/$CASE_ID/large >> $CASE_ID.log 2>&1
752 $S4CMD mv ${S4CMD_OPTS} ${MULTIPART_OPT} $REMOTEDIR/$CASE_ID/large $REMOTEDIR/$CASE_ID/large2 >> $CASE_ID.log 2>&1
753 $S4CMD get ${S4CMD_OPTS} ${MULTIPART_OPT} $REMOTEDIR/$CASE_ID/large2 $CASE_ID/large >> $CASE_ID.log 2>&1
754
755 statscip-shell system . . stat. -c %A $large >> $CASE_ID/large.privilege
756 statscip-shell system . . stat. -c %A $CASE_ID/large >> $CASE_ID/large_dest.privilege
757
758 md5sumscip-shell system . . md5sum. $large | cutscip-shell system . . cut. -f1 -d' ' >> $CASE_ID.md5
759 md5sumscip-shell system . . md5sum. $CASE_ID/large | cutscip-shell system . . cut. -f1 -d' ' >> $CASE_ID.chk
760
761 result=$(diffscip-shell system . . diff. $CASE_ID.md5 $CASE_ID.chk)
762 result_permission=$(diffscip-shell system . . diff. $CASE_ID/large.privilege $CASE_ID/large_dest.privilege)
763 if [[ ( -z "$result" ) && ( -z "$result_permission" ) ]]; then
764 echoscip-shell system . . echo. " - OK"
765 else
766 echoscip-shell system . . echo. " - Failed"
767 TEST_FAILED=true
768 fi
769 }
770
771 function case12scip-shell shell shell-project 0.0.0 case12(). {
772 #####################################################################
773 CASE_ID=${FUNCNAME[0]}
774 echoscip-shell system . . echo. "Test $CASE_ID: deletion"
775 #####################################################################
776 $S4CMD sync ${S4CMD_OPTS} source $REMOTEDIR/$CASE_ID/ >> $CASE_ID.log 2>&1
777 $S4CMD del ${S4CMD_OPTS} -r $REMOTEDIR/$CASE_ID/ >> $CASE_ID.log 2>&1
778 $S4CMD ls ${S4CMD_OPTS} $REMOTEDIR/$CASE_ID/ >> $CASE_ID.out 2> $CASE_ID.err
779
780 result=$(catscip-shell system . . cat. $CASE_ID.out)
781 if [[ -z "$result" ]]; then
782 echoscip-shell system . . echo. " - OK"
783 else
784 echoscip-shell system . . echo. " - Failed"
785 TEST_FAILED=true
786 fi
787 }
788
789 function case13scip-shell shell shell-project 0.0.0 case13(). {
790 #####################################################################
791 CASE_ID=${FUNCNAME[0]}
792 echoscip-shell system . . echo. "Test $CASE_ID: Testing file permissions"
793 #####################################################################
794 $S4CMD sync ${S4CMD_OPTS} source $REMOTEDIR/$CASE_ID/ >> $CASE_ID.log 2>&1
795 $S4CMD sync ${S4CMD_OPTS} $REMOTEDIR/$CASE_ID/ $CASE_ID/ >> $CASE_ID.log 2>&1
796 statscip-shell system . . stat. -c %A source/* >> $CASE_ID/orig.privilege
797 statscip-shell system . . stat. -c %A $CASE_ID/source/* >> $CASE_ID/dest.privilege
798
799 result=$(diffscip-shell system . . diff. $CASE_ID/orig.privilege $CASE_ID/dest.privilege)
800
801 if [[ -z "$result_001" ]]; then
802 echoscip-shell system . . echo. " - OK"
803 else
804 echoscip-shell system . . echo. " - Failed"
805 TEST_FAILED=true
806 fi
807 }
808
809 function case14scip-shell shell shell-project 0.0.0 case14(). {
810 #####################################################################
811 CASE_ID=${FUNCNAME[0]}
812 echoscip-shell system . . echo. "Test $CASE_ID: Testing double slashes"
813 #####################################################################
814 mkdirscip-shell system . . mkdir. $CASE_ID
815 $S4CMD put ${S4CMD_OPTS} source/001 $REMOTEDIR/$CASE_ID//001 >> $CASE_ID.log 2>&1
816 $S4CMD get ${S4CMD_OPTS} $REMOTEDIR/$CASE_ID//001 $CASE_ID/001 >> $CASE_ID.log 2>&1
817
818 md5sumscip-shell system . . md5sum. source/001 | cutscip-shell system . . cut. -f1 -d' ' >> $CASE_ID.md5
819 md5sumscip-shell system . . md5sum. $CASE_ID/001 | cutscip-shell system . . cut. -f1 -d' ' >> $CASE_ID.chk
820 result=$(diffscip-shell system . . diff. $CASE_ID.md5 $CASE_ID.chk)
821 if [[ -z "$result" ]]; then
822 echoscip-shell system . . echo. " - OK"
823 else
824 echoscip-shell system . . echo. " - Failed"
825 TEST_FAILED=true
826 fi
827 }
828
829 TEST_CASES=
830 if [scip-shell system . . `[`. "$#" -ne 1 ]; then
831 echoscip-shell system . . echo. "Running all tests"
832 # Search all test cases functions.
833 TEST_CASES="$(grepscip-shell system . . grep. -o -E "function\s+case[0-9-]+" $0 | cutscip-shell system . . cut. -f2 -d' ' | xargsscip-shell system . . xargs.)"
834 else
835 TEST_CASES="$*"
836 fi
837
838 echoscip-shell system . . echo. 'Initializing...'
839 initializescip-shell shell shell-project 0.0.0 initialize(). > /dev/nullscip-shell filesystem . . `/dev/null`. 2>&1
840 echoscip-shell system . . echo. "Executing test cases with $(python --version)"
841 pushd $LOCALDIR > /dev/nullscip-shell filesystem . . `/dev/null`.
842 for case in $TEST_CASES
843 do
844 $case
845 done
846 popd > /dev/nullscip-shell filesystem . . `/dev/null`.
847
848 echoscip-shell system . . echo. "Done testing"
849 if [[ $TEST_FAILED == true ]]; then
850 exit 111
851 fi