Merge Debian 3.0.33-2 (UNRELEASED) changes.
[privoxy.git] / debian / tests / conditional-defines
1 #!/bin/sh
2 #
3 # Check http://config.privoxy.org/show-status for Conditional #defines enabled
4 # This wrapper starts privoxy on port 8119 and runs conditional-defines.pl
5 #
6 # (c) 2022 Roland Rosenfeld <roland@debian.org>
7
8 PORT=8119
9
10 TESTSDIR=$(dirname "$0")
11
12 if [ -z "$AUTOPKGTEST_TMP" ]; then
13     AUTOPKGTEST_TMP=$(mktemp -d)
14 fi
15
16 trap 'rm -rf "$AUTOPKGTEST_TMP"' EXIT
17
18 CONFIG=$AUTOPKGTEST_TMP/config
19 PIDFILE=$AUTOPKGTEST_TMP/privoxy.pid
20 PRIVOXY=$AUTOPKGTEST_TMP/privoxy
21
22 sed -e "s/^listen-address.*/listen-address 127.0.0.1:$PORT/" \
23     -e "s%^logdir.*%logdir $AUTOPKGTEST_TMP%" \
24     < /usr/share/privoxy/config > "$CONFIG"
25
26 cp /usr/sbin/privoxy "$PRIVOXY"
27
28 echo "Starting privoxy on port $PORT"
29 $PRIVOXY --pidfile "$PIDFILE" "$CONFIG"
30
31 http_proxy=http://127.0.0.1:$PORT/
32 export http_proxy
33
34 "$TESTSDIR"/conditional-defines.pl
35 EXITVAL=$?
36
37 echo "Stopping privoxy on port $PORT"
38 # shellcheck disable=SC2046
39 kill $(cat "$PIDFILE")
40
41 exit $EXITVAL