source: mod_gnutls/test/proxy_backend.bash @ 62ba7f0

debian/masterdebian/stretch-backportsjessie-backportsupstream
Last change on this file since 62ba7f0 was 412ee84, checked in by Thomas Klute <thomas2.klute@…>, 4 years ago

Test suite: Allow the user to disable use of "flock"

Using "flock" causes trouble on some exotic architectures (e.g. Hurd),
so allow disabling it. Running without lock files requires serial
execution of test cases to achieve reliable results.

  • Property mode set to 100644
File size: 1.0 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 "${lockfile}" ]; then
36                    flock_cmd="${FLOCK} -w ${TEST_LOCK_WAIT} ${lockfile}"
37                else
38                    echo "Locking disabled, using wait based on proxy PID file."
39                    wait_pid_gone "${BACKEND_PID}"
40                    flock_cmd=""
41                fi
42                ${flock_cmd} \
43                    ${APACHE2} -f "$(realpath ${testdir}/${conf})" -k start || return 1
44                ;;
45            stop)
46                ${APACHE2} -f "$(realpath ${testdir}/${conf})" -k stop || return 1
47                ;;
48        esac
49    )
50}
Note: See TracBrowser for help on using the repository browser.