test/bin-test/test-dav.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 686
ab159748055c
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.

418
cfdeeed64ac5 adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1 #!/bin/sh
cfdeeed64ac5 adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
2 #
cfdeeed64ac5 adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
cfdeeed64ac5 adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
4 #
571
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 425
diff changeset
5 # Copyright 2019 Olaf Wintermann. All rights reserved.
418
cfdeeed64ac5 adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
6 #
cfdeeed64ac5 adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
7 # Redistribution and use in source and binary forms, with or without
cfdeeed64ac5 adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
8 # modification, are permitted provided that the following conditions are met:
cfdeeed64ac5 adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
9 #
cfdeeed64ac5 adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
10 # 1. Redistributions of source code must retain the above copyright
cfdeeed64ac5 adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
11 # notice, this list of conditions and the following disclaimer.
cfdeeed64ac5 adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
12 #
cfdeeed64ac5 adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
13 # 2. Redistributions in binary form must reproduce the above copyright
cfdeeed64ac5 adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
14 # notice, this list of conditions and the following disclaimer in the
cfdeeed64ac5 adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
15 # documentation and/or other materials provided with the distribution.
cfdeeed64ac5 adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
16 #
cfdeeed64ac5 adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
17 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
cfdeeed64ac5 adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
18 # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
cfdeeed64ac5 adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
19 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
cfdeeed64ac5 adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
20 # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
cfdeeed64ac5 adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
21 # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
cfdeeed64ac5 adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
22 # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
cfdeeed64ac5 adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
23 # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
cfdeeed64ac5 adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
24 # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
cfdeeed64ac5 adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
25 # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
cfdeeed64ac5 adds shellscript test-suite for binaries
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
cfdeeed64ac5 adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
27 # POSSIBILITY OF SUCH DAMAGE.
cfdeeed64ac5 adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
28 #
cfdeeed64ac5 adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
29
cfdeeed64ac5 adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
30 if [ $# -lt 1 ];
cfdeeed64ac5 adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
31 then
cfdeeed64ac5 adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
32 echo "usage:" $0 "<dav-binary>"
cfdeeed64ac5 adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
33 exit 1
cfdeeed64ac5 adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
34 fi
cfdeeed64ac5 adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
35
cfdeeed64ac5 adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
36 # check if dav binary exists
cfdeeed64ac5 adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
37 which $1 > /dev/null
cfdeeed64ac5 adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
38 if [ $? -ne 0 ];
cfdeeed64ac5 adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
39 then
cfdeeed64ac5 adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
40 exit 1
cfdeeed64ac5 adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
41 fi
cfdeeed64ac5 adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
42
cfdeeed64ac5 adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
43 DAV_BIN=$1
cfdeeed64ac5 adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
44 export DAV_BIN
cfdeeed64ac5 adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
45
cfdeeed64ac5 adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
46 # check for test repository
cfdeeed64ac5 adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
47 TEST_REPO=`$DAV_BIN list-repos | grep dav-test-repo`
424
f851ba530957 fixes dav test script
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 422
diff changeset
48 if [ -z $TEST_REPO ];
418
cfdeeed64ac5 adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
49 then
cfdeeed64ac5 adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
50 echo "A dav repository with the name 'dav-test-repo' is needed."
cfdeeed64ac5 adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
51 exit 1
cfdeeed64ac5 adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
52 fi
cfdeeed64ac5 adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
53
686
ab159748055c add more symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 571
diff changeset
54 # clear test repo
ab159748055c add more symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 571
diff changeset
55 dav rm dav-test-repo/tests > /dev/null 2>&1
ab159748055c add more symlink tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 571
diff changeset
56
422
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
57 do_test()
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
58 {
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
59 printf "TEST: $1 ... "
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
60 ./$2
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
61 if [ $? -ne 0 ]; then
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
62 exit 2
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
63 fi
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
64 echo ok
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
65 }
418
cfdeeed64ac5 adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
66
cfdeeed64ac5 adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
67 # clean test repo
571
f6de48471c9c add first dav-sync binary tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 425
diff changeset
68 $DAV_BIN rm -N dav-test-repo/sync/ 2> /dev/null
418
cfdeeed64ac5 adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
69
cfdeeed64ac5 adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
70 #
cfdeeed64ac5 adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
71 # ok, begin the tests
cfdeeed64ac5 adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
72 #
cfdeeed64ac5 adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
73
422
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
74 do_test "dav info" test-dav-info.sh
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
75 do_test "dav mkcol" test-dav-mkcol.sh
1429fb385513 finishes dav put tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 421
diff changeset
76 do_test "dav put" test-dav-put.sh
425
ae4d89c3477c fixes dav list return value
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 424
diff changeset
77 do_test "dav list" test-dav-list.sh
418
cfdeeed64ac5 adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
78
425
ae4d89c3477c fixes dav list return value
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 424
diff changeset
79

mercurial