source: mod_gnutls/test/proxy_backend.bash @ 8184ad0

debian/masterdebian/stretch-backportsupstream
Last change on this file since 8184ad0 was 8184ad0, checked in by Thomas Klute <thomas2.klute@…>, 2 years ago

Test suite: Run flock with "--verbose" to log timeouts

  • Property mode set to 100644
File size: 1.2 KB
Line 
1#!/bin/bash
2
3set -e
4. ${srcdir}/common.bash
5
6if [ -z "${BACKEND_HOST}" ]; then
7    export BACKEND_HOST="localhost"
8fi
9if [ -z "${BACKEND_IP}" ]; then
10    export BACKEND_IP="::1"
11fi
12if [ -z "${BACKEND_PORT}" ]; then
13    export BACKEND_PORT="9934"
14fi
15: ${BACKEND_PID:="backend.pid"}
16: ${srcdir:="."}
17: ${APACHE2:="apache2"}
18: ${TEST_LOCK_WAIT:="30"}
19
20function backend_apache
21{
22    dir="${1}"
23    conf="${2}"
24    action="${3}"
25    lockfile="${4}"
26
27    TEST_NAME="$(basename "${dir}")"
28    (
29        export TEST_NAME
30        export TEST_IP="${BACKEND_IP}"
31        export TEST_PORT="${BACKEND_PORT}"
32        export srcdir="$(realpath ${srcdir})"
33        case $action in
34            start)
35                if [ -n "${USE_TEST_NAMESPACE}" ]; then
36                    echo "Using namespaces to isolate tests, no need for" \
37                         "locking."
38                    flock_cmd=""
39                elif [ -n "${lockfile}" ]; then
40                    flock_cmd="${FLOCK} --verbose -w ${TEST_LOCK_WAIT} ${lockfile}"
41                else
42                    echo "Locking disabled, using wait based on proxy PID file."
43                    wait_pid_gone "${BACKEND_PID}"
44                    flock_cmd=""
45                fi
46                ${flock_cmd} \
47                    ${APACHE2} -f "$(realpath ${testdir}/${conf})" -k start || return 1
48                ;;
49            stop)
50                ${APACHE2} -f "$(realpath ${testdir}/${conf})" -k stop || return 1
51                ;;
52        esac
53    )
54}
Note: See TracBrowser for help on using the repository browser.