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

Sun, 17 Dec 2023 15:33:50 +0100

author
Mike Becker <universe@uap-core.de>
date
Sun, 17 Dec 2023 15:33:50 +0100
changeset 800
30d484806c2b
parent 770
fcb243cb9950
permissions
-rwxr-xr-x

fix faulty string to int conversion utilities

Probably it was expected that errno is set to EINVAL when illegal characters are encountered. But this is not standard and does not happen on every system, allowing illegal strings to be parsed as valid integers.

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

mercurial