# HG changeset patch # User Olaf Wintermann # Date 1568556718 -7200 # Node ID b138d1241e68d77daa744103b3cdeb3dba6a9de4 # Parent 65e40934b26c3fbf852baa965e139bc49b1f8f98 finish hashing tests diff -r 65e40934b26c -r b138d1241e68 libidav/utils.c --- a/libidav/utils.c Sun Sep 08 15:43:13 2019 +0200 +++ b/libidav/utils.c Sun Sep 15 16:11:58 2019 +0200 @@ -1027,7 +1027,7 @@ size_t buflen = 2*len + 4; UcxBuffer *buf = ucx_buffer_new(malloc(buflen), buflen + 1, 0); for(int i=0;ispace; diff -r 65e40934b26c -r b138d1241e68 test/bin-test/test-dav-sync-hashing.sh --- a/test/bin-test/test-dav-sync-hashing.sh Sun Sep 08 15:43:13 2019 +0200 +++ b/test/bin-test/test-dav-sync-hashing.sh Sun Sep 15 16:11:58 2019 +0200 @@ -388,3 +388,52 @@ check_tmpout "0 conflicts" "test 12: wrong conflict counter (pull)" check_tmpout "0 errors" "test 12: wrong error counter (pull)" + +# ---------------------------------------------------------------------------- +# 13. test: delete file, change name of other file to deleted file's name +# expected result: first file has content of second file, second file deleted + +# prepare +echo "test13-file1" > tmp-sync/test2a/t13file1 +sleep 3 # make sure t13file2 doesn't has the same mtime as t13file1 +echo "test13-file2" > tmp-sync/test2a/t13file2 + +dav_sync_push test2a "test 13: push failed (prepare)" +check_tmpout "2 files pushed" "test 13: wrong push counter (prepare, push)" +check_tmpout "0 conflicts" "test 13: wrong conflict counter (prepare, push)" +check_tmpout "0 errors" "test 13: wrong error counter (prepare, push)" + +dav_sync_pull test2b "test 13: pull failed (prepare)" +check_tmpout "2 files pulled" "test 13: wrong pull counter (prepare, pull)" +check_tmpout "0 conflicts" "test 13: wrong conflict counter (prepare, pull)" +check_tmpout "0 errors" "test 13: wrong error counter (prepare, pull)" + +# do test +rm -f tmp-sync/test2a/t13file1 +mv tmp-sync/test2a/t13file2 tmp-sync/test2a/t13file1 + + +dav_sync_push test2a "test 13: push failed" +# we can't check the exact output, because there are multiple valid ways +# to sync the changes +check_tmpout "0 conflicts" "test 13: wrong conflict counter (push)" +check_tmpout "0 errors" "test 13: wrong error counter (push)" + +dav_sync_pull test2b "test 13: pull failed" +check_tmpout "0 conflicts" "test 13: wrong conflict counter (pull)" +check_tmpout "0 errors" "test 13: wrong error counter (pull)" + +TEST=`cat tmp-sync/test2b/t13file1` +if [ $TEST != "test13-file2" ]; then + echo "test 13: t13file1 has wrong content" + exit 2 +fi + +cat tmp-sync/test2b/t13file2 > /dev/null 2>&1 +if [ $? -eq 0 ]; then + echo "test 13: t13file2 not deleted" + exit 2 +fi + + + diff -r 65e40934b26c -r b138d1241e68 test/bin-test/test-dav-sync.sh --- a/test/bin-test/test-dav-sync.sh Sun Sep 08 15:43:13 2019 +0200 +++ b/test/bin-test/test-dav-sync.sh Sun Sep 15 16:11:58 2019 +0200 @@ -94,9 +94,9 @@ # ok, begin the tests # do_test "dav-sync push (1)" test-dav-sync-push1.sh -#do_test "dav-sync pull (1)" test-dav-sync-pull1.sh -#do_test "dav-sync pull conflict (1)" test-dav-sync-pull-conflict.sh -#do_test "dav-sync push conflict (1)" test-dav-sync-push-conflict.sh +do_test "dav-sync pull (1)" test-dav-sync-pull1.sh +do_test "dav-sync pull conflict (1)" test-dav-sync-pull-conflict.sh +do_test "dav-sync push conflict (1)" test-dav-sync-push-conflict.sh do_test "dav-sync hashing" test-dav-sync-hashing.sh # cleanup