test/bin-test/test-dav-sync-pull-conflict.sh

Wed, 24 Jul 2024 23:45:31 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Wed, 24 Jul 2024 23:45:31 +0200
changeset 826
b6e9fd3f1951
parent 762
098b2e3ab240
permissions
-rwxr-xr-x

fix dav add-repo crash in case .dav/config.xml doesn't exist

632
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1 #!/bin/sh
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
2 #
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
4 #
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
5 # Copyright 2019 Olaf Wintermann. All rights reserved.
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
6 #
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
7 # Redistribution and use in source and binary forms, with or without
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
8 # modification, are permitted provided that the following conditions are met:
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
9 #
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
10 # 1. Redistributions of source code must retain the above copyright
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
11 # notice, this list of conditions and the following disclaimer.
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
12 #
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
13 # 2. Redistributions in binary form must reproduce the above copyright
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
14 # notice, this list of conditions and the following disclaimer in the
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
15 # documentation and/or other materials provided with the distribution.
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
16 #
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
17 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
18 # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
19 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
20 # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
21 # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
22 # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
23 # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
24 # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
25 # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
2e1b59290829 rename conflict test script
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
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
27 # POSSIBILITY OF SUCH DAMAGE.
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
28 #
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
29
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
30 #
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
31 # Test dav-sync pull conflict detection
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
32 # and related commands
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
33 #
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
34
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
35 if [ -z "$DAV_BIN" ];
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
36 then
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
37 echo "DAV_BIN variable not set"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
38 exit 1
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
39 fi
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
40 if [ -z "$DAV_SYNC_BIN" ];
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
41 then
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
42 echo "DAV_BIN variable not set"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
43 exit 1
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
44 fi
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
45
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
46 # checks if tmp-sync/out.txt contains a specific text
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
47 # arg1: pattern
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
48 # arg2: errormsg
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
49 check_tmpout()
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
50 {
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
51 TEST=`cat tmp-sync/out.txt | grep "$1"`
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
52 if [ $? -ne 0 ];
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
53 then
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
54 echo "$2"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
55 exit 2
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
56 fi
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
57 }
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
58
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
59 # do dav-sync push and check return value
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
60 # arg1: dir
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
61 # arg2: errormsg
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
62 dav_sync_push()
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
63 {
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
64 $DAV_SYNC_BIN push $1 > tmp-sync/out.txt
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
65 if [ $? -ne 0 ];
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
66 then
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
67 echo "$2"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
68 exit 2
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
69 fi
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
70 }
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
71 # do dav-sync pull and check return value
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
72 # arg1: dir
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
73 # arg2: errormsg
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
74 dav_sync_pull()
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
75 {
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
76 $DAV_SYNC_BIN pull $1 > tmp-sync/out.txt
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
77 if [ $? -ne 0 ];
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
78 then
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
79 echo "$2"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
80 exit 2
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
81 fi
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
82 }
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
83
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
84 rm -f .dav/dav-sync-tests-test1a-db.xml
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
85 rm -f .dav/dav-sync-tests-test1b-db.xml
637
20241338740c add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 635
diff changeset
86 rm -f .dav/dav-sync-tests-test2a-db.xml
20241338740c add first dav-sync hashing test
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 635
diff changeset
87 rm -f .dav/dav-sync-tests-test2b-db.xml
632
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
88
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
89 $DAV_BIN rm dav-test-repo/sync/test1 2> /dev/null
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
90 $DAV_BIN rm dav-test-repo/sync/test2 2> /dev/null
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
91
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
92 $DAV_BIN mkcol dav-test-repo/sync/test1 2> /dev/null
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
93 $DAV_BIN mkcol dav-test-repo/sync/test2 2> /dev/null
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
94
635
a6b1ec1b7ba0 add push conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 634
diff changeset
95 # tmp sync dir
a6b1ec1b7ba0 add push conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 634
diff changeset
96 rm -Rf tmp-sync
a6b1ec1b7ba0 add push conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 634
diff changeset
97 mkdir tmp-sync
a6b1ec1b7ba0 add push conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 634
diff changeset
98 mkdir tmp-sync/test1a
a6b1ec1b7ba0 add push conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 634
diff changeset
99 mkdir tmp-sync/test1b
a6b1ec1b7ba0 add push conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 634
diff changeset
100
632
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
101 # prepare
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
102 cp synctest/file1 tmp-sync/test1a
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
103 cp synctest/file2 tmp-sync/test1a
634
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
104
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
105 mkdir tmp-sync/test1a/dir1/
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
106 mkdir tmp-sync/test1a/dir2/
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
107 mkdir tmp-sync/test1a/dir1/subdir1/
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
108 mkdir tmp-sync/test1a/dir2/subdir1/
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
109
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
110 cp synctest/file1 tmp-sync/test1a/dir1/
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
111 cp synctest/file2 tmp-sync/test1a/dir1/
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
112 cp synctest/file3 tmp-sync/test1a/dir1/
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
113 cp synctest/file4 tmp-sync/test1a/dir1/
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
114
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
115 cp synctest/file1 tmp-sync/test1a/dir2/
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
116 cp synctest/file2 tmp-sync/test1a/dir2/
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
117 cp synctest/file3 tmp-sync/test1a/dir2/subdir1/
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
118 cp synctest/file4 tmp-sync/test1a/dir2/subdir1/
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
119
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
120 cp synctest/file1 tmp-sync/test1a/dir1/subdir1/
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
121 cp synctest/file2 tmp-sync/test1a/dir1/subdir1/
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
122 cp synctest/file3 tmp-sync/test1a/dir1/subdir1/
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
123 cp synctest/file4 tmp-sync/test1a/dir1/subdir1/
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
124 cp synctest/empty1 tmp-sync/test1a/dir1/subdir1/
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
125 cp synctest/empty2 tmp-sync/test1a/dir1/subdir1/
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
126
632
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
127 dav_sync_push test1a "prepare: push failed"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
128 dav_sync_pull test1b "prepare: pull failed"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
129 sleep 3
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
130
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
131 # ----------------------------------------------------------------------------
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
132 # 1. test: pull, local file also modified
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
133 # expected result: 1 conflict
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
134
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
135 echo "conflict1-test1" >> tmp-sync/test1a/file1
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
136 dav_sync_push test1a "prepare: push failed"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
137 check_tmpout "1 file pushed" "test 1: wrong push counter"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
138
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
139 TEST1B_COUNT1=`ls tmp-sync/test1b/ | wc -l`
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
140
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
141 echo "conflict1-test1-conflict" >> tmp-sync/test1b/file1
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
142 dav_sync_pull test1b "prepare: pull failed"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
143 check_tmpout "1 file pulled" "test 1: wrong pull counter"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
144 check_tmpout "1 conflict" "test 1: wrong conflict counter"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
145 check_tmpout "0 errors" "test 1: wrong error counter"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
146
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
147 TEST1B_COUNT2=`ls tmp-sync/test1b/ | wc -l`
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
148 # check if the conflict file was moved
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
149 if [ $TEST1B_COUNT1 = $TEST1B_COUNT2 ]; then
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
150 echo "test 1: conflict file not renamed"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
151 exit 2
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
152 fi
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
153
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
154 # warning: never check if the moved conflict file has a specific
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
155 # name like "orig.0.file1"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
156
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
157 # ----------------------------------------------------------------------------
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
158 # 2. test: check list-conflicts command
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
159 # expected result: "/file1" output
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
160
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
161 $DAV_SYNC_BIN list-conflicts test1b > tmp-sync/out.txt
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
162 if [ $? -ne 0 ]; then
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
163 echo "test 2: list-conflicts failed"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
164 exit 2
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
165 fi
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
166 TEST=`cat tmp-sync/out.txt | grep "/file1"`
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
167 if [ $? -ne 0 ];
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
168 then
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
169 echo "test 2: wrong list-conflicts output"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
170 exit 2
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
171 fi
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
172
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
173 # ----------------------------------------------------------------------------
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
174 # 3. test: check delete-conflicts command
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
175 # expected result: conflict file ("/orig.0.file1") deleted
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
176
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
177 # don't check if the conflict file has this specific name
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
178
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
179 $DAV_SYNC_BIN delete-conflicts test1b > tmp-sync/out.txt
762
098b2e3ab240 fix iterator misuse in dav-sync delete-conflict
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 643
diff changeset
180
632
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
181 if [ $? -ne 0 ]; then
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
182 echo "test 3: delete-conflicts failed"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
183 exit 2
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
184 fi
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
185 TEST=`cat tmp-sync/out.txt | grep "1 conflict file deleted"`
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
186 if [ $? -ne 0 ];
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
187 then
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
188 echo "test 3: wrong delete-conflicts output"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
189 exit 2
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
190 fi
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
191
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
192 TEST1B_COUNT3=`ls tmp-sync/test1b/ | wc -l`
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
193
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
194 if [ $TEST1B_COUNT1 != $TEST1B_COUNT3 ]; then
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
195 echo "test 3: file not removed"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
196 exit 2
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
197 fi
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
198
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
199 # ----------------------------------------------------------------------------
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
200 # 4. test: pull after deleted conflicts
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
201 # expected result: 0 files pulled, 0 conflicts
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
202
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
203 dav_sync_pull test1b "test 4: pull failed"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
204 check_tmpout "0 files pulled" "test 4: wrong pull counter"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
205 check_tmpout "0 conflicts" "test 4: wrong conflict counter"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
206 check_tmpout "0 errors" "test 4: wrong error counter"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
207
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
208 # ----------------------------------------------------------------------------
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
209 # 5. test: pull, local file also modified, delete-conflicts
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
210 # this test prepares test 6, to test 'push' after 'delete-conflicts'
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
211 # expected result: 0 files pulled, 0 conflicts
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
212
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
213 sleep 3 # make sure mtime changes
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
214
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
215 echo "conflict1-test5" >> tmp-sync/test1a/file1
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
216 dav_sync_push test1a "prepare: push failed"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
217 check_tmpout "1 file pushed" "test 1: wrong push counter"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
218
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
219 echo "conflict1-test5-conflict" >> tmp-sync/test1b/file1
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
220 dav_sync_pull test1b "prepare: pull failed"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
221 check_tmpout "1 file pulled" "test 1: wrong pull counter"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
222 check_tmpout "1 conflict" "test 1: wrong conflict counter"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
223 check_tmpout "0 errors" "test 1: wrong error counter"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
224
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
225 $DAV_SYNC_BIN delete-conflicts test1b > tmp-sync/out.txt
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
226 if [ $? -ne 0 ]; then
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
227 echo "test 3: delete-conflicts failed"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
228 exit 2
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
229 fi
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
230 TEST=`cat tmp-sync/out.txt | grep "1 conflict file deleted"`
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
231 if [ $? -ne 0 ];
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
232 then
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
233 echo "test 3: wrong delete-conflicts output"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
234 exit 2
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
235 fi
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
236
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
237
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
238 # ----------------------------------------------------------------------------
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
239 # 6. test: push after deleted conflicts
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
240 # expected result: 0 files pushed, 0 conflicts
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
241
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
242 dav_sync_push test1b "test 6: push failed"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
243 check_tmpout "0 files pushed" "test 6: wrong push counter"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
244 check_tmpout "0 conflicts" "test 6: wrong conflict counter"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
245 check_tmpout "0 errors" "test 6: wrong error counter"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
246
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
247
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
248 # ----------------------------------------------------------------------------
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
249 # 7. test: resolve-conflicts after pull, followed by push
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
250 # expected result: pull with 1 conflict, resolve-conflicts removes conflicts
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
251 # from db (list-conflicts doesn't show conflicts after that)
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
252
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
253 sleep 3 # make sure mtime changes
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
254
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
255 echo "conflict1-test7" >> tmp-sync/test1a/file1
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
256 dav_sync_push test1a "prepare: push failed"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
257 check_tmpout "1 file pushed" "test 7: wrong push counter"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
258
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
259 echo "conflict1-test7-conflict" >> tmp-sync/test1b/file1
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
260 dav_sync_pull test1b "prepare: pull failed"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
261 check_tmpout "1 file pulled" "test 7: wrong pull counter"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
262 check_tmpout "1 conflict" "test 7: wrong conflict counter"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
263 check_tmpout "0 errors" "test 7: wrong error counter"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
264
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
265 TEST1B_COUNT_T7_1=`ls tmp-sync/test1b/ | wc -l`
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
266
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
267 $DAV_SYNC_BIN resolve-conflicts test1b > tmp-sync/out.txt
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
268 if [ $? -ne 0 ]; then
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
269 echo "test 7: resolve-conflicts failed"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
270 exit 2
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
271 fi
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
272 TEST=`cat tmp-sync/out.txt | grep "1 conflict resolved"`
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
273 if [ $? -ne 0 ];
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
274 then
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
275 echo "test 7: wrong resolve-conflicts output"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
276 exit 2
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
277 fi
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
278
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
279 TEST1B_COUNT_T7_2=`ls tmp-sync/test1b/ | wc -l`
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
280
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
281 if [ $TEST1B_COUNT_T7_1 != $TEST1B_COUNT_T7_2 ]; then
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
282 echo "test 7: number of files has changed"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
283 exit 2
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
284 fi
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
285
643
5b8643cf0a2f implement hash push strategy and add some tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 637
diff changeset
286 TEST7=`$DAV_SYNC_BIN list-conflicts test1b | wc -l`
632
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
287 if [ $TEST7 != "0" ]; then
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
288 echo "test 7: list-conflicts must not show conflicts"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
289 return 2
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
290 fi
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
291
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
292 # pull again, should do nothing
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
293
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
294 dav_sync_pull test1b "test 7: pull(2) failed"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
295 check_tmpout "0 files pulled" "test 7: wrong pull counter (2)"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
296 check_tmpout "0 conflicts" "test 7: wrong conflict counter (2)"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
297 check_tmpout "0 errors" "test 7: wrong error counter (2)"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
298
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
299 # ----------------------------------------------------------------------------
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
300 # 8. test: resolve-conflicts after pull, followed by push
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
301 # expected result: pull with 1 conflict, resolve-conflicts removes conflicts
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
302 # from db (list-conflicts doesn't show conflicts after that)
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
303
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
304 # test mostly the same as test 7
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
305
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
306 sleep 3 # make sure mtime changes
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
307
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
308 echo "conflict1-test8" >> tmp-sync/test1a/file1
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
309 dav_sync_push test1a "prepare: push failed"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
310 check_tmpout "1 file pushed" "test 8: wrong push counter"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
311
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
312 echo "conflict1-test8-conflict" >> tmp-sync/test1b/file1
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
313 dav_sync_pull test1b "prepare: pull failed"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
314 check_tmpout "1 file pulled" "test 8: wrong pull counter"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
315 check_tmpout "1 conflict" "test 8: wrong conflict counter"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
316 check_tmpout "0 errors" "test 8: wrong error counter"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
317
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
318 TEST1B_COUNT_T7_1=`ls tmp-sync/test1b/ | wc -l`
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
319
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
320 $DAV_SYNC_BIN resolve-conflicts test1b > tmp-sync/out.txt
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
321 if [ $? -ne 0 ]; then
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
322 echo "test 8: resolve-conflicts failed"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
323 exit 2
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
324 fi
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
325 TEST=`cat tmp-sync/out.txt | grep "1 conflict resolved"`
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
326 if [ $? -ne 0 ];
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
327 then
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
328 echo "test 8: wrong resolve-conflicts output"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
329 exit 2
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
330 fi
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
331
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
332 TEST1B_COUNT_T7_2=`ls tmp-sync/test1b/ | wc -l`
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
333
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
334 if [ $TEST1B_COUNT_T7_1 != $TEST1B_COUNT_T7_2 ]; then
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
335 echo "test 8: number of files has changed"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
336 exit 2
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
337 fi
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
338
643
5b8643cf0a2f implement hash push strategy and add some tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 637
diff changeset
339 TEST7=`$DAV_SYNC_BIN list-conflicts test1b | wc -l`
632
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
340 if [ $TEST7 != "0" ]; then
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
341 echo "test 8: list-conflicts must not show conflicts"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
342 return 2
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
343 fi
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
344
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
345 # push, 2 resolved conflict files (test 7 and test 8 'orig' file)
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
346
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
347 dav_sync_push test1b "test 8: push failed"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
348 check_tmpout "2 files pushed" "test 8: wrong push counter"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
349 check_tmpout "0 conflicts" "test 8: wrong conflicts counter"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
350 check_tmpout "0 errors" "test 8: wrong error counter"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
351
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
352 # push again, shoud do nothing
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
353 dav_sync_push test1b "test 8: push(2) failed"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
354 check_tmpout "0 files pushed" "test 8: wrong push counter (2)"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
355 check_tmpout "0 conflicts" "test 8: wrong conflicts counter (2)"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
356 check_tmpout "0 errors" "test 8: wrong error counter (2)"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
357
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
358
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
359 # ----------------------------------------------------------------------------
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
360 # 9. test: test1a deleted file, test1b modified file
634
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
361 # expected result: no delete
632
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
362
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
363 sleep 3 # make sure mtime changes
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
364
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
365 rm -f tmp-sync/test1a/file1
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
366
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
367 dav_sync_push test1a "test 9: push failed"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
368 check_tmpout "1 file deleted" "test 9: wrong delete counter"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
369 check_tmpout "0 conflicts" "test 9: wrong conflict counter"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
370
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
371 echo "conflict1-test9-conflict" >> tmp-sync/test1b/file1
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
372
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
373 dav_sync_pull test1b "test 9: pull failed"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
374 # don't check conflict counter
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
375 TEST=`cat tmp-sync/out.txt | grep "1 file deleted"`
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
376 if [ $? -eq 0 ];
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
377 then
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
378 echo "test 9: file1 deleted"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
379 exit 2
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
380 fi
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
381
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
382 cat tmp-sync/test1b/file1 > /dev/null 2>&1
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
383 if [ $? -ne 0 ]; then
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
384 echo "test 9: file1 deleted (2)"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
385 exit 2
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
386 fi
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
387
634
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
388 # ----------------------------------------------------------------------------
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
389 # 10. test: test1a deleted 2 files in subdir, test1b modified one file
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
390 # expected result: 1 delete
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
391
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
392 # no sleep required, because we are working with other files
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
393
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
394 rm -f tmp-sync/test1a/dir2/subdir1/file3
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
395 rm -f tmp-sync/test1a/dir2/subdir1/file4
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
396
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
397 dav_sync_push test1a "test 10: push failed"
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
398 check_tmpout "2 files deleted" "test 10: wrong delete counter"
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
399 check_tmpout "0 conflicts" "test 9: wrong conflict counter"
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
400
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
401 echo "conflict1-test10-conflict" >> tmp-sync/test1b/dir2/subdir1/file4
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
402
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
403 dav_sync_pull test1b "test 10: pull failed"
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
404 # don't check conflict counter
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
405 check_tmpout "1 file deleted" "test 10: wrong delete counter"
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
406
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
407 cat tmp-sync/test1b/dir2/subdir1/file4 > /dev/null 2>&1
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
408 if [ $? -ne 0 ]; then
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
409 echo "test 10: file4 deleted"
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
410 exit 2
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
411 fi
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
412
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
413
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
414 # ----------------------------------------------------------------------------
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
415 # 11. test: delete dir in test1a, modify 1 file in test1b
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
416 # expected result: 1 remaining file
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
417
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
418 # no sleep required, because we are working with other files
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
419
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
420 rm -Rf tmp-sync/test1a/dir1
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
421
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
422 dav_sync_push test1a "test 11: push failed"
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
423 check_tmpout "0 conflicts" "test 11: wrong conflict counter (push)"
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
424 check_tmpout "0 errors" "test 11: wrong error counter (push)"
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
425
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
426 echo "conflict1-test11-conflict" >> tmp-sync/test1b/dir1/file3
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
427
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
428 dav_sync_pull test1b "test 11: pull failed"
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
429 check_tmpout "0 errors" "test 11: wrong error counter (pull)"
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
430 check_tmpout "delete: " "test 11: no deletes (pull)"
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
431
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
432 TEST=`ls tmp-sync/test1b/dir1/ | wc -l`
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
433 if [ $TEST != "1" ]; then
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
434 echo "test 11: wrong file count"
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
435 exit 2
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
436 fi
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
437
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
438
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
439 # ----------------------------------------------------------------------------
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
440 # 12. test: test1a modifies file, test1b deletes file
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
441 # expected result: pull test1b restores deleted file
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
442
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
443 # no sleep required, because we are working with other files
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
444
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
445 echo "modified" >> tmp-sync/test1a/file2
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
446
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
447 dav_sync_push test1a "test 12: push failed"
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
448 check_tmpout "1 file pushed" "test 12: wrong push counter"
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
449 check_tmpout "0 conflicts" "test 12: wrong conflict counter (push)"
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
450 check_tmpout "0 errors" "test 12: wrong error counter (push)"
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
451
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
452 rm tmp-sync/test1b/file2
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
453
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
454 dav_sync_pull test1b "test 12: pull failed"
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
455 check_tmpout "1 file pulled" "test 12: wrong pull counter"
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
456 check_tmpout "0 conflicts" "test 12: wrong conflict counter (pull)"
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
457 check_tmpout "0 errors" "test 12: wrong error counter (pull)"
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
458
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
459 cat tmp-sync/test1b/file2 > /dev/null 2>&1
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
460 if [ $? -ne 0 ]; then
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
461 echo "test 12: file2 missing"
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
462 exit 2
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
463 fi
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
464
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
465
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
466
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
467

mercurial