test/bin-test/test-dav-sync-push1.sh

Sun, 28 Jul 2019 13:07:53 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Sun, 28 Jul 2019 13:07:53 +0200
changeset 609
dc3d70848c7c
parent 587
3c917df041b8
child 620
a93374f1849a
permissions
-rwxr-xr-x

implement encrypted properties

571
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1 #!/bin/sh
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
2 #
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
4 #
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
5 # Copyright 2019 Olaf Wintermann. All rights reserved.
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
6 #
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
7 # Redistribution and use in source and binary forms, with or without
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
8 # modification, are permitted provided that the following conditions are met:
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
9 #
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
10 # 1. Redistributions of source code must retain the above copyright
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
11 # notice, this list of conditions and the following disclaimer.
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
12 #
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
13 # 2. Redistributions in binary form must reproduce the above copyright
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
14 # notice, this list of conditions and the following disclaimer in the
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
15 # documentation and/or other materials provided with the distribution.
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
16 #
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
17 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
18 # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
19 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
20 # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
21 # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
22 # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
23 # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
24 # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
25 # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
f6de48471c9c add first dav-sync binary tests
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
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
27 # POSSIBILITY OF SUCH DAMAGE.
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
28 #
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
29
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
30 if [ -z "$DAV_BIN" ];
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
31 then
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
32 echo "DAV_BIN variable not set"
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
33 exit 1
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
34 fi
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
35 if [ -z "$DAV_SYNC_BIN" ];
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
36 then
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
37 echo "DAV_BIN variable not set"
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
38 exit 1
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
39 fi
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
40
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
41 # checks if tmp-sync/out.txt contains a specific text
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
42 # arg1: pattern
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
43 # arg2: errormsg
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
44 check_tmpout()
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
45 {
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
46 TEST=`cat tmp-sync/out.txt | grep "$1"`
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
47 if [ $? -ne 0 ];
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
48 then
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
49 echo "$2"
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
50 exit 2
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
51 fi
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
52 }
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
53
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
54 # do dav-sync push and check return value
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
55 # arg1: dir
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
56 # arg2: errormsg
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
57 dav_sync_push()
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
58 {
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
59 $DAV_SYNC_BIN push $1 > tmp-sync/out.txt
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
60 if [ $? -ne 0 ];
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
61 then
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
62 echo "$errormsg"
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
63 exit 2
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
64 fi
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
65 }
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
66
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
67 $DAV_BIN mkcol dav-test-repo/sync/test1
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
68
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
69 # 1. test
586
b45719a52ea6 add more simple dav-sync push tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 571
diff changeset
70 # copy files to the test1a dir and run push
571
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
71 # expected result: 2 uploads, no errors or conflicts
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
72
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
73 cp synctest/file1 tmp-sync/test1a
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
74 cp synctest/file2 tmp-sync/test1a
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
75
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
76 OUT=`$DAV_SYNC_BIN push test1a | tail -n 1`
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
77
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
78 TEST=`echo $OUT | grep Result`
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
79 if [ $? -ne 0 ];
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
80 then
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
81 echo "push 1 failed"
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
82 exit 2
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
83 fi
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
84
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
85 TEST=`echo $OUT | grep "2 files pushed"`
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
86 if [ $? -ne 0 ];
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
87 then
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
88 echo "wrong push counter"
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
89 exit 2
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
90 fi
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
91
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
92 TEST=`echo $OUT | grep "0 conflicts"`
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
93 if [ $? -ne 0 ];
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
94 then
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
95 echo "wrong conflict counter"
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
96 exit 2
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
97 fi
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
98
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
99 TEST=`echo $OUT | grep "0 files deleted"`
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
100 if [ $? -ne 0 ];
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
101 then
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
102 echo "wrong delete counter"
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
103 exit 2
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
104 fi
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
105
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
106 # 2. test
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
107 # do nothing
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
108 # expected result: no uploads or updates, only status line with zeros
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
109
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
110 dav_sync_push test1a "push 2 failed"
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
111
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
112 OUT=`wc -l < tmp-sync/out.txt`
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
113 if [ "$OUT" != "1" ];
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
114 then
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
115 echo "push 2: number of output lines not 1"
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
116 exit 2
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
117 fi
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
118
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
119 check_tmpout "0 files pushed" "push 2: wrong push counter"
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
120 check_tmpout "0 errors" "push 2: wrong error counter"
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
121
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
122 # 3. test
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
123 # add empty dir
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
124 # expected result: 1 mkcol
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
125 mkdir tmp-sync/test1a/emptydir
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
126
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
127 dav_sync_push test1a "push 3 failed"
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
128 check_tmpout "mkcol: /emptydir" "push 3: no mkcol"
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
129
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
130 # 4. test
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
131 # do nothing again, test if double mkcol happens
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
132 # expected result: no mkcol
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
133 dav_sync_push test1a "push 4 failed"
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
134
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
135 OUT=`wc -l < tmp-sync/out.txt`
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
136 if [ "$OUT" != "1" ];
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
137 then
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
138 echo "push 4: number of output lines not 1"
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
139 exit 2
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
140 fi
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
141
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
142 check_tmpout "0 files pushed" "push 4: wrong push counter"
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
143 check_tmpout "0 errors" "push 4: wrong error counter"
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
144
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
145
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
146 # 5. test
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
147 # touch file
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
148 # expected result: upload touched file
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
149 sleep 2
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
150 touch tmp-sync/test1a/file1
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
151
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
152 dav_sync_push test1a "push 5 failed"
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
153 check_tmpout "put: /file1" "push 5: no put"
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
154 check_tmpout "1 file pushed" "push 5: wrong push counter"
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
155 check_tmpout "0 conflicts" "push 5: wrong conflict counter"
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
156 check_tmpout "0 files deleted" "push 5: wrong delete counter"
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
157 check_tmpout "0 errors" "push 5: wrong error counter"
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
158
586
b45719a52ea6 add more simple dav-sync push tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 571
diff changeset
159 # 6. test
b45719a52ea6 add more simple dav-sync push tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 571
diff changeset
160 # add deep dir hierarchy and some files, test if mkcol order is fine
b45719a52ea6 add more simple dav-sync push tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 571
diff changeset
161 # expected result: multiple mkcol requests and some puts after that
b45719a52ea6 add more simple dav-sync push tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 571
diff changeset
162 mkdir -p tmp-sync/test1a/dir_a/1/2/3/4/5/6/7/8
b45719a52ea6 add more simple dav-sync push tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 571
diff changeset
163 mkdir -p tmp-sync/test1a/dir_a/1/2/3/a/b/c/d
b45719a52ea6 add more simple dav-sync push tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 571
diff changeset
164 mkdir -p tmp-sync/test1a/dir_a/i/j/k
b45719a52ea6 add more simple dav-sync push tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 571
diff changeset
165 mkdir -p tmp-sync/test1a/dir_b/1/2/3/4/5/6/7/8
b45719a52ea6 add more simple dav-sync push tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 571
diff changeset
166 mkdir -p tmp-sync/test1a/dir_b/1/2/3/a/b/c/d
b45719a52ea6 add more simple dav-sync push tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 571
diff changeset
167 mkdir -p tmp-sync/test1a/dir_b/i/j/k
b45719a52ea6 add more simple dav-sync push tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 571
diff changeset
168 mkdir -p tmp-sync/test1a/dir_c/sub1/sub2/sub3/sub4
b45719a52ea6 add more simple dav-sync push tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 571
diff changeset
169 mkdir -p tmp-sync/test1a/dir_c/sub1/sub2/1
b45719a52ea6 add more simple dav-sync push tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 571
diff changeset
170 mkdir -p tmp-sync/test1a/dir_c/sub1/sub2/2
b45719a52ea6 add more simple dav-sync push tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 571
diff changeset
171 mkdir -p tmp-sync/test1a/dir_c/sub1/sub2/3
b45719a52ea6 add more simple dav-sync push tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 571
diff changeset
172 mkdir -p tmp-sync/test1a/dir_c/sub1/sub2/4
b45719a52ea6 add more simple dav-sync push tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 571
diff changeset
173 mkdir -p tmp-sync/test1a/dir_c/sub1/sub2/5
b45719a52ea6 add more simple dav-sync push tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 571
diff changeset
174 mkdir -p tmp-sync/test1a/dir_c/sub_a/x
b45719a52ea6 add more simple dav-sync push tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 571
diff changeset
175 mkdir -p tmp-sync/test1a/dir_c/sub_a/y/d1/d2/d3
b45719a52ea6 add more simple dav-sync push tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 571
diff changeset
176 touch tmp-sync/test1a/dir_a/1/2/3/4/5/6/7/8/file1
b45719a52ea6 add more simple dav-sync push tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 571
diff changeset
177 touch tmp-sync/test1a/dir_a/1/2/3/4/5/6/7/file1
b45719a52ea6 add more simple dav-sync push tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 571
diff changeset
178 touch tmp-sync/test1a/dir_a/1/2/3/4/5/6/file1
b45719a52ea6 add more simple dav-sync push tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 571
diff changeset
179 touch tmp-sync/test1a/dir_a/1/2/3/a/b/c/d/d_file1
b45719a52ea6 add more simple dav-sync push tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 571
diff changeset
180 touch tmp-sync/test1a/dir_a/1/2/3/a/b/b_file1
b45719a52ea6 add more simple dav-sync push tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 571
diff changeset
181 touch tmp-sync/test1a/dir_a/a_file
b45719a52ea6 add more simple dav-sync push tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 571
diff changeset
182 echo "test6-file-1" > tmp-sync/test1a/dir_b/1/2/3/4/5/6/7/8/t6f1-8
b45719a52ea6 add more simple dav-sync push tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 571
diff changeset
183 echo "test6-file-2" > tmp-sync/test1a/dir_b/i/t6f2-i
b45719a52ea6 add more simple dav-sync push tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 571
diff changeset
184 echo "test6-file-3" > tmp-sync/test1a/dir_c/sub1/sub2/sub3/sub4/t6f3-s4
b45719a52ea6 add more simple dav-sync push tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 571
diff changeset
185 echo "test6-file-4" > tmp-sync/test1a/dir_c/sub1/sub2/3/t6f4-3
b45719a52ea6 add more simple dav-sync push tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 571
diff changeset
186
b45719a52ea6 add more simple dav-sync push tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 571
diff changeset
187 dav_sync_push test1a "push 6 failed"
b45719a52ea6 add more simple dav-sync push tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 571
diff changeset
188 check_tmpout "10 files pushed" "push6: wrong push counter"
b45719a52ea6 add more simple dav-sync push tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 571
diff changeset
189 check_tmpout "0 files deleted" "push6: wrong delete counter"
b45719a52ea6 add more simple dav-sync push tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 571
diff changeset
190 check_tmpout "0 conflicts" "push6: wrong conflict counter"
b45719a52ea6 add more simple dav-sync push tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 571
diff changeset
191 check_tmpout "0 errors" "push6: wrong error counter"
b45719a52ea6 add more simple dav-sync push tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 571
diff changeset
192 OUT=`grep mkcol tmp-sync/out.txt | wc -l`
b45719a52ea6 add more simple dav-sync push tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 571
diff changeset
193 if [ "$OUT" != "48" ];
b45719a52ea6 add more simple dav-sync push tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 571
diff changeset
194 then
b45719a52ea6 add more simple dav-sync push tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 571
diff changeset
195 echo "push 6: number of mkcol output lines not 48"
b45719a52ea6 add more simple dav-sync push tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 571
diff changeset
196 exit 2
b45719a52ea6 add more simple dav-sync push tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 571
diff changeset
197 fi
b45719a52ea6 add more simple dav-sync push tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 571
diff changeset
198
b45719a52ea6 add more simple dav-sync push tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 571
diff changeset
199 # 7. test
b45719a52ea6 add more simple dav-sync push tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 571
diff changeset
200 # delete file
b45719a52ea6 add more simple dav-sync push tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 571
diff changeset
201 # expected result: delete file on server
b45719a52ea6 add more simple dav-sync push tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 571
diff changeset
202 rm -f tmp-sync/test1a/file1
b45719a52ea6 add more simple dav-sync push tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 571
diff changeset
203
b45719a52ea6 add more simple dav-sync push tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 571
diff changeset
204 dav_sync_push test1a "push 7 failed"
b45719a52ea6 add more simple dav-sync push tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 571
diff changeset
205 check_tmpout "0 files pushed" "push7: wrong push counter"
b45719a52ea6 add more simple dav-sync push tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 571
diff changeset
206 check_tmpout "1 file deleted" "push7: wrong delete counter"
b45719a52ea6 add more simple dav-sync push tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 571
diff changeset
207 check_tmpout "0 conflicts" "push7: wrong conflict counter"
b45719a52ea6 add more simple dav-sync push tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 571
diff changeset
208 check_tmpout "0 errors" "push7: wrong error counter"
b45719a52ea6 add more simple dav-sync push tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 571
diff changeset
209
b45719a52ea6 add more simple dav-sync push tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 571
diff changeset
210 # 8. test
b45719a52ea6 add more simple dav-sync push tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 571
diff changeset
211 # do nothing, test if double delete happens
b45719a52ea6 add more simple dav-sync push tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 571
diff changeset
212 # expected result: no delete
b45719a52ea6 add more simple dav-sync push tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 571
diff changeset
213
b45719a52ea6 add more simple dav-sync push tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 571
diff changeset
214 dav_sync_push test1a "push 8 failed"
b45719a52ea6 add more simple dav-sync push tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 571
diff changeset
215 check_tmpout "0 files pushed" "push8: wrong push counter"
b45719a52ea6 add more simple dav-sync push tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 571
diff changeset
216 check_tmpout "0 files deleted" "push8: wrong delete counter"
b45719a52ea6 add more simple dav-sync push tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 571
diff changeset
217 check_tmpout "0 conflicts" "push8: wrong conflict counter"
b45719a52ea6 add more simple dav-sync push tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 571
diff changeset
218 check_tmpout "0 errors" "push8: wrong error counter"
b45719a52ea6 add more simple dav-sync push tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 571
diff changeset
219
b45719a52ea6 add more simple dav-sync push tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 571
diff changeset
220 # 9. test
b45719a52ea6 add more simple dav-sync push tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 571
diff changeset
221 # delete multiple files
b45719a52ea6 add more simple dav-sync push tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 571
diff changeset
222 # expected result: multiple delete requests
b45719a52ea6 add more simple dav-sync push tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 571
diff changeset
223
b45719a52ea6 add more simple dav-sync push tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 571
diff changeset
224 rm -Rf tmp-sync/test1a/dir_a
b45719a52ea6 add more simple dav-sync push tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 571
diff changeset
225 rm -f tmp-sync/test1a/dir_b/1/2/3/4/5/6/7/8/t6f1-8
b45719a52ea6 add more simple dav-sync push tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 571
diff changeset
226 rm -f tmp-sync/test1a/dir_b/i/t6f2-i
b45719a52ea6 add more simple dav-sync push tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 571
diff changeset
227
b45719a52ea6 add more simple dav-sync push tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 571
diff changeset
228 dav_sync_push test1a "push 9 failed"
b45719a52ea6 add more simple dav-sync push tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 571
diff changeset
229
b45719a52ea6 add more simple dav-sync push tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 571
diff changeset
230 # don't test if there was a single delete for each collection
b45719a52ea6 add more simple dav-sync push tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 571
diff changeset
231 # and don't check if the delete counter has a specific value
587
3c917df041b8 add func for creating the content of crypto-prop properties
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 586
diff changeset
232 # because there will be some optimizations maybe
586
b45719a52ea6 add more simple dav-sync push tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 571
diff changeset
233 check_tmpout "0 files pushed" "push8: wrong push counter"
b45719a52ea6 add more simple dav-sync push tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 571
diff changeset
234 check_tmpout "0 conflicts" "push8: wrong conflict counter"
b45719a52ea6 add more simple dav-sync push tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 571
diff changeset
235 check_tmpout "0 errors" "push8: wrong error counter"
b45719a52ea6 add more simple dav-sync push tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 571
diff changeset
236
b45719a52ea6 add more simple dav-sync push tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 571
diff changeset
237 OUT=`grep "delete: /dir_a/" tmp-sync/out.txt`
b45719a52ea6 add more simple dav-sync push tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 571
diff changeset
238 if [ $? -ne 0 ];
b45719a52ea6 add more simple dav-sync push tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 571
diff changeset
239 then
b45719a52ea6 add more simple dav-sync push tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 571
diff changeset
240 echo "missing: delete /dir_a/"
b45719a52ea6 add more simple dav-sync push tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 571
diff changeset
241 exit 2
b45719a52ea6 add more simple dav-sync push tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 571
diff changeset
242 fi
b45719a52ea6 add more simple dav-sync push tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 571
diff changeset
243 OUT=`grep "delete: /dir_b/i/t6f2-i" tmp-sync/out.txt`
b45719a52ea6 add more simple dav-sync push tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 571
diff changeset
244 if [ $? -ne 0 ];
b45719a52ea6 add more simple dav-sync push tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 571
diff changeset
245 then
b45719a52ea6 add more simple dav-sync push tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 571
diff changeset
246 echo "missing: delete: /dir_b/i/t6f2-i"
b45719a52ea6 add more simple dav-sync push tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 571
diff changeset
247 exit 2
b45719a52ea6 add more simple dav-sync push tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 571
diff changeset
248 fi
b45719a52ea6 add more simple dav-sync push tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 571
diff changeset
249 OUT=`grep "delete: /dir_b/1/2/3/4/5/6/7/8/t6f1-8" tmp-sync/out.txt`
b45719a52ea6 add more simple dav-sync push tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 571
diff changeset
250 if [ $? -ne 0 ];
b45719a52ea6 add more simple dav-sync push tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 571
diff changeset
251 then
b45719a52ea6 add more simple dav-sync push tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 571
diff changeset
252 echo "missing: delete: /dir_b/1/2/3/4/5/6/7/8/t6f1-8"
b45719a52ea6 add more simple dav-sync push tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 571
diff changeset
253 exit 2
b45719a52ea6 add more simple dav-sync push tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 571
diff changeset
254 fi
b45719a52ea6 add more simple dav-sync push tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 571
diff changeset
255
b45719a52ea6 add more simple dav-sync push tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 571
diff changeset
256
b45719a52ea6 add more simple dav-sync push tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 571
diff changeset
257

mercurial