Wed, 24 Jul 2024 23:45:31 +0200
fix dav add-repo crash in case .dav/config.xml doesn't exist
650
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1 | #!/bin/sh |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
2 | # |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
3 | # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
4 | # |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
5 | # Copyright 2019 Olaf Wintermann. All rights reserved. |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
6 | # |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
7 | # Redistribution and use in source and binary forms, with or without |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
8 | # modification, are permitted provided that the following conditions are met: |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
9 | # |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
10 | # 1. Redistributions of source code must retain the above copyright |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
11 | # notice, this list of conditions and the following disclaimer. |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
12 | # |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
13 | # 2. Redistributions in binary form must reproduce the above copyright |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
14 | # notice, this list of conditions and the following disclaimer in the |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
15 | # documentation and/or other materials provided with the distribution. |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
16 | # |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
17 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
18 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
19 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
20 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
21 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
22 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
23 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
24 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
25 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
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 |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
27 | # POSSIBILITY OF SUCH DAMAGE. |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
28 | # |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
29 | |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
30 | if [ -z "$DAV_BIN" ]; |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
31 | then |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
32 | echo "DAV_BIN variable not set" |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
33 | exit 1 |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
34 | fi |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
35 | if [ -z "$DAV_SYNC_BIN" ]; |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
36 | then |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
37 | echo "DAV_BIN variable not set" |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
38 | exit 1 |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
39 | fi |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
40 | |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
41 | # checks if tmp-sync/out.txt contains a specific text |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
42 | # arg1: pattern |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
43 | # arg2: errormsg |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
44 | check_tmpout() |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
45 | { |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
46 | TEST=`cat tmp-sync/out.txt | grep "$1"` |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
47 | if [ $? -ne 0 ]; |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
48 | then |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
49 | echo "$2" |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
50 | exit 2 |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
51 | fi |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
52 | } |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
53 | |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
54 | # do dav-sync push and check return value |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
55 | # arg1: dir |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
56 | # arg2: errormsg |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
57 | dav_sync_push() |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
58 | { |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
59 | $DAV_SYNC_BIN push $1 > tmp-sync/out.txt |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
60 | if [ $? -ne 0 ]; |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
61 | then |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
62 | echo "$2" |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
63 | exit 2 |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
64 | fi |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
65 | } |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
66 | # do dav-sync pull and check return value |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
67 | # arg1: dir |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
68 | # arg2: errormsg |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
69 | dav_sync_pull() |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
70 | { |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
71 | $DAV_SYNC_BIN pull $1 > tmp-sync/out.txt |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
72 | if [ $? -ne 0 ]; |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
73 | then |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
74 | echo "$2" |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
75 | exit 2 |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
76 | fi |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
77 | } |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
78 | |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
79 | rm -f .dav/dav-sync-tests-test2a-db.xml |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
80 | rm -f .dav/dav-sync-tests-test2b-db.xml |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
81 | |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
82 | $DAV_BIN rm dav-test-repo/sync/test2 2> /dev/null |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
83 | |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
84 | $DAV_BIN mkcol dav-test-repo/sync/test2 2> /dev/null |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
85 | |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
86 | # tmp sync dir |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
87 | rm -Rf tmp-sync |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
88 | mkdir tmp-sync |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
89 | mkdir tmp-sync/test2a |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
90 | mkdir tmp-sync/test2b |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
91 | |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
92 | # ---------------------------------------------------------------------------- |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
93 | # test 1: add 2 equal files |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
94 | # expected result: 2 files pushed |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
95 | |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
96 | mkdir tmp-sync/test2a/dir1/ |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
97 | mkdir tmp-sync/test2a/dir1/subdir1/ |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
98 | |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
99 | echo "equal-file" > tmp-sync/test2a/file1 |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
100 | echo "equal-file" > tmp-sync/test2a/file2 |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
101 | |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
102 | dav_sync_push test2a "test 1: push failed" |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
103 | check_tmpout "2 files pushed" "test 1: wrong push counter" |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
104 | check_tmpout "0 conflicts" "test 1: wrong conflict counter (push)" |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
105 | check_tmpout "0 errors" "test 1: wrong error counter (push)" |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
106 | |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
107 | dav_sync_pull test2b "test 1: pull failed" |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
108 | check_tmpout "2 files pulled" "test 1: wrong pull counter" |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
109 | check_tmpout "0 conflicts" "test 1: wrong conflict counter (pull)" |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
110 | check_tmpout "0 errors" "test 1: wrong error counter (pull)" |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
111 | |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
112 | |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
113 | # ---------------------------------------------------------------------------- |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
114 | # test 2: add file3 with same content, but change file1 and file2 |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
115 | # expected result: pull: no copy/move for file3 |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
116 | |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
117 | echo "equal-file" > tmp-sync/test2a/file3 |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
118 | |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
119 | echo "change-test2" >> tmp-sync/test2a/file1 |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
120 | echo "change-test2" >> tmp-sync/test2a/file2 |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
121 | |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
122 | sleep 2 # make sure the etag changes |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
123 | |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
124 | dav_sync_push test2a "test 2: push failed" |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
125 | check_tmpout "3 files pushed" "test 2: wrong push counter" |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
126 | check_tmpout "0 conflicts" "test 2: wrong conflict counter (push)" |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
127 | check_tmpout "0 errors" "test 2: wrong error counter (push)" |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
128 | |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
129 | dav_sync_pull test2b "test 3: pull failed" |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
130 | check_tmpout "3 files pulled" "test 2: wrong pull counter" |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
131 | check_tmpout "0 conflicts" "test 2: wrong conflict counter (pull)" |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
132 | check_tmpout "0 errors" "test 2: wrong error counter (pull)" |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
133 | |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
134 | diff tmp-sync/test2a/file1 tmp-sync/test2b/file1 > /dev/null 2>&1 |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
135 | if [ $? -ne 0 ]; then |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
136 | echo "test 2: file1 missing or wrong content" |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
137 | exit 2 |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
138 | fi |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
139 | diff tmp-sync/test2a/file2 tmp-sync/test2b/file2 > /dev/null 2>&1 |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
140 | if [ $? -ne 0 ]; then |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
141 | echo "test 2: file1 missing or wrong content" |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
142 | exit 2 |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
143 | fi |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
144 | diff tmp-sync/test2a/file3 tmp-sync/test2b/file3 > /dev/null 2>&1 |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
145 | if [ $? -ne 0 ]; then |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
146 | echo "test 2: file1 missing or wrong content" |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
147 | exit 2 |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
148 | fi |
14e7101d7604
fix some hash based conflict resolution bugs and add tests for it
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
149 |