Sat, 07 Sep 2019 19:25:51 +0200
fix that file uploads are tried, when the content on the server is equal to the local file content (with enabled hashing)
637
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1 | #!/bin/sh |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
2 | # |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
3 | # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
4 | # |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
5 | # Copyright 2019 Olaf Wintermann. All rights reserved. |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
6 | # |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
7 | # Redistribution and use in source and binary forms, with or without |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
8 | # modification, are permitted provided that the following conditions are met: |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
9 | # |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
10 | # 1. Redistributions of source code must retain the above copyright |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
11 | # notice, this list of conditions and the following disclaimer. |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
12 | # |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
13 | # 2. Redistributions in binary form must reproduce the above copyright |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
14 | # notice, this list of conditions and the following disclaimer in the |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
15 | # documentation and/or other materials provided with the distribution. |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
16 | # |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
17 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
18 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
19 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
20 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
21 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
22 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
23 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
24 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
25 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
26 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
27 | # POSSIBILITY OF SUCH DAMAGE. |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
28 | # |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
29 | |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
30 | if [ -z "$DAV_BIN" ]; |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
31 | then |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
32 | echo "DAV_BIN variable not set" |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
33 | exit 1 |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
34 | fi |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
35 | if [ -z "$DAV_SYNC_BIN" ]; |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
36 | then |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
37 | echo "DAV_BIN variable not set" |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
38 | exit 1 |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
39 | fi |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
40 | |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
41 | # checks if tmp-sync/out.txt contains a specific text |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
42 | # arg1: pattern |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
43 | # arg2: errormsg |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
44 | check_tmpout() |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
45 | { |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
46 | TEST=`cat tmp-sync/out.txt | grep "$1"` |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
47 | if [ $? -ne 0 ]; |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
48 | then |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
49 | echo "$2" |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
50 | exit 2 |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
51 | fi |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
52 | } |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
53 | |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
54 | # do dav-sync push and check return value |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
55 | # arg1: dir |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
56 | # arg2: errormsg |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
57 | dav_sync_push() |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
58 | { |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
59 | $DAV_SYNC_BIN push $1 > tmp-sync/out.txt |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
60 | if [ $? -ne 0 ]; |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
61 | then |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
62 | echo "$2" |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
63 | exit 2 |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
64 | fi |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
65 | } |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
66 | # do dav-sync pull and check return value |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
67 | # arg1: dir |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
68 | # arg2: errormsg |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
69 | dav_sync_pull() |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
70 | { |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
71 | $DAV_SYNC_BIN pull $1 > tmp-sync/out.txt |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
72 | if [ $? -ne 0 ]; |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
73 | then |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
74 | echo "$2" |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
75 | exit 2 |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
76 | fi |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
77 | } |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
78 | |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
79 | rm -f .dav/dav-sync-tests-test2a-db.xml |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
80 | rm -f .dav/dav-sync-tests-test2b-db.xml |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
81 | |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
82 | $DAV_BIN rm dav-test-repo/sync/test2 2> /dev/null |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
83 | |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
84 | $DAV_BIN mkcol dav-test-repo/sync/test2 2> /dev/null |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
85 | |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
86 | # tmp sync dir |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
87 | rm -Rf tmp-sync |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
88 | mkdir tmp-sync |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
89 | mkdir tmp-sync/test2a |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
90 | mkdir tmp-sync/test2b |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
91 | |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
92 | # ---------------------------------------------------------------------------- |
638
b3077bdb3d77
fix hash based conflict detection
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
637
diff
changeset
|
93 | # 1. test: add 4 files, push, pull (not really an hashing test) |
637
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
94 | # expected result: 4 files pushed, 4 files pulled |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
95 | |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
96 | mkdir tmp-sync/test2a/dir1/ |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
97 | mkdir tmp-sync/test2a/dir1/subdir1/ |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
98 | |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
99 | cp synctest/file1 tmp-sync/test2a/ |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
100 | cp synctest/file2 tmp-sync/test2a/dir1/ |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
101 | cp synctest/file3 tmp-sync/test2a/dir1/subdir1 |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
102 | cp synctest/file4 tmp-sync/test2a/dir1/subdir1 |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
103 | |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
104 | dav_sync_push test2a "test 1: push failed" |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
105 | check_tmpout "4 files pushed" "test 1: wrong push counter" |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
106 | check_tmpout "0 conflicts" "test 1: wrong conflict counter (push)" |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
107 | check_tmpout "0 errors" "test 1: wrong error counter (push)" |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
108 | |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
109 | dav_sync_pull test2b "test 1: pull failed" |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
110 | check_tmpout "4 files pulled" "test 1: wrong pull counter" |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
111 | check_tmpout "0 conflicts" "test 1: wrong conflict counter (pull)" |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
112 | check_tmpout "0 errors" "test 1: wrong error counter (pull)" |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
113 | |
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
114 | |
638
b3077bdb3d77
fix hash based conflict detection
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
637
diff
changeset
|
115 | # ---------------------------------------------------------------------------- |
b3077bdb3d77
fix hash based conflict detection
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
637
diff
changeset
|
116 | # 2. test: touch 2 files, push |
b3077bdb3d77
fix hash based conflict detection
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
637
diff
changeset
|
117 | # expected result: 0 files pushed |
637
20241338740c
add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
118 | |
638
b3077bdb3d77
fix hash based conflict detection
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
637
diff
changeset
|
119 | sleep 3 |
b3077bdb3d77
fix hash based conflict detection
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
637
diff
changeset
|
120 | |
b3077bdb3d77
fix hash based conflict detection
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
637
diff
changeset
|
121 | touch tmp-sync/test2a/file1 |
b3077bdb3d77
fix hash based conflict detection
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
637
diff
changeset
|
122 | touch tmp-sync/test2a/dir1/file2 |
b3077bdb3d77
fix hash based conflict detection
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
637
diff
changeset
|
123 | |
b3077bdb3d77
fix hash based conflict detection
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
637
diff
changeset
|
124 | dav_sync_push test2a "test 2: push failed" |
b3077bdb3d77
fix hash based conflict detection
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
637
diff
changeset
|
125 | check_tmpout "0 files pushed" "test 2: wrong push counter" |
b3077bdb3d77
fix hash based conflict detection
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
637
diff
changeset
|
126 | check_tmpout "0 conflicts" "test 2: wrong conflict counter" |
b3077bdb3d77
fix hash based conflict detection
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
637
diff
changeset
|
127 | check_tmpout "0 errors" "test 2: wrong error counter" |
b3077bdb3d77
fix hash based conflict detection
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
637
diff
changeset
|
128 | |
b3077bdb3d77
fix hash based conflict detection
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
637
diff
changeset
|
129 | |
b3077bdb3d77
fix hash based conflict detection
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
637
diff
changeset
|
130 | # ---------------------------------------------------------------------------- |
b3077bdb3d77
fix hash based conflict detection
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
637
diff
changeset
|
131 | # 3. test: copy fil1 to test2a again |
b3077bdb3d77
fix hash based conflict detection
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
637
diff
changeset
|
132 | # expected result: 0 files pushed |
b3077bdb3d77
fix hash based conflict detection
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
637
diff
changeset
|
133 | |
b3077bdb3d77
fix hash based conflict detection
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
637
diff
changeset
|
134 | sleep 3 |
b3077bdb3d77
fix hash based conflict detection
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
637
diff
changeset
|
135 | |
b3077bdb3d77
fix hash based conflict detection
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
637
diff
changeset
|
136 | cp synctest/file1 tmp-sync/test2a/ |
b3077bdb3d77
fix hash based conflict detection
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
637
diff
changeset
|
137 | |
b3077bdb3d77
fix hash based conflict detection
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
637
diff
changeset
|
138 | dav_sync_push test2a "test 3: push failed" |
b3077bdb3d77
fix hash based conflict detection
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
637
diff
changeset
|
139 | check_tmpout "0 files pushed" "test 3: wrong push counter" |
b3077bdb3d77
fix hash based conflict detection
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
637
diff
changeset
|
140 | check_tmpout "0 conflicts" "test 3: wrong conflict counter" |
b3077bdb3d77
fix hash based conflict detection
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
637
diff
changeset
|
141 | check_tmpout "0 errors" "test 3: wrong error counter" |
b3077bdb3d77
fix hash based conflict detection
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
637
diff
changeset
|
142 | |
b3077bdb3d77
fix hash based conflict detection
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
637
diff
changeset
|
143 | |
b3077bdb3d77
fix hash based conflict detection
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
637
diff
changeset
|
144 | # ---------------------------------------------------------------------------- |
b3077bdb3d77
fix hash based conflict detection
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
637
diff
changeset
|
145 | # 4. test: change content but don't change mtime |
b3077bdb3d77
fix hash based conflict detection
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
637
diff
changeset
|
146 | # expected result: 1 file pushed |
b3077bdb3d77
fix hash based conflict detection
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
637
diff
changeset
|
147 | |
b3077bdb3d77
fix hash based conflict detection
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
637
diff
changeset
|
148 | # modify file and mtime to update mtime in the database |
b3077bdb3d77
fix hash based conflict detection
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
637
diff
changeset
|
149 | echo "test4-change1-a" >> tmp-sync/test2a/file1 |
b3077bdb3d77
fix hash based conflict detection
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
637
diff
changeset
|
150 | touch -t 01011200 tmp-sync/test2a/file1 |
b3077bdb3d77
fix hash based conflict detection
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
637
diff
changeset
|
151 | |
b3077bdb3d77
fix hash based conflict detection
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
637
diff
changeset
|
152 | dav_sync_push test2a "test 4: push failed (1)" |
b3077bdb3d77
fix hash based conflict detection
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
637
diff
changeset
|
153 | check_tmpout "1 file pushed" "test 4: wrong push counter (1)" |
b3077bdb3d77
fix hash based conflict detection
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
637
diff
changeset
|
154 | check_tmpout "0 conflicts" "test 4: wrong conflict counter (1)" |
b3077bdb3d77
fix hash based conflict detection
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
637
diff
changeset
|
155 | check_tmpout "0 errors" "test 4: wrong error counter (1)" |
b3077bdb3d77
fix hash based conflict detection
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
637
diff
changeset
|
156 | |
b3077bdb3d77
fix hash based conflict detection
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
637
diff
changeset
|
157 | # modify file again and set mtime to same value |
b3077bdb3d77
fix hash based conflict detection
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
637
diff
changeset
|
158 | echo "test4-change2-a" >> tmp-sync/test2a/file1 |
b3077bdb3d77
fix hash based conflict detection
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
637
diff
changeset
|
159 | touch -t 01011200 tmp-sync/test2a/file1 |
b3077bdb3d77
fix hash based conflict detection
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
637
diff
changeset
|
160 | |
b3077bdb3d77
fix hash based conflict detection
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
637
diff
changeset
|
161 | dav_sync_push test2a "test 4: push failed (2)" |
b3077bdb3d77
fix hash based conflict detection
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
637
diff
changeset
|
162 | check_tmpout "1 file pushed" "test 4: wrong push counter (2)" |
b3077bdb3d77
fix hash based conflict detection
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
637
diff
changeset
|
163 | check_tmpout "0 conflicts" "test 4: wrong conflict counter (2)" |
b3077bdb3d77
fix hash based conflict detection
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
637
diff
changeset
|
164 | check_tmpout "0 errors" "test 4: wrong error counter (2)" |
639
928a77ebe0b9
fix that file uploads are tried, when the content on the server is equal to the local file content (with enabled hashing)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
638
diff
changeset
|
165 | |
928a77ebe0b9
fix that file uploads are tried, when the content on the server is equal to the local file content (with enabled hashing)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
638
diff
changeset
|
166 | |
928a77ebe0b9
fix that file uploads are tried, when the content on the server is equal to the local file content (with enabled hashing)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
638
diff
changeset
|
167 | # ---------------------------------------------------------------------------- |
928a77ebe0b9
fix that file uploads are tried, when the content on the server is equal to the local file content (with enabled hashing)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
638
diff
changeset
|
168 | # 5. test: set same content on both sides |
928a77ebe0b9
fix that file uploads are tried, when the content on the server is equal to the local file content (with enabled hashing)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
638
diff
changeset
|
169 | # expected result: no conflict |
928a77ebe0b9
fix that file uploads are tried, when the content on the server is equal to the local file content (with enabled hashing)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
638
diff
changeset
|
170 | |
928a77ebe0b9
fix that file uploads are tried, when the content on the server is equal to the local file content (with enabled hashing)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
638
diff
changeset
|
171 | # prepare test2b |
928a77ebe0b9
fix that file uploads are tried, when the content on the server is equal to the local file content (with enabled hashing)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
638
diff
changeset
|
172 | dav_sync_pull test2b "test 5: pull failed" |
928a77ebe0b9
fix that file uploads are tried, when the content on the server is equal to the local file content (with enabled hashing)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
638
diff
changeset
|
173 | check_tmpout "1 file pulled" "test 5: wrong pull counter" |
928a77ebe0b9
fix that file uploads are tried, when the content on the server is equal to the local file content (with enabled hashing)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
638
diff
changeset
|
174 | check_tmpout "0 conflicts" "test 5: wrong conflict counter (prepare)" |
928a77ebe0b9
fix that file uploads are tried, when the content on the server is equal to the local file content (with enabled hashing)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
638
diff
changeset
|
175 | check_tmpout "0 errors" "test 5: wrong error counter (prepare)" |
928a77ebe0b9
fix that file uploads are tried, when the content on the server is equal to the local file content (with enabled hashing)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
638
diff
changeset
|
176 | |
928a77ebe0b9
fix that file uploads are tried, when the content on the server is equal to the local file content (with enabled hashing)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
638
diff
changeset
|
177 | # change content on both sides |
928a77ebe0b9
fix that file uploads are tried, when the content on the server is equal to the local file content (with enabled hashing)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
638
diff
changeset
|
178 | echo "test5-change" >> tmp-sync/test2a/file1 |
928a77ebe0b9
fix that file uploads are tried, when the content on the server is equal to the local file content (with enabled hashing)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
638
diff
changeset
|
179 | echo "test5-change" >> tmp-sync/test2b/file1 |
928a77ebe0b9
fix that file uploads are tried, when the content on the server is equal to the local file content (with enabled hashing)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
638
diff
changeset
|
180 | |
928a77ebe0b9
fix that file uploads are tried, when the content on the server is equal to the local file content (with enabled hashing)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
638
diff
changeset
|
181 | # push both sides |
928a77ebe0b9
fix that file uploads are tried, when the content on the server is equal to the local file content (with enabled hashing)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
638
diff
changeset
|
182 | dav_sync_push test2a "test 5: push failed (test2a)" |
928a77ebe0b9
fix that file uploads are tried, when the content on the server is equal to the local file content (with enabled hashing)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
638
diff
changeset
|
183 | check_tmpout "1 file pushed" "test 5: wrong push counter (test2a)" |
928a77ebe0b9
fix that file uploads are tried, when the content on the server is equal to the local file content (with enabled hashing)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
638
diff
changeset
|
184 | check_tmpout "0 conflicts" "test 5: wrong conflict counter (test2a)" |
928a77ebe0b9
fix that file uploads are tried, when the content on the server is equal to the local file content (with enabled hashing)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
638
diff
changeset
|
185 | check_tmpout "0 errors" "test 5: wrong error counter (test2a)" |
928a77ebe0b9
fix that file uploads are tried, when the content on the server is equal to the local file content (with enabled hashing)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
638
diff
changeset
|
186 | |
928a77ebe0b9
fix that file uploads are tried, when the content on the server is equal to the local file content (with enabled hashing)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
638
diff
changeset
|
187 | dav_sync_push test2b "test 5: push failed (test2b)" |
928a77ebe0b9
fix that file uploads are tried, when the content on the server is equal to the local file content (with enabled hashing)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
638
diff
changeset
|
188 | # don't check push counter |
928a77ebe0b9
fix that file uploads are tried, when the content on the server is equal to the local file content (with enabled hashing)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
638
diff
changeset
|
189 | check_tmpout "0 conflicts" "test 5: wrong conflict counter (test2b)" |
928a77ebe0b9
fix that file uploads are tried, when the content on the server is equal to the local file content (with enabled hashing)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
638
diff
changeset
|
190 | check_tmpout "0 errors" "test 5: wrong error counter (test2b)" |