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

Sat, 23 Nov 2019 17:49:18 +0100

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Sat, 23 Nov 2019 17:49:18 +0100
changeset 685
487645580b5e
child 686
ab159748055c
permissions
-rwxr-xr-x

add symlink tests

685
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1 #!/bin/sh
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
2 #
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
4 #
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
5 # Copyright 2019 Olaf Wintermann. All rights reserved.
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
6 #
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
7 # Redistribution and use in source and binary forms, with or without
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
8 # modification, are permitted provided that the following conditions are met:
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
9 #
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
10 # 1. Redistributions of source code must retain the above copyright
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
11 # notice, this list of conditions and the following disclaimer.
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
12 #
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
13 # 2. Redistributions in binary form must reproduce the above copyright
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
14 # notice, this list of conditions and the following disclaimer in the
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
15 # documentation and/or other materials provided with the distribution.
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
16 #
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
17 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
18 # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
19 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
20 # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
21 # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
22 # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
23 # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
24 # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
25 # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
487645580b5e add symlink 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
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
27 # POSSIBILITY OF SUCH DAMAGE.
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
28 #
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
29
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
30 if [ -z "$DAV_BIN" ];
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
31 then
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
32 echo "DAV_BIN variable not set"
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
33 exit 1
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
34 fi
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
35 if [ -z "$DAV_SYNC_BIN" ];
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
36 then
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
37 echo "DAV_BIN variable not set"
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
38 exit 1
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
39 fi
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
40
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
41 XATTR=../../build/xattrtool
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
42
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
43 # checks if tmp-sync/out.txt contains a specific text
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
44 # arg1: pattern
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
45 # arg2: errormsg
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
46 check_tmpout()
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
47 {
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
48 TEST=`cat tmp-sync/out.txt | grep "$1"`
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
49 if [ $? -ne 0 ];
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
50 then
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
51 echo "$2"
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
52 exit 2
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
53 fi
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
54 }
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
55
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
56 # checks if tmp-sync/out.txt does not contain a specific text
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
57 # arg1: pattern
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
58 # arg2: errormsg
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
59 ncheck_tmpout()
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
60 {
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
61 TEST=`cat tmp-sync/out.txt | grep "$1"`
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
62 if [ $? -eq 0 ];
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
63 then
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
64 echo "$2"
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
65 exit 2
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
66 fi
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
67 }
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
68
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
69 # do dav-sync push and check return value
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
70 # arg1: dir
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
71 # arg2: errormsg
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
72 dav_sync_push()
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
73 {
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
74 $DAV_SYNC_BIN push $1 > tmp-sync/out.txt
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
75 if [ $? -ne 0 ];
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
76 then
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
77 echo "$2"
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
78 exit 2
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
79 fi
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
80 }
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
81 # do dav-sync pull and check return value
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
82 # arg1: dir
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
83 # arg2: errormsg
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
84 dav_sync_pull()
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
85 {
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
86 $DAV_SYNC_BIN pull $1 > tmp-sync/out.txt
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
87 if [ $? -ne 0 ];
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
88 then
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
89 echo "$2"
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
90 exit 2
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
91 fi
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
92 }
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
93
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
94 rm -f .dav/dav-sync-tests-test7a-db.xml
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
95 rm -f .dav/dav-sync-tests-test7b-db.xml
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
96
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
97 $DAV_BIN rm dav-test-repo/sync/test7 2> /dev/null
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
98
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
99 $DAV_BIN mkcol dav-test-repo/sync/test7 2> /dev/null
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
100
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
101 # tmp sync dir
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
102 rm -Rf tmp-sync
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
103 mkdir tmp-sync
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
104 mkdir tmp-sync/test7a
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
105 mkdir tmp-sync/test7b
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
106
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
107 # ----------------------------------------------------------------------------
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
108 # test 1: try to sync symlinks with symlinks disabled (test7a1)
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
109 # expected result: only normal files synced
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
110
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
111 mkdir tmp-sync/files
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
112 mkdir tmp-sync/test7a/dir1
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
113 mkdir tmp-sync/test7a/dir1/sub1
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
114
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
115 echo "extern-file1" > tmp-sync/extern1
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
116 echo "extern-file2" > tmp-sync/files/extern2
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
117 echo "extern-file3" > tmp-sync/files/extern3
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
118
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
119 which ln > /dev/null 2>&1
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
120 if [ $? -ne 0 ]; then
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
121 exit 0 # symlinks unsupported on this platform
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
122 fi
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
123
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
124 ln -s -r tmp-sync/extern1 tmp-sync/test7a/extern1 > /dev/null 2>&1
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
125 if [ $? -ne 0 ]; then
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
126 exit 0 # symlinks unsupported on this platform
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
127 fi
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
128
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
129 ln -s -r tmp-sync/files/extern2 tmp-sync/test7a/extern2
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
130 ln -s -r tmp-sync/files/extern3 tmp-sync/test7a/dir1/sub1/extern3
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
131
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
132 cp synctest/file1 tmp-sync/test7a
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
133 cp synctest/file2 tmp-sync/test7a/dir1
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
134 cp synctest/file3 tmp-sync/test7a/dir1/sub1
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
135
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
136 ln -s -r tmp-sync/test7a/file1 tmp-sync/test7a/intern1
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
137 ln -s -r tmp-sync/test7a/dir1/file2 tmp-sync/test7a/intern2
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
138 ln -s -r tmp-sync/test7a/file1 tmp-sync/test7a/dir1/sub1/intern3
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
139
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
140 dav_sync_push test7a1 "test 1: push failed"
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
141 check_tmpout "3 files pushed" "test 1: wrong push counter"
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
142 check_tmpout "0 conflicts" "test 1: wrong conflict counter (push)"
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
143 check_tmpout "0 errors" "test 1: wrong error counter (push)"
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
144 ncheck_tmpout "extern" "test 1: external symlinks pushed"
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
145 ncheck_tmpout "intern" "test 1: internal symlinks pushed"
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
146
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
147 dav_sync_pull test7b "test 1: pull failed"
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
148 check_tmpout "3 files pulled" "test 1: wrong pull counter"
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
149 check_tmpout "0 conflicts" "test 1: wrong conflict counter (pull)"
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
150 check_tmpout "0 errors" "test 1: wrong error counter (pull)"
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
151
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
152
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
153 # ----------------------------------------------------------------------------
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
154 # test 2: try to sync internal symlinks (test7a2)
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
155 # expected result: internal symlinks synced, external symlinks ignored
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
156
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
157 dav_sync_push test7a2 "test 2: push failed"
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
158 check_tmpout "3 files pushed" "test 2: wrong push counter"
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
159 check_tmpout "0 conflicts" "test 2: wrong conflict counter (push)"
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
160 check_tmpout "0 errors" "test 2: wrong error counter (push)"
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
161 check_tmpout "link: /intern1" "test 2: no links created (push)"
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
162 ncheck_tmpout "extern" "test 2: external symlinks pushed"
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
163
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
164 dav_sync_pull test7b "test 2: pull failed"
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
165 check_tmpout "3 files pulled" "test 2: wrong pull counter"
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
166 check_tmpout "0 conflicts" "test 2: wrong conflict counter (pull)"
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
167 check_tmpout "0 errors" "test 2: wrong error counter (pull)"
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
168 check_tmpout "link: /intern1" "test 2: no links created (pull)"
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
169
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
170 # compare links
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
171 HASH_A=`cat tmp-sync/test7a/intern1 | sha256sum`
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
172 HASH_B=`cat tmp-sync/test7b/intern1 | sha256sum`
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
173 if [ "$HASH_A" != "$HASH_B" ]; then
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
174 echo "test 2: intern1 has wrong content"
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
175 exit 2
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
176 fi
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
177 HASH_A=`cat tmp-sync/test7a/intern2 | sha256sum`
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
178 HASH_B=`cat tmp-sync/test7b/intern2 | sha256sum`
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
179 if [ "$HASH_A" != "$HASH_B" ]; then
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
180 echo "test 2: intern2 has wrong content"
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
181 exit 2
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
182 fi
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
183 HASH_A=`cat tmp-sync/test7a/dir1/sub1/intern3 | sha256sum`
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
184 HASH_B=`cat tmp-sync/test7b/dir1/sub1/intern3 | sha256sum`
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
185 if [ "$HASH_A" != "$HASH_B" ]; then
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
186 echo "test 2: intern3 has wrong content"
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
187 exit 2
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
188 fi
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
189
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
190
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
191 # ----------------------------------------------------------------------------
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
192 # test 3: push with symlink-extern follow (test7a)
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
193 # expected result: external links pushed as regular files
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
194
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
195 dav_sync_push test7a "test 3: push failed"
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
196 check_tmpout "3 files pushed" "test 3: wrong push counter"
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
197 check_tmpout "0 conflicts" "test 3: wrong conflict counter (push)"
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
198 check_tmpout "0 errors" "test 3: wrong error counter (push)"
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
199 check_tmpout "extern" "test 3: no links created (push)"
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
200
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
201 dav_sync_pull test7b "test 3: pull failed"
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
202 check_tmpout "3 files pulled" "test 3: wrong pull counter"
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
203 check_tmpout "0 conflicts" "test 3: wrong conflict counter (pull)"
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
204 check_tmpout "0 errors" "test 3: wrong error counter (pull)"
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
205
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
206
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
207 # ----------------------------------------------------------------------------
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
208 # test 4: push, add new file, push (test if double sync happens)
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
209 # expected result: push1: 0 files pushed, push2: 1 file pushed
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
210
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
211 dav_sync_push test7a "test 4: push failed"
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
212 check_tmpout "0 files pushed" "test 4: wrong push counter"
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
213 check_tmpout "0 conflicts" "test 4: wrong conflict counter (push)"
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
214 check_tmpout "0 errors" "test 4: wrong error counter (push)"
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
215
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
216 echo "test3-new1" > tmp-sync/test7a/new1
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
217
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
218 dav_sync_push test7a "test 4: push 2 failed"
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
219 check_tmpout "1 file pushed" "test 4: wrong push counter (2)"
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
220 check_tmpout "0 conflicts" "test 4: wrong conflict counter (2)"
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
221 check_tmpout "0 errors" "test 4: wrong error counter (2)"
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
222
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
223 dav_sync_pull test7b "test 4: pull failed"
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
224 check_tmpout "1 file pulled" "test 4: wrong pull counter"
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
225 check_tmpout "0 conflicts" "test 4: wrong conflict counter (pull)"
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
226 check_tmpout "0 errors" "test 4: wrong error counter (pull)"
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
227
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
228
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
229 # ----------------------------------------------------------------------------
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
230 # test 5: modify file1, sync
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
231 # expected result: file1 synced, intern1 not synced
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
232
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
233 sleep 2
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
234
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
235 echo "test5-mod1" >> tmp-sync/test7a/file1
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
236
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
237 dav_sync_push test7a "test 5: push failed"
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
238 check_tmpout "1 file pushed" "test 5: wrong push counter"
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
239 check_tmpout "0 conflicts" "test 5: wrong conflict counter (push)"
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
240 check_tmpout "0 errors" "test 5: wrong error counter (push)"
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
241 ncheck_tmpout "intern1" "test 5: intern1 updated (push)"
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
242
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
243 dav_sync_pull test7b "test 5: pull failed"
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
244 check_tmpout "1 file pulled" "test 5: wrong pull counter"
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
245 check_tmpout "0 conflicts" "test 5: wrong conflict counter (pull)"
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
246 check_tmpout "0 errors" "test 5: wrong error counter (pull)"
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
247
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
248
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
249 # ----------------------------------------------------------------------------
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
250 # test 6: change intern1 target
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
251 # expected result: intern1 updated
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
252
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
253 rm -f tmp-sync/test7a/intern1
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
254 ln -s -r tmp-sync/test7a/new1 tmp-sync/test7a/intern1
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
255
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
256 dav_sync_push test7a "test 6: push failed"
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
257 check_tmpout "1 file pushed" "test 6: wrong push counter"
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
258 check_tmpout "0 conflicts" "test 6: wrong conflict counter (push)"
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
259 check_tmpout "0 errors" "test 6: wrong error counter (push)"
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
260 check_tmpout "intern1" "test 6: intern1 not updated (push)"
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
261
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
262 dav_sync_pull test7b "test 6: pull failed"
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
263 check_tmpout "1 file pulled" "test 6: wrong pull counter"
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
264 check_tmpout "0 conflicts" "test 6: wrong conflict counter (pull)"
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
265 check_tmpout "0 errors" "test 6: wrong error counter (pull)"
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
266 check_tmpout "intern1" "test 6: intern1 not updated (pull)"
487645580b5e add symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
267

mercurial