91 $DAV_BIN mkcol dav-test-repo/sync/test2 2> /dev/null |
91 $DAV_BIN mkcol dav-test-repo/sync/test2 2> /dev/null |
92 |
92 |
93 # prepare |
93 # prepare |
94 cp synctest/file1 tmp-sync/test1a |
94 cp synctest/file1 tmp-sync/test1a |
95 cp synctest/file2 tmp-sync/test1a |
95 cp synctest/file2 tmp-sync/test1a |
|
96 |
|
97 mkdir tmp-sync/test1a/dir1/ |
|
98 mkdir tmp-sync/test1a/dir2/ |
|
99 mkdir tmp-sync/test1a/dir1/subdir1/ |
|
100 mkdir tmp-sync/test1a/dir2/subdir1/ |
|
101 |
|
102 cp synctest/file1 tmp-sync/test1a/dir1/ |
|
103 cp synctest/file2 tmp-sync/test1a/dir1/ |
|
104 cp synctest/file3 tmp-sync/test1a/dir1/ |
|
105 cp synctest/file4 tmp-sync/test1a/dir1/ |
|
106 |
|
107 cp synctest/file1 tmp-sync/test1a/dir2/ |
|
108 cp synctest/file2 tmp-sync/test1a/dir2/ |
|
109 cp synctest/file3 tmp-sync/test1a/dir2/subdir1/ |
|
110 cp synctest/file4 tmp-sync/test1a/dir2/subdir1/ |
|
111 |
|
112 cp synctest/file1 tmp-sync/test1a/dir1/subdir1/ |
|
113 cp synctest/file2 tmp-sync/test1a/dir1/subdir1/ |
|
114 cp synctest/file3 tmp-sync/test1a/dir1/subdir1/ |
|
115 cp synctest/file4 tmp-sync/test1a/dir1/subdir1/ |
|
116 cp synctest/empty1 tmp-sync/test1a/dir1/subdir1/ |
|
117 cp synctest/empty2 tmp-sync/test1a/dir1/subdir1/ |
|
118 |
96 dav_sync_push test1a "prepare: push failed" |
119 dav_sync_push test1a "prepare: push failed" |
97 dav_sync_pull test1b "prepare: pull failed" |
120 dav_sync_pull test1b "prepare: pull failed" |
98 sleep 3 |
121 sleep 3 |
99 |
122 |
100 # ---------------------------------------------------------------------------- |
123 # ---------------------------------------------------------------------------- |
324 check_tmpout "0 errors" "test 8: wrong error counter (2)" |
347 check_tmpout "0 errors" "test 8: wrong error counter (2)" |
325 |
348 |
326 |
349 |
327 # ---------------------------------------------------------------------------- |
350 # ---------------------------------------------------------------------------- |
328 # 9. test: test1a deleted file, test1b modified file |
351 # 9. test: test1a deleted file, test1b modified file |
329 # expected result: conflict |
352 # expected result: no delete |
330 |
353 |
331 sleep 3 # make sure mtime changes |
354 sleep 3 # make sure mtime changes |
332 |
355 |
333 rm -f tmp-sync/test1a/file1 |
356 rm -f tmp-sync/test1a/file1 |
334 |
357 |
351 if [ $? -ne 0 ]; then |
374 if [ $? -ne 0 ]; then |
352 echo "test 9: file1 deleted (2)" |
375 echo "test 9: file1 deleted (2)" |
353 exit 2 |
376 exit 2 |
354 fi |
377 fi |
355 |
378 |
|
379 # ---------------------------------------------------------------------------- |
|
380 # 10. test: test1a deleted 2 files in subdir, test1b modified one file |
|
381 # expected result: 1 delete |
|
382 |
|
383 # no sleep required, because we are working with other files |
|
384 |
|
385 rm -f tmp-sync/test1a/dir2/subdir1/file3 |
|
386 rm -f tmp-sync/test1a/dir2/subdir1/file4 |
|
387 |
|
388 dav_sync_push test1a "test 10: push failed" |
|
389 check_tmpout "2 files deleted" "test 10: wrong delete counter" |
|
390 check_tmpout "0 conflicts" "test 9: wrong conflict counter" |
|
391 |
|
392 echo "conflict1-test10-conflict" >> tmp-sync/test1b/dir2/subdir1/file4 |
|
393 |
|
394 dav_sync_pull test1b "test 10: pull failed" |
|
395 # don't check conflict counter |
|
396 check_tmpout "1 file deleted" "test 10: wrong delete counter" |
|
397 |
|
398 cat tmp-sync/test1b/dir2/subdir1/file4 > /dev/null 2>&1 |
|
399 if [ $? -ne 0 ]; then |
|
400 echo "test 10: file4 deleted" |
|
401 exit 2 |
|
402 fi |
|
403 |
|
404 |
|
405 # ---------------------------------------------------------------------------- |
|
406 # 11. test: delete dir in test1a, modify 1 file in test1b |
|
407 # expected result: 1 remaining file |
|
408 |
|
409 # no sleep required, because we are working with other files |
|
410 |
|
411 rm -Rf tmp-sync/test1a/dir1 |
|
412 |
|
413 dav_sync_push test1a "test 11: push failed" |
|
414 check_tmpout "0 conflicts" "test 11: wrong conflict counter (push)" |
|
415 check_tmpout "0 errors" "test 11: wrong error counter (push)" |
|
416 |
|
417 echo "conflict1-test11-conflict" >> tmp-sync/test1b/dir1/file3 |
|
418 |
|
419 dav_sync_pull test1b "test 11: pull failed" |
|
420 check_tmpout "0 errors" "test 11: wrong error counter (pull)" |
|
421 check_tmpout "delete: " "test 11: no deletes (pull)" |
|
422 |
|
423 TEST=`ls tmp-sync/test1b/dir1/ | wc -l` |
|
424 if [ $TEST != "1" ]; then |
|
425 echo "test 11: wrong file count" |
|
426 exit 2 |
|
427 fi |
|
428 |
|
429 |
|
430 # ---------------------------------------------------------------------------- |
|
431 # 12. test: test1a modifies file, test1b deletes file |
|
432 # expected result: pull test1b restores deleted file |
|
433 |
|
434 # no sleep required, because we are working with other files |
|
435 |
|
436 echo "modified" >> tmp-sync/test1a/file2 |
|
437 |
|
438 dav_sync_push test1a "test 12: push failed" |
|
439 check_tmpout "1 file pushed" "test 12: wrong push counter" |
|
440 check_tmpout "0 conflicts" "test 12: wrong conflict counter (push)" |
|
441 check_tmpout "0 errors" "test 12: wrong error counter (push)" |
|
442 |
|
443 rm tmp-sync/test1b/file2 |
|
444 |
|
445 dav_sync_pull test1b "test 12: pull failed" |
|
446 check_tmpout "1 file pulled" "test 12: wrong pull counter" |
|
447 check_tmpout "0 conflicts" "test 12: wrong conflict counter (pull)" |
|
448 check_tmpout "0 errors" "test 12: wrong error counter (pull)" |
|
449 |
|
450 cat tmp-sync/test1b/file2 > /dev/null 2>&1 |
|
451 if [ $? -ne 0 ]; then |
|
452 echo "test 12: file2 missing" |
|
453 exit 2 |
|
454 fi |
|
455 |
|
456 |
|
457 |
|
458 |