privoxy-log-parser: Bump copyright
[privoxy.git] / debian / tests / privoxy-regression-test
1 #!/bin/sh
2 #
3 # Run privoxy-regression-test.pl on a configuration extended by
4 # regression-tests.action.
5 #
6 # (c) 2018-2021 Roland Rosenfeld <roland@debian.org>
7
8 PORT=8119
9
10 if [ -z "$AUTOPKGTEST_TMP" ]; then
11     AUTOPKGTEST_TMP=$(mktemp -d)
12 fi
13
14 trap "rm -rf $AUTOPKGTEST_TMP" EXIT
15
16 CONFIG=$AUTOPKGTEST_TMP/config
17 PIDFILE=$AUTOPKGTEST_TMP/privoxy.pid
18 PRIVOXY=$AUTOPKGTEST_TMP/privoxy
19
20 sed -e "s/^listen-address.*/listen-address 127.0.0.1:$PORT/" \
21     -e "s%^logdir.*%logdir $AUTOPKGTEST_TMP%" \
22     -e "s/^enable-edit-actions.*/enable-edit-actions 1/" \
23     -e "s/^keep-alive-timeout.*/keep-alive-timeout 21/" \
24     -e "s/^#connection-sharing.*/connection-sharing 1/" \
25     < /usr/share/privoxy/config > $CONFIG
26 echo "actionsfile regression-tests.action" >> $CONFIG
27
28 cp /usr/sbin/privoxy $PRIVOXY
29
30 echo "Starting privoxy on port $PORT"
31 $PRIVOXY --pidfile $PIDFILE $CONFIG
32
33 http_proxy=http://127.0.0.1:$PORT/
34 export http_proxy
35
36 OUTFILE=$AUTOPKGTEST_TMP/output
37
38 /usr/bin/privoxy-regression-test --max-level 200 --show-skipped-tests \
39     | tee $OUTFILE 2>&1
40
41 echo "Stopping privoxy on port $PORT"
42 kill $(cat $PIDFILE)
43
44 if grep -q 'Executed.*, 0 failures.' $OUTFILE
45 then
46     exit 0
47 else
48     exit 1
49 fi
50