Sun, 16 Jun 2019 13:14:24 +0200
add new session flags for properties encryption
571
f6de48471c9c
add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1 | #!/bin/sh |
f6de48471c9c
add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
2 | # |
f6de48471c9c
add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
3 | # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
f6de48471c9c
add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
4 | # |
f6de48471c9c
add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
5 | # Copyright 2019 Olaf Wintermann. All rights reserved. |
f6de48471c9c
add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
6 | # |
f6de48471c9c
add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
7 | # Redistribution and use in source and binary forms, with or without |
f6de48471c9c
add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
8 | # modification, are permitted provided that the following conditions are met: |
f6de48471c9c
add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
9 | # |
f6de48471c9c
add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
10 | # 1. Redistributions of source code must retain the above copyright |
f6de48471c9c
add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
11 | # notice, this list of conditions and the following disclaimer. |
f6de48471c9c
add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
12 | # |
f6de48471c9c
add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
13 | # 2. Redistributions in binary form must reproduce the above copyright |
f6de48471c9c
add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
14 | # notice, this list of conditions and the following disclaimer in the |
f6de48471c9c
add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
15 | # documentation and/or other materials provided with the distribution. |
f6de48471c9c
add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
16 | # |
f6de48471c9c
add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
17 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
f6de48471c9c
add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
18 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
f6de48471c9c
add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
19 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
f6de48471c9c
add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
20 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE |
f6de48471c9c
add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
21 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
f6de48471c9c
add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
22 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
f6de48471c9c
add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
23 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
f6de48471c9c
add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
24 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
f6de48471c9c
add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
25 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
f6de48471c9c
add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
26 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
f6de48471c9c
add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
27 | # POSSIBILITY OF SUCH DAMAGE. |
f6de48471c9c
add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
28 | # |
f6de48471c9c
add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
29 | |
f6de48471c9c
add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
30 | if [ $# -lt 2 ]; |
f6de48471c9c
add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
31 | then |
f6de48471c9c
add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
32 | echo "usage:" $0 "<dav-binary> <dav-sync-binary>" |
f6de48471c9c
add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
33 | exit 1 |
f6de48471c9c
add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
34 | fi |
f6de48471c9c
add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
35 | |
f6de48471c9c
add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
36 | # check if binaries exist |
f6de48471c9c
add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
37 | which $1 > /dev/null |
f6de48471c9c
add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
38 | if [ $? -ne 0 ]; |
f6de48471c9c
add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
39 | then |
f6de48471c9c
add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
40 | exit 1 |
f6de48471c9c
add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
41 | fi |
f6de48471c9c
add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
42 | which $2 > /dev/null |
f6de48471c9c
add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
43 | if [ $? -ne 0 ]; |
f6de48471c9c
add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
44 | then |
f6de48471c9c
add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
45 | exit 1 |
f6de48471c9c
add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
46 | fi |
f6de48471c9c
add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
47 | |
f6de48471c9c
add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
48 | DAV_BIN=$1 |
f6de48471c9c
add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
49 | DAV_SYNC_BIN=$2 |
f6de48471c9c
add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
50 | export DAV_BIN |
f6de48471c9c
add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
51 | export DAV_SYNC_BIN |
f6de48471c9c
add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
52 | |
f6de48471c9c
add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
53 | # create config |
f6de48471c9c
add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
54 | rm -Rf .dav |
f6de48471c9c
add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
55 | cp -R $HOME/.dav/ .dav/ |
f6de48471c9c
add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
56 | cp dav-home/sync.xml .dav/sync.xml |
f6de48471c9c
add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
57 | export HOME=`pwd` |
f6de48471c9c
add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
58 | |
f6de48471c9c
add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
59 | # tmp sync dir |
f6de48471c9c
add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
60 | rm -Rf tmp-sync |
f6de48471c9c
add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
61 | mkdir tmp-sync |
f6de48471c9c
add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
62 | mkdir tmp-sync/test1a |
f6de48471c9c
add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
63 | mkdir tmp-sync/test1b |
f6de48471c9c
add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
64 | |
f6de48471c9c
add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
65 | # check if config works |
f6de48471c9c
add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
66 | TEST1_DIR=`$DAV_SYNC_BIN list-dirs | grep test1a | tail -n 1` |
f6de48471c9c
add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
67 | if [ -z $TEST1_DIR ]; |
f6de48471c9c
add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
68 | then |
f6de48471c9c
add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
69 | echo "Config not working" |
f6de48471c9c
add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
70 | rm -Rf .dav |
f6de48471c9c
add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
71 | rm -Rf tmp-sync |
f6de48471c9c
add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
72 | exit 1 |
f6de48471c9c
add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
73 | fi |
f6de48471c9c
add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
74 | |
f6de48471c9c
add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
75 | # clean test repo and files |
f6de48471c9c
add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
76 | $DAV_BIN rm -N dav-test-repo/tests/ 2> /dev/null |
f6de48471c9c
add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
77 | $DAV_BIN rm -N dav-test-repo/sync/ 2> /dev/null |
f6de48471c9c
add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
78 | |
f6de48471c9c
add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
79 | do_test() |
f6de48471c9c
add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
80 | { |
f6de48471c9c
add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
81 | printf "TEST: $1 ... " |
f6de48471c9c
add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
82 | ./$2 |
f6de48471c9c
add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
83 | if [ $? -ne 0 ]; then |
f6de48471c9c
add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
84 | rm -Rf .dav |
f6de48471c9c
add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
85 | exit 2 |
f6de48471c9c
add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
86 | fi |
f6de48471c9c
add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
87 | echo ok |
f6de48471c9c
add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
88 | } |
f6de48471c9c
add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
89 | |
f6de48471c9c
add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
90 | # |
f6de48471c9c
add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
91 | # ok, begin the tests |
f6de48471c9c
add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
92 | # |
f6de48471c9c
add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
93 | do_test "dav-sync push (1)" test-dav-sync-push1.sh |
f6de48471c9c
add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
94 | |
f6de48471c9c
add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
95 | # cleanup |
f6de48471c9c
add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
96 | rm -Rf .dav |
f6de48471c9c
add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
97 | rm -Rf tmp-sync |
f6de48471c9c
add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
98 |