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

Mon, 16 Sep 2019 19:49:04 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Mon, 16 Sep 2019 19:49:04 +0200
changeset 642
4e23087d3d90
parent 637
20241338740c
child 643
5b8643cf0a2f
permissions
-rwxr-xr-x

add config element for push strategy

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
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
180 if [ $? -ne 0 ]; then
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
181 echo "test 3: delete-conflicts failed"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
182 exit 2
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
183 fi
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
184 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
185 if [ $? -ne 0 ];
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
186 then
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
187 echo "test 3: wrong delete-conflicts output"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
188 exit 2
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
189 fi
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
190
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
191 TEST1B_COUNT3=`ls tmp-sync/test1b/ | wc -l`
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
192
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
193 if [ $TEST1B_COUNT1 != $TEST1B_COUNT3 ]; then
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
194 echo "test 3: file not removed"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
195 exit 2
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
196 fi
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
197
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 # 4. test: pull after deleted conflicts
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
200 # expected result: 0 files pulled, 0 conflicts
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
201
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
202 dav_sync_pull test1b "test 4: pull failed"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
203 check_tmpout "0 files pulled" "test 4: wrong pull counter"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
204 check_tmpout "0 conflicts" "test 4: wrong conflict counter"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
205 check_tmpout "0 errors" "test 4: wrong error counter"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
206
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 # 5. test: pull, local file also modified, delete-conflicts
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
209 # 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
210 # expected result: 0 files pulled, 0 conflicts
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
211
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
212 sleep 3 # make sure mtime changes
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
213
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
214 echo "conflict1-test5" >> tmp-sync/test1a/file1
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
215 dav_sync_push test1a "prepare: push failed"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
216 check_tmpout "1 file pushed" "test 1: wrong push counter"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
217
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
218 echo "conflict1-test5-conflict" >> tmp-sync/test1b/file1
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
219 dav_sync_pull test1b "prepare: pull failed"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
220 check_tmpout "1 file pulled" "test 1: wrong pull counter"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
221 check_tmpout "1 conflict" "test 1: wrong conflict counter"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
222 check_tmpout "0 errors" "test 1: wrong error counter"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
223
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
224 $DAV_SYNC_BIN delete-conflicts test1b > tmp-sync/out.txt
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
225 if [ $? -ne 0 ]; then
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
226 echo "test 3: delete-conflicts failed"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
227 exit 2
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
228 fi
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
229 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
230 if [ $? -ne 0 ];
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
231 then
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
232 echo "test 3: wrong delete-conflicts output"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
233 exit 2
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
234 fi
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
235
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 # 6. test: push after deleted conflicts
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
239 # expected result: 0 files pushed, 0 conflicts
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
240
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
241 dav_sync_push test1b "test 6: push failed"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
242 check_tmpout "0 files pushed" "test 6: wrong push counter"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
243 check_tmpout "0 conflicts" "test 6: wrong conflict counter"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
244 check_tmpout "0 errors" "test 6: wrong error counter"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
245
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 # 7. test: resolve-conflicts after pull, followed by push
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
249 # expected result: pull with 1 conflict, resolve-conflicts removes conflicts
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
250 # from db (list-conflicts doesn't show conflicts after that)
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
251
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
252 sleep 3 # make sure mtime changes
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
253
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
254 echo "conflict1-test7" >> tmp-sync/test1a/file1
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
255 dav_sync_push test1a "prepare: push failed"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
256 check_tmpout "1 file pushed" "test 7: wrong push counter"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
257
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
258 echo "conflict1-test7-conflict" >> tmp-sync/test1b/file1
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
259 dav_sync_pull test1b "prepare: pull failed"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
260 check_tmpout "1 file pulled" "test 7: wrong pull counter"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
261 check_tmpout "1 conflict" "test 7: wrong conflict counter"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
262 check_tmpout "0 errors" "test 7: wrong error counter"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
263
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
264 TEST1B_COUNT_T7_1=`ls tmp-sync/test1b/ | wc -l`
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
265
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
266 $DAV_SYNC_BIN resolve-conflicts test1b > tmp-sync/out.txt
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
267 if [ $? -ne 0 ]; then
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
268 echo "test 7: resolve-conflicts failed"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
269 exit 2
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
270 fi
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
271 TEST=`cat tmp-sync/out.txt | grep "1 conflict resolved"`
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
272 if [ $? -ne 0 ];
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
273 then
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
274 echo "test 7: wrong resolve-conflicts output"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
275 exit 2
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
276 fi
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
277
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
278 TEST1B_COUNT_T7_2=`ls tmp-sync/test1b/ | wc -l`
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
279
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
280 if [ $TEST1B_COUNT_T7_1 != $TEST1B_COUNT_T7_2 ]; then
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
281 echo "test 7: number of files has changed"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
282 exit 2
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
283 fi
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
284
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
285 TEST7=`dav-sync list-conflicts test1b | wc -l`
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
286 if [ $TEST7 != "0" ]; then
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
287 echo "test 7: list-conflicts must not show conflicts"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
288 return 2
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
289 fi
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
290
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
291 # pull again, should do nothing
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
292
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
293 dav_sync_pull test1b "test 7: pull(2) failed"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
294 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
295 check_tmpout "0 conflicts" "test 7: wrong conflict counter (2)"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
296 check_tmpout "0 errors" "test 7: wrong error counter (2)"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
297
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 # 8. test: resolve-conflicts after pull, followed by push
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
300 # expected result: pull with 1 conflict, resolve-conflicts removes conflicts
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
301 # from db (list-conflicts doesn't show conflicts after that)
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
302
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
303 # test mostly the same as test 7
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
304
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
305 sleep 3 # make sure mtime changes
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
306
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
307 echo "conflict1-test8" >> tmp-sync/test1a/file1
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
308 dav_sync_push test1a "prepare: push failed"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
309 check_tmpout "1 file pushed" "test 8: wrong push counter"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
310
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
311 echo "conflict1-test8-conflict" >> tmp-sync/test1b/file1
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
312 dav_sync_pull test1b "prepare: pull failed"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
313 check_tmpout "1 file pulled" "test 8: wrong pull counter"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
314 check_tmpout "1 conflict" "test 8: wrong conflict counter"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
315 check_tmpout "0 errors" "test 8: wrong error counter"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
316
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
317 TEST1B_COUNT_T7_1=`ls tmp-sync/test1b/ | wc -l`
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
318
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
319 $DAV_SYNC_BIN resolve-conflicts test1b > tmp-sync/out.txt
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
320 if [ $? -ne 0 ]; then
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
321 echo "test 8: resolve-conflicts failed"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
322 exit 2
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
323 fi
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
324 TEST=`cat tmp-sync/out.txt | grep "1 conflict resolved"`
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
325 if [ $? -ne 0 ];
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
326 then
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
327 echo "test 8: wrong resolve-conflicts output"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
328 exit 2
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
329 fi
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
330
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
331 TEST1B_COUNT_T7_2=`ls tmp-sync/test1b/ | wc -l`
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
332
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
333 if [ $TEST1B_COUNT_T7_1 != $TEST1B_COUNT_T7_2 ]; then
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
334 echo "test 8: number of files has changed"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
335 exit 2
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
336 fi
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
337
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
338 TEST7=`dav-sync list-conflicts test1b | wc -l`
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
339 if [ $TEST7 != "0" ]; then
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
340 echo "test 8: list-conflicts must not show conflicts"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
341 return 2
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
342 fi
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
343
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
344 # 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
345
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
346 dav_sync_push test1b "test 8: push failed"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
347 check_tmpout "2 files pushed" "test 8: wrong push counter"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
348 check_tmpout "0 conflicts" "test 8: wrong conflicts counter"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
349 check_tmpout "0 errors" "test 8: wrong error counter"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
350
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
351 # push again, shoud do nothing
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
352 dav_sync_push test1b "test 8: push(2) failed"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
353 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
354 check_tmpout "0 conflicts" "test 8: wrong conflicts counter (2)"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
355 check_tmpout "0 errors" "test 8: wrong error counter (2)"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
356
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 # 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
360 # expected result: no delete
632
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
361
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
362 sleep 3 # make sure mtime changes
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
363
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
364 rm -f tmp-sync/test1a/file1
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
365
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
366 dav_sync_push test1a "test 9: push failed"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
367 check_tmpout "1 file deleted" "test 9: wrong delete counter"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
368 check_tmpout "0 conflicts" "test 9: wrong conflict counter"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
369
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
370 echo "conflict1-test9-conflict" >> tmp-sync/test1b/file1
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
371
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
372 dav_sync_pull test1b "test 9: pull failed"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
373 # don't check conflict counter
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
374 TEST=`cat tmp-sync/out.txt | grep "1 file deleted"`
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
375 if [ $? -eq 0 ];
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
376 then
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
377 echo "test 9: file1 deleted"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
378 exit 2
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
379 fi
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
380
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
381 cat tmp-sync/test1b/file1 > /dev/null 2>&1
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
382 if [ $? -ne 0 ]; then
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
383 echo "test 9: file1 deleted (2)"
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
384 exit 2
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
385 fi
2e1b59290829 rename conflict test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
386
634
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
387 # ----------------------------------------------------------------------------
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
388 # 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
389 # expected result: 1 delete
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
390
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
391 # 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
392
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
393 rm -f tmp-sync/test1a/dir2/subdir1/file3
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
394 rm -f tmp-sync/test1a/dir2/subdir1/file4
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
395
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
396 dav_sync_push test1a "test 10: push failed"
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
397 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
398 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
399
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
400 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
401
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
402 dav_sync_pull test1b "test 10: pull failed"
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
403 # don't check conflict counter
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
404 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
405
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
406 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
407 if [ $? -ne 0 ]; then
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
408 echo "test 10: file4 deleted"
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
409 exit 2
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
410 fi
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
411
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 # 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
415 # expected result: 1 remaining file
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
416
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
417 # 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
418
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
419 rm -Rf tmp-sync/test1a/dir1
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
420
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
421 dav_sync_push test1a "test 11: push failed"
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
422 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
423 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
424
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
425 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
426
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
427 dav_sync_pull test1b "test 11: pull failed"
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
428 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
429 check_tmpout "delete: " "test 11: no deletes (pull)"
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
430
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
431 TEST=`ls tmp-sync/test1b/dir1/ | wc -l`
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
432 if [ $TEST != "1" ]; then
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
433 echo "test 11: wrong file count"
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
434 exit 2
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
435 fi
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
436
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 # 12. test: test1a modifies file, test1b deletes file
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
440 # expected result: pull test1b restores deleted file
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
441
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
442 # 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
443
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
444 echo "modified" >> tmp-sync/test1a/file2
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
445
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
446 dav_sync_push test1a "test 12: push failed"
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
447 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
448 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
449 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
450
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
451 rm tmp-sync/test1b/file2
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
452
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
453 dav_sync_pull test1b "test 12: pull failed"
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
454 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
455 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
456 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
457
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
458 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
459 if [ $? -ne 0 ]; then
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
460 echo "test 12: file2 missing"
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
461 exit 2
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
462 fi
3ae1410b9d13 add more pull conflict tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 632
diff changeset
463
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

mercurial