source: mod_gnutls/test/apache_service.bash @ acea635

Last change on this file since acea635 was 1872744, checked in by Thomas Klute <thomas2.klute@…>, 3 years ago

Test suite: Rename bash function backend_apache to apache_service

  • Property mode set to 100644
File size: 1.1 KB
3set -e
[412ee84]4. ${srcdir}/common.bash
[1872744]6function apache_service
[cdc6e4a]8    # needed for start and stop
[c9e4709]9    local dir="${1}"
10    local conf="${2}"
11    local action="${3}"
[94430e6]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.
[c9e4709]15    local lockfile="${4}"
17    TEST_NAME="$(basename "${dir}")"
18    (
19        export TEST_NAME
[33af2b7]20        export srcdir="$(realpath ${srcdir})"
[cdc6e4a]21        local flock_cmd=""
22        case ${action} in
[f84890d]23            start)
[f87c1b5]24                if [ -n "${USE_TEST_NAMESPACE}" ]; then
25                    echo "Using namespaces to isolate tests, no need for" \
26                         "locking."
[cdc6e4a]27                elif [ -n "${FLOCK}" ]; then
[4ae5b82]28                    flock_cmd="${FLOCK} -w ${TEST_LOCK_WAIT} ${lockfile}"
[412ee84]29                else
30                    echo "Locking disabled, using wait based on proxy PID file."
[94430e6]31                    wait_pid_gone "${lockfile}"
[412ee84]32                fi
[f84890d]33                ${flock_cmd} \
[c9e4709]34                    ${APACHE2} -f "$(realpath ${dir}/${conf})" -k start || return 1
[f84890d]35                ;;
36            stop)
[c9e4709]37                ${APACHE2} -f "$(realpath ${dir}/${conf})" -k stop || return 1
[f84890d]38                ;;
[cdc6e4a]39            *)
40                echo "${FUNCNAME[0]}: Invalid action \"${action}\"." >&2
41                exit 1
42                ;;
[f84890d]43        esac
44    )
Note: See TracBrowser for help on using the repository browser.