1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
|
#!/bin/sh
set -e
#CURDIR=$(realpath $(dirname "$0"))
CURDIR=$(dirname "$0")
cleanup() {
[ ! -f "$WORKDIR/pid" ] || kill $(cat "$WORKDIR/pid")
rm --preserve-root -rf $WORKDIR
}
WORKDIR=$(mktemp -d)
trap cleanup 0 INT QUIT ABRT PIPE TERM
# config
cat <<EOF > $WORKDIR/config
[auth]
type=htpasswd
htpasswd_filename=$WORKDIR/passwd
htpasswd_encryption=plain
[storage]
type=multifilesystem
filesystem_folder=$WORKDIR/data/
filesystem_locking = False
filesystem_fsync = False
[logging]
config = $WORKDIR/logging
mask_passwords = False
[rights]
type = from_file
file = $WORKDIR/rights
EOF
# logging
cat <<EOF > $WORKDIR/logging
[loggers]
keys = root
[handlers]
keys = file
[formatters]
keys = simple
[logger_root]
level = DEBUG
handlers = file
[handler_file]
class = FileHandler
args = ('$WORKDIR/log',)
formatter = simple
[formatter_simple]
format = %(message)s
EOF
# accounts
echo > "$WORKDIR/passwd"
for u in $(seq --format '%02g' 1 40); do
echo "user$u:user$u" >> "$WORKDIR/passwd"
done
echo "i18nuser:i18nuser" >> "$WORKDIR/passwd"
# rights
cat <<EOF >> $WORKDIR/rights
[owner-write]
user: .+
collection: ^%(login)s(/.*)?$
permission: rw
EOF
# testsuite
$CURDIR/create-serverinfo-config > "$WORKDIR/serverinfo.xml"
# Run the server
HOME="$WORKDIR" radicale --no-ssl --daemon --pid="$WORKDIR/pid" --config="$WORKDIR/config"
sleep 2
# Run the tests
testcaldav --print-details-onfail -s "$WORKDIR/serverinfo.xml" "$@" 2>&1 | tee -a "$WORKDIR/testlog" \
|| {
echo "BEGIN Radicale log"
cat "$WORKDIR/log"
echo "END Radicale log"
[ -n "$FAIL_OK" ] || false
}
rm -rf "$WORKDIR/.config"
echo "run: OK"
|