2019-08-11
add element for configuring symlinks
622
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1 | #!/bin/sh |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
2 | # |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
3 | # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
4 | # |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
5 | # Copyright 2019 Olaf Wintermann. All rights reserved. |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
6 | # |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
7 | # Redistribution and use in source and binary forms, with or without |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
8 | # modification, are permitted provided that the following conditions are met: |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
9 | # |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
10 | # 1. Redistributions of source code must retain the above copyright |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
11 | # notice, this list of conditions and the following disclaimer. |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
12 | # |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
13 | # 2. Redistributions in binary form must reproduce the above copyright |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
14 | # notice, this list of conditions and the following disclaimer in the |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
15 | # documentation and/or other materials provided with the distribution. |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
16 | # |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
17 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
18 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
19 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
20 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
21 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
22 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
23 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
24 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
25 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
6524f45f304e
add some dav-sync pull 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 |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
27 | # POSSIBILITY OF SUCH DAMAGE. |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
28 | # |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
29 | |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
30 | if [ -z "$DAV_BIN" ]; |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
31 | then |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
32 | echo "DAV_BIN variable not set" |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
33 | exit 1 |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
34 | fi |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
35 | if [ -z "$DAV_SYNC_BIN" ]; |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
36 | then |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
37 | echo "DAV_BIN variable not set" |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
38 | exit 1 |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
39 | fi |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
40 | |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
41 | # checks if tmp-sync/out.txt contains a specific text |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
42 | # arg1: pattern |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
43 | # arg2: errormsg |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
44 | check_tmpout() |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
45 | { |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
46 | TEST=`cat tmp-sync/out.txt | grep "$1"` |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
47 | if [ $? -ne 0 ]; |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
48 | then |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
49 | echo "$2" |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
50 | exit 2 |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
51 | fi |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
52 | } |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
53 | |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
54 | # do dav-sync push and check return value |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
55 | # arg1: dir |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
56 | # arg2: errormsg |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
57 | dav_sync_push() |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
58 | { |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
59 | $DAV_SYNC_BIN push $1 > tmp-sync/out.txt |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
60 | if [ $? -ne 0 ]; |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
61 | then |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
62 | echo "$2" |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
63 | exit 2 |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
64 | fi |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
65 | } |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
66 | # do dav-sync pull and check return value |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
67 | # arg1: dir |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
68 | # arg2: errormsg |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
69 | dav_sync_pull() |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
70 | { |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
71 | $DAV_SYNC_BIN pull $1 > tmp-sync/out.txt |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
72 | if [ $? -ne 0 ]; |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
73 | then |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
74 | echo "$2" |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
75 | exit 2 |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
76 | fi |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
77 | } |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
78 | |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
79 | $DAV_BIN mkcol dav-test-repo/sync/test1 2> /dev/null |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
80 | $DAV_BIN mkcol dav-test-repo/sync/test2 2> /dev/null |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
81 | |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
82 | # ---------------------------------------------------------------------------- |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
83 | # 1. test: pull empty collection |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
84 | # expected result: 0 files pulled, 0 errors |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
85 | dav_sync_pull test1b "test1: pull failed" |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
86 | |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
87 | check_tmpout "0 files pulled" "pull1: wrong pull counter" |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
88 | check_tmpout "0 errors" "pull1: wrong error counter" |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
89 | check_tmpout "0 conflicts" "pull1: wrong conflicts counter" |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
90 | |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
91 | # ---------------------------------------------------------------------------- |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
92 | # 2. test: add 2 files to test1a and push it and pull test1b |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
93 | # expected result: 2 files pushed, 2 files pulled |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
94 | |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
95 | rm -f .dav/dav-sync-tests-test1a-db.xml |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
96 | |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
97 | cp synctest/file1 tmp-sync/test1a |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
98 | cp synctest/file2 tmp-sync/test1a |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
99 | |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
100 | dav_sync_push test1a "test2: push failed" |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
101 | check_tmpout "2 files pushed" "test2: wrong push counter" |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
102 | |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
103 | dav_sync_pull test1b "test2: pull failed" |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
104 | check_tmpout "2 files pulled" "test2: wrong pull counter" |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
105 | check_tmpout "0 errors" "test2: wrong error counter" |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
106 | check_tmpout "0 conflicts" "test2: wrong conflicts counter" |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
107 | |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
108 | # ---------------------------------------------------------------------------- |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
109 | # 3. test: pull empty directory |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
110 | # expected result: empty directory created |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
111 | |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
112 | mkdir tmp-sync/test1a/emptydir |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
113 | dav_sync_push test1a "test3: push failed" |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
114 | check_tmpout "mkcol" "test3: mkcol missing" |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
115 | |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
116 | |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
117 | |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
118 | dav_sync_pull test1b "test3: pull failed" |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
119 | ls tmp-sync/test1b/emptydir > /dev/null 2>&1 |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
120 | if [ $? -ne 0 ]; then |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
121 | echo "emptydir not created" |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
122 | exit 2 |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
123 | fi |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
124 | |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
125 | # check if file1 or file2 are pulled |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
126 | TEST=`cat tmp-sync/out.txt | grep "get: /file1"` |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
127 | if [ $? -eq 0 ]; then |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
128 | echo "test3: file1 must not be pulled" |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
129 | exit 2 |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
130 | fi |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
131 | TEST=`cat tmp-sync/out.txt | grep "get: /file2"` |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
132 | if [ $? -eq 0 ]; then |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
133 | echo "test3: file2 must not be pulled" |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
134 | exit 2 |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
135 | fi |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
136 | |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
137 | # ---------------------------------------------------------------------------- |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
138 | # 4. test: do nothing, test if double mkdir happens |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
139 | # expected result: no files pulled, no mkdir |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
140 | |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
141 | dav_sync_pull test1b "test4: pull failed" |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
142 | |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
143 | check_tmpout "0 files pulled" "test4: wrong pull counter" |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
144 | check_tmpout "0 errors" "test4: wrong error counter" |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
145 | check_tmpout "0 conflicts" "test4: wrong conflicts counter" |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
146 | |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
147 | OUT=`cat tmp-sync/out.txt | wc -l` |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
148 | if [ "$OUT" != "1" ]; then |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
149 | echo "test4: wrong line count" |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
150 | exit 2 |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
151 | fi |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
152 | |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
153 | # ---------------------------------------------------------------------------- |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
154 | # 5. test: pull changed files |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
155 | # expected result: 1 file pulled |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
156 | |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
157 | echo testx2 > tmp-sync/test1a/file1 |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
158 | dav_sync_push test1a "test5: push failed" |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
159 | check_tmpout "1 file pushed" "test5: wrong push counter" |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
160 | |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
161 | dav_sync_pull test1b "test5: pull failed" |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
162 | check_tmpout "0 errors" "test5: wrong error counter" |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
163 | check_tmpout "0 conflicts" "test5: wrong conflicts counter" |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
164 | |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
165 | # ---------------------------------------------------------------------------- |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
166 | # 6. test: pull new dir and files |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
167 | # expected result: mkdir and some files pulled |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
168 | |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
169 | mkdir tmp-sync/test1a/subdir |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
170 | cp testdir/subdir/sub1 tmp-sync/test1a/subdir/ |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
171 | cp testdir/subdir/sub2 tmp-sync/test1a/subdir/ |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
172 | dav_sync_push test1a "test6: push failed" |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
173 | |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
174 | dav_sync_pull test1b "test6: pull failed" |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
175 | check_tmpout "get: /subdir/sub1" "test6: sub1 not pulled" |
6524f45f304e
add some dav-sync pull tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
176 | check_tmpout "get: /subdir/sub2" "test6: sub2 not pulled" |