asynciodebian/masterdebian/stretch-backportsjessie-backportsproxy-ticketupstream
Last change
on this file since c0bb823 was
f87c1b5,
checked in by Thomas Klute <thomas2.klute@…>, 5 years ago
|
Test suite: Run proxy backend servers in parallel if namespaces are enabled
|
-
Property mode set to
100644
|
File size:
1.2 KB
|
Line | |
---|
1 | #!/bin/bash |
---|
2 | |
---|
3 | set -e |
---|
4 | . ${srcdir}/common.bash |
---|
5 | |
---|
6 | if [ -z "${BACKEND_HOST}" ]; then |
---|
7 | export BACKEND_HOST="localhost" |
---|
8 | fi |
---|
9 | if [ -z "${BACKEND_IP}" ]; then |
---|
10 | export BACKEND_IP="::1" |
---|
11 | fi |
---|
12 | if [ -z "${BACKEND_PORT}" ]; then |
---|
13 | export BACKEND_PORT="9934" |
---|
14 | fi |
---|
15 | : ${BACKEND_PID:="backend.pid"} |
---|
16 | : ${srcdir:="."} |
---|
17 | : ${APACHE2:="apache2"} |
---|
18 | : ${TEST_LOCK_WAIT:="30"} |
---|
19 | |
---|
20 | function 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} -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.