source: mod_gnutls/test/proxy_backend.bash @ 97d7c63

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

Test suite: Port config for proxy backend in Makefile and Apache config

The shell function for server start does not need to care about the
port assignment any more, simplifying the code.

  • Property mode set to 100644
File size: 1.0 KB
Line 
1#!/bin/bash
2
3set -e
4. ${srcdir}/common.bash
5
6function backend_apache
7{
8    # needed for start and stop
9    dir="${1}"
10    conf="${2}"
11    action="${3}"
12    # Needed only for start. The "lockfile" parameter is used as flock
13    # lock file or PID file to watch depending on whether FLOCK is
14    # set.
15    lockfile="${4}"
16
17    TEST_NAME="$(basename "${dir}")"
18    (
19        export TEST_NAME
20        export srcdir="$(realpath ${srcdir})"
21        local flock_cmd=""
22        case ${action} in
23            start)
24                if [ -n "${USE_TEST_NAMESPACE}" ]; then
25                    echo "Using namespaces to isolate tests, no need for" \
26                         "locking."
27                elif [ -n "${FLOCK}" ]; then
28                    flock_cmd="${FLOCK} -w ${TEST_LOCK_WAIT} ${lockfile}"
29                else
30                    echo "Locking disabled, using wait based on proxy PID file."
31                    wait_pid_gone "${lockfile}"
32                fi
33                ${flock_cmd} \
34                    ${APACHE2} -f "$(realpath ${testdir}/${conf})" -k start || return 1
35                ;;
36            stop)
37                ${APACHE2} -f "$(realpath ${testdir}/${conf})" -k stop || return 1
38                ;;
39            *)
40                echo "${FUNCNAME[0]}: Invalid action \"${action}\"." >&2
41                exit 1
42                ;;
43        esac
44    )
45}
Note: See TracBrowser for help on using the repository browser.