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

Sat, 26 Oct 2019 12:40:35 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Sat, 26 Oct 2019 12:40:35 +0200
changeset 674
92bf06a65d08
parent 672
4bfe452a2665
child 675
a8117c4feaad
permissions
-rwxr-xr-x

increase security in case of broken secret stores

672
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1 #!/bin/sh
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
2 #
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
4 #
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
5 # Copyright 2019 Olaf Wintermann. All rights reserved.
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
6 #
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
7 # Redistribution and use in source and binary forms, with or without
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
8 # modification, are permitted provided that the following conditions are met:
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
9 #
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
10 # 1. Redistributions of source code must retain the above copyright
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
11 # notice, this list of conditions and the following disclaimer.
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
12 #
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
13 # 2. Redistributions in binary form must reproduce the above copyright
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
14 # notice, this list of conditions and the following disclaimer in the
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
15 # documentation and/or other materials provided with the distribution.
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
16 #
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
17 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
18 # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
19 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
20 # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
21 # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
22 # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
23 # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
24 # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
25 # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
4bfe452a2665 fix dav-sync copy with enabled metadata sync
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
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
27 # POSSIBILITY OF SUCH DAMAGE.
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
28 #
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
29
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
30 if [ -z "$DAV_BIN" ];
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
31 then
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
32 echo "DAV_BIN variable not set"
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
33 exit 1
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
34 fi
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
35 if [ -z "$DAV_SYNC_BIN" ];
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
36 then
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
37 echo "DAV_BIN variable not set"
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
38 exit 1
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
39 fi
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
40
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
41 XATTR=../../build/xattrtool
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
42
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
43 # checks if tmp-sync/out.txt contains a specific text
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
44 # arg1: pattern
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
45 # arg2: errormsg
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
46 check_tmpout()
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
47 {
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
48 TEST=`cat tmp-sync/out.txt | grep "$1"`
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
49 if [ $? -ne 0 ];
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
50 then
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
51 echo "$2"
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
52 exit 2
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
53 fi
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
54 }
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
55
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
56 # do dav-sync push and check return value
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
57 # arg1: dir
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
58 # arg2: errormsg
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
59 dav_sync_push()
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
60 {
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
61 $DAV_SYNC_BIN push $1 > tmp-sync/out.txt
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
62 if [ $? -ne 0 ];
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
63 then
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
64 echo "$2"
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
65 exit 2
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
66 fi
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
67 }
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
68 # do dav-sync pull and check return value
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
69 # arg1: dir
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
70 # arg2: errormsg
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
71 dav_sync_pull()
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
72 {
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
73 $DAV_SYNC_BIN pull $1 > tmp-sync/out.txt
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
74 if [ $? -ne 0 ];
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
75 then
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
76 echo "$2"
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
77 exit 2
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
78 fi
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
79 }
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
80
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
81 rm -f .dav/dav-sync-tests-test4a-db.xml
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
82 rm -f .dav/dav-sync-tests-test4b-db.xml
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
83
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
84 $DAV_BIN rm dav-test-repo/sync/test4 2> /dev/null
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
85
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
86 $DAV_BIN mkcol dav-test-repo/sync/test4 2> /dev/null
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
87
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
88 # tmp sync dir
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
89 rm -Rf tmp-sync
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
90 mkdir tmp-sync
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
91 mkdir tmp-sync/test4a
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
92 mkdir tmp-sync/test4b
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
93
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
94 # ----------------------------------------------------------------------------
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
95 # test 1: add file with all kinds of metadata and sync
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
96 # expected result: everything synced
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
97
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
98 mkdir tmp-sync/test4a/dir1
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
99
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
100 echo "#!/bin/sh" > tmp-sync/test4a/file1
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
101 echo "echo file1out" >> tmp-sync/test4a/file1
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
102
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
103 cp synctest/file2 tmp-sync/test4a/
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
104 cp synctest/file3 tmp-sync/test4a/dir1/
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
105 cp synctest/file4 tmp-sync/test4a/dir1/
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
106
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
107 # add tags
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
108 $DAV_SYNC_BIN add-tag -s test4a tmp-sync/test4a/file1 mytag
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
109 $DAV_SYNC_BIN add-tag -s test4a tmp-sync/test4a/file1 test1
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
110
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
111 # add xattr
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
112 ../../build/xattrtool set tmp-sync/test4a/file1 attr1 testvalue
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
113
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
114 # set mtime
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
115 touch -t 01011200 tmp-sync/test4a/file1
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
116
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
117 # +x
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
118 chmod +x tmp-sync/test4a/file1
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
119
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
120 dav_sync_push test4a "test 1: push failed"
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
121 check_tmpout "4 files pushed" "test 1: wrong push counter"
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
122 check_tmpout "0 conflicts" "test 1: wrong conflict counter (push)"
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
123 check_tmpout "0 errors" "test 1: wrong error counter (push)"
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
124
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
125 dav_sync_pull test4b "test 1: pull failed"
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
126 check_tmpout "4 files pulled" "test 1: wrong pull counter"
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
127 check_tmpout "0 conflicts" "test 1: wrong conflict counter (pull)"
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
128 check_tmpout "0 errors" "test 1: wrong error counter (pull)"
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
129
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
130 # check metadata
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
131 MTIMEA1=`stat -c %Y tmp-sync/test4a/file1`
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
132 MTIMEB1=`stat -c %Y tmp-sync/test4b/file1`
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
133
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
134 if [ "$MTIMEA1" != "$MTIMEB1" ]; then
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
135 echo "test 1: mtime not synced"
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
136 exit 2
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
137 fi
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
138
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
139 OUT=`tmp-sync/test4b/file1 2> /dev/null`
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
140 if [ "$OUT" != "file1out" ]; then
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
141 echo "test 1: not executable"
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
142 exit 2
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
143 fi
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
144
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
145 OUT=`../../build/xattrtool get tmp-sync/test4b/file1 attr1 2> /dev/null`
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
146 if [ "$OUT" != "testvalue" ]; then
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
147 echo "test 1: xattr not synced"
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
148 exit 2
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
149 fi
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
150
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
151 TAGS=`$DAV_SYNC_BIN list-tags -s test4b tmp-sync/test4b/file1 > tmp-sync/out.txt 2> /dev/null`
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
152 if [ $? -ne 0 ]; then
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
153 echo "test 1: list-tags failed"
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
154 exit 2
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
155 fi
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
156 check_tmpout "mytag" "test 1: file1: missing tag mytag"
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
157 check_tmpout "test1" "test 1: file1: missing tag test1"
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
158
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
159
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
160 # ----------------------------------------------------------------------------
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
161 # test 2: copy file (without xattr and tags) and sync
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
162 # expected result: WebDAV COPY, but metadata adjusted
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
163
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
164 cp tmp-sync/test4a/file1 tmp-sync/test4a/copy1
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
165
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
166 ../../xattrtool remove tmp-sync/test4a/copy1 tags > /dev/null 2>&1
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
167 ../../xattrtool remove tmp-sync/test4a/copy1 attr1 > /dev/null 2>&1
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
168
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
169 chmod -x tmp-sync/test4a/copy1
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
170
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
171 touch tmp-sync/test4a/copy1
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
172
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
173 dav_sync_push test4a "test 2: push failed"
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
174 check_tmpout "1 file pushed" "test 2: wrong push counter"
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
175 check_tmpout "0 conflicts" "test 2: wrong conflict counter (push)"
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
176 check_tmpout "0 errors" "test 2: wrong error counter (push)"
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
177 check_tmpout "copy" "test 2: no copy (push)"
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
178
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
179 dav_sync_pull test4b "test 2: pull failed"
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
180 check_tmpout "1 file pulled" "test 2: wrong pull counter"
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
181 check_tmpout "0 conflicts" "test 2: wrong conflict counter (pull)"
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
182 check_tmpout "0 errors" "test 2: wrong error counter (pull)"
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
183
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
184 # check metadata
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
185 MTIMEA1=`stat -c %Y tmp-sync/test4a/copy1 2> /dev/null`
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
186 MTIMEB1=`stat -c %Y tmp-sync/test4b/copy1 2> /dev/null`
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
187
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
188 if [ "$MTIMEA1" != "$MTIMEB1" ]; then
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
189 echo "test 2: mtime not synced"
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
190 exit 2
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
191 fi
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
192
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
193 OUT=`tmp-sync/test4b/copy1 2> /dev/null`
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
194 if [ $? -eq 0 ]; then
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
195 echo "test 2: copy1 should be executable"
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
196 exit 2
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
197 fi
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
198
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
199 TAGS=`$DAV_SYNC_BIN list-tags -s test4b tmp-sync/test4b/copy1 > tmp-sync/out.txt 2> /dev/null`
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
200 if [ $? -ne 0 ]; then
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
201 echo "test 2: list-tags failed"
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
202 exit 2
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
203 fi
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
204 LN=`cat tmp-sync/out.txt | wc -l`
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
205 if [ $LN -ne 0 ]; then
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
206 echo "test 2: list-tags not empty"
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
207 exit 2
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
208 fi
4bfe452a2665 fix dav-sync copy with enabled metadata sync
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
209

mercurial