152 |
161 |
153 # ---------------------------------------------------------------------------- |
162 # ---------------------------------------------------------------------------- |
154 # 5. test: pull changed files |
163 # 5. test: pull changed files |
155 # expected result: 1 file pulled |
164 # expected result: 1 file pulled |
156 |
165 |
157 echo testx2 > tmp-sync/test1a/file1 |
166 echo testx5 > tmp-sync/test1a/file1 |
158 dav_sync_push test1a "test5: push failed" |
167 dav_sync_push test1a "test5: push failed" |
159 check_tmpout "1 file pushed" "test5: wrong push counter" |
168 check_tmpout "1 file pushed" "test5: wrong push counter" |
160 |
169 |
161 dav_sync_pull test1b "test5: pull failed" |
170 dav_sync_pull test1b "test5: pull failed" |
162 check_tmpout "0 errors" "test5: wrong error counter" |
171 check_tmpout "0 errors" "test5: wrong error counter" |
163 check_tmpout "0 conflicts" "test5: wrong conflicts counter" |
172 check_tmpout "0 conflicts" "test5: wrong conflicts counter" |
|
173 |
|
174 TEST=`cat tmp-sync/test1b/file1` |
|
175 if [ $TEST != "testx5" ]; then |
|
176 echo "test5: wrong content" |
|
177 exit 2 |
|
178 fi |
164 |
179 |
165 # ---------------------------------------------------------------------------- |
180 # ---------------------------------------------------------------------------- |
166 # 6. test: pull new dir and files |
181 # 6. test: pull new dir and files |
167 # expected result: mkdir and some files pulled |
182 # expected result: mkdir and some files pulled |
168 |
183 |
172 dav_sync_push test1a "test6: push failed" |
187 dav_sync_push test1a "test6: push failed" |
173 |
188 |
174 dav_sync_pull test1b "test6: pull failed" |
189 dav_sync_pull test1b "test6: pull failed" |
175 check_tmpout "get: /subdir/sub1" "test6: sub1 not pulled" |
190 check_tmpout "get: /subdir/sub1" "test6: sub1 not pulled" |
176 check_tmpout "get: /subdir/sub2" "test6: sub2 not pulled" |
191 check_tmpout "get: /subdir/sub2" "test6: sub2 not pulled" |
|
192 |
|
193 |
|
194 # ---------------------------------------------------------------------------- |
|
195 # 7. test: pull deep dir hierarchy with some files |
|
196 # expected result: mkdir in correct order (see push1 test 6) |
|
197 |
|
198 mkdir -p tmp-sync/test1a/dir_a/1/2/3/4/5/6/7/8 |
|
199 mkdir -p tmp-sync/test1a/dir_a/1/2/3/a/b/c/d |
|
200 mkdir -p tmp-sync/test1a/dir_a/i/j/k |
|
201 mkdir -p tmp-sync/test1a/dir_b/1/2/3/4/5/6/7/8 |
|
202 mkdir -p tmp-sync/test1a/dir_b/1/2/3/a/b/c/d |
|
203 mkdir -p tmp-sync/test1a/dir_b/i/j/k |
|
204 mkdir -p tmp-sync/test1a/dir_c/sub1/sub2/sub3/sub4 |
|
205 mkdir -p tmp-sync/test1a/dir_c/sub1/sub2/1 |
|
206 mkdir -p tmp-sync/test1a/dir_c/sub1/sub2/2 |
|
207 mkdir -p tmp-sync/test1a/dir_c/sub1/sub2/3 |
|
208 mkdir -p tmp-sync/test1a/dir_c/sub1/sub2/4 |
|
209 mkdir -p tmp-sync/test1a/dir_c/sub1/sub2/5 |
|
210 mkdir -p tmp-sync/test1a/dir_c/sub_a/x |
|
211 mkdir -p tmp-sync/test1a/dir_c/sub_a/y/d1/d2/d3 |
|
212 touch tmp-sync/test1a/dir_a/1/2/3/4/5/6/7/8/file1 |
|
213 touch tmp-sync/test1a/dir_a/1/2/3/4/5/6/7/file1 |
|
214 touch tmp-sync/test1a/dir_a/1/2/3/4/5/6/file1 |
|
215 touch tmp-sync/test1a/dir_a/1/2/3/a/b/c/d/d_file1 |
|
216 touch tmp-sync/test1a/dir_a/1/2/3/a/b/b_file1 |
|
217 touch tmp-sync/test1a/dir_a/a_file |
|
218 |
|
219 echo "test6-file-1" > tmp-sync/test1a/dir_b/1/2/3/4/5/6/7/8/t6f1-8 |
|
220 echo "test6-file-2" > tmp-sync/test1a/dir_b/i/t6f2-i |
|
221 echo "test6-file-3" > tmp-sync/test1a/dir_c/sub1/sub2/sub3/sub4/t6f3-s4 |
|
222 echo "test6-file-4" > tmp-sync/test1a/dir_c/sub1/sub2/3/t6f4-3 |
|
223 |
|
224 dav_sync_push test1a "test7: push failed" |
|
225 check_tmpout "10 files pushed" "test7: wrong push counter" |
|
226 |
|
227 dav_sync_pull test1b "test7: pull failed" |
|
228 check_tmpout "0 errors" "test7: wrong error counter" |
|
229 check_tmpout "0 conflicts" "test7: wrong conflicts counter" |
|
230 |
|
231 # check if all files are pulled |
|
232 cat tmp-sync/test1b/dir_a/1/2/3/4/5/6/7/8/file1 > /dev/null 2>&1 |
|
233 if [ $? -ne 0 ]; then |
|
234 echo "test 7: missing file: 1" |
|
235 exit 2 |
|
236 fi |
|
237 cat tmp-sync/test1b/dir_a/1/2/3/4/5/6/7/file1 > /dev/null 2>&1 |
|
238 if [ $? -ne 0 ]; then |
|
239 echo "test 7: missing file: 2" |
|
240 exit 2 |
|
241 fi |
|
242 cat tmp-sync/test1b/dir_a/1/2/3/4/5/6/file1 > /dev/null 2>&1 |
|
243 if [ $? -ne 0 ]; then |
|
244 echo "test 7: missing file: 3" |
|
245 exit 2 |
|
246 fi |
|
247 cat tmp-sync/test1b/dir_a/1/2/3/a/b/c/d/d_file1 > /dev/null 2>&1 |
|
248 if [ $? -ne 0 ]; then |
|
249 echo "test 7: missing file: 4" |
|
250 exit 1 |
|
251 fi |
|
252 cat tmp-sync/test1b/dir_a/1/2/3/a/b/b_file1 > /dev/null 2>&1 |
|
253 if [ $? -ne 0 ]; then |
|
254 echo "test 7: missing file: 5" |
|
255 exit 2 |
|
256 fi |
|
257 cat tmp-sync/test1b/dir_a/a_file > /dev/null 2>&1 |
|
258 if [ $? -ne 0 ]; then |
|
259 echo "test 7: missing file: 6" |
|
260 exit 2 |
|
261 fi |
|
262 |
|
263 cat tmp-sync/test1b/dir_b/1/2/3/4/5/6/7/8/t6f1-8 > /dev/null 2>&1 |
|
264 if [ $? -ne 0 ]; then |
|
265 echo "test 7: missing file: 7" |
|
266 exit 2 |
|
267 fi |
|
268 cat tmp-sync/test1b/dir_b/i/t6f2-i > /dev/null 2>&1 |
|
269 if [ $? -ne 0 ]; then |
|
270 echo "test 7: missing file: 8" |
|
271 exit 2 |
|
272 fi |
|
273 cat tmp-sync/test1b/dir_c/sub1/sub2/sub3/sub4/t6f3-s4 > /dev/null 2>&1 |
|
274 if [ $? -ne 0 ]; then |
|
275 echo "test 7: missing file: 9" |
|
276 exit 2 |
|
277 fi |
|
278 cat tmp-sync/test1b/dir_c/sub1/sub2/3/t6f4-3 > /dev/null 2>&1 |
|
279 if [ $? -ne 0 ]; then |
|
280 echo "test 7: missing file: 10" |
|
281 exit 2 |
|
282 fi |
|
283 |
|
284 # ---------------------------------------------------------------------------- |
|
285 # 8. test: delete file |
|
286 # expected result: 1 file deleted |
|
287 |
|
288 rm tmp-sync/test1a/file1 |
|
289 |
|
290 dav_sync_push test1a |
|
291 check_tmpout "1 file deleted" "test8: wrong delete counter" |
|
292 |
|
293 dav_sync_pull test1b |
|
294 check_tmpout "1 file deleted" "test8: wrong delete counter" |
|
295 |
|
296 TEST=`cat tmp-sync/out.txt | grep "delete: /file1"` |
|
297 if [ $? -ne 0 ]; then |
|
298 echo "test8: file1 not deleted (log)" |
|
299 exit 2 |
|
300 fi |
|
301 |
|
302 cat tmp-sync/test1b/file1 > /dev/null 2>&1 # should fail |
|
303 if [ $? -eq 0 ]; then |
|
304 echo "test8: file1 not deleted" |
|
305 exit 2 |
|
306 fi |
|
307 |
|
308 # ---------------------------------------------------------------------------- |
|
309 # 9. test: delete multiple files |
|
310 # expected result: multiple files deleted |
|
311 |
|
312 rm tmp-sync/test1a/file2 |
|
313 rm tmp-sync/test1a/subdir/sub1 |
|
314 rm tmp-sync/test1a/subdir/sub2 |
|
315 |
|
316 dav_sync_push test1a |
|
317 check_tmpout "3 files deleted" "test9: wrong delete counter" |
|
318 |
|
319 dav_sync_pull test1b |
|
320 check_tmpout "3 files deleted" "test9: wrong delete counter" |
|
321 check_tmpout "0 errors" "test9: wrong error counter" |
|
322 check_tmpout "0 conflicts" "test9: wrong conflicts counter" |
|
323 |
|
324 TEST=`cat tmp-sync/out.txt | grep "delete: /subdir/sub1"` |
|
325 if [ $? -ne 0 ]; then |
|
326 echo "test9: sub1 not deleted (log)" |
|
327 exit 2 |
|
328 fi |
|
329 TEST=`cat tmp-sync/out.txt | grep "delete: /subdir/sub2"` |
|
330 if [ $? -ne 0 ]; then |
|
331 echo "test9: sub2 not deleted (log)" |
|
332 exit 2 |
|
333 fi |
|
334 |
|
335 cat tmp-sync/test1b/file2 > /dev/null 2>&1 # should fail |
|
336 if [ $? -eq 0 ]; then |
|
337 echo "test9: file2 not deleted" |
|
338 exit 2 |
|
339 fi |
|
340 cat tmp-sync/test1b/subdir/sub1 > /dev/null 2>&1 # should fail |
|
341 if [ $? -eq 0 ]; then |
|
342 echo "test9: sub1 not deleted" |
|
343 exit 2 |
|
344 fi |
|
345 cat tmp-sync/test1b/subdir/sub2 > /dev/null 2>&1 # should fail |
|
346 if [ $? -eq 0 ]; then |
|
347 echo "test9: sub2 not deleted" |
|
348 exit 2 |
|
349 fi |
|
350 |
|
351 OUT=`ls tmp-sync/test1b/subdir/ | wc -l` |
|
352 if [ "$OUT" != "0" ]; |
|
353 then |
|
354 echo "test9: test1b/subdir not empty" |
|
355 exit 2 |
|
356 fi |
|
357 |
|
358 # ---------------------------------------------------------------------------- |
|
359 # 10. test: delete empty dir |
|
360 # expected result: pull deletes local empty dir |
|
361 |
|
362 rm -Rf tmp-sync/test1a/subdir/ |
|
363 |
|
364 dav_sync_push test1a |
|
365 |
|
366 dav_sync_pull test1b |
|
367 check_tmpout "0 errors" "test10: wrong error counter" |
|
368 check_tmpout "0 conflicts" "test10: wrong conflicts counter" |
|
369 |
|
370 TEST=`ls tmp-sync/test1b/ | grep subdir` |
|
371 if [ $? -eq 0 ]; then |
|
372 echo "test10: subdir not deleted" |
|
373 fi |
|
374 |
|
375 # ---------------------------------------------------------------------------- |
|
376 # 11. test: delete deep dir hierarchy |
|
377 # expected result: 0 errors, everything deleted |
|
378 |
|
379 rm -Rf tmp-sync/test1a/dir_a |
|
380 |
|
381 dav_sync_push test1a |
|
382 bash |
|
383 dav_sync_pull test1b |
|
384 check_tmpout "0 errors" "test10: wrong error counter" |
|
385 check_tmpout "0 conflicts" "test10: wrong conflicts counter" |
|
386 |
|
387 TEST=`ls tmp-sync/test1b/ | grep dir_a` |
|
388 if [ $? -eq 0 ]; then |
|
389 echo "test10: dir_a not deleted" |
|
390 fi |
|
391 |
|
392 |