Apply Debian package changes 3.0.28-1 and 3.0.28-2
[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 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 sed -e "s/^listen-address.*/listen-address 127.0.0.1:$PORT/" \
19     -e "s%^logdir.*%logdir $AUTOPKGTEST_TMP%" \
20     -e "s/^enable-edit-actions.*/enable-edit-actions 1/" \
21     -e "s/^keep-alive-timeout.*/keep-alive-timeout 21/" \
22     -e "s/^#connection-sharing.*/connection-sharing 1/" \
23     < /usr/share/privoxy/config > $CONFIG
24 echo "actionsfile regression-tests.action" >> $CONFIG
25
26 echo "Starting privoxy on port $PORT"
27 /usr/sbin/privoxy --pidfile $PIDFILE $CONFIG
28
29 http_proxy=http://127.0.0.1:$PORT/
30 export http_proxy
31
32 OUTFILE=$AUTOPKGTEST_TMP/output
33
34 /usr/bin/privoxy-regression-test --max-level 200 --show-skipped-tests \
35     | tee $OUTFILE 2>&1
36
37 echo "Stopping privoxy on port $PORT"
38 kill $(cat $PIDFILE)
39
40 if grep -q 'Executed.*, 0 failures.' $OUTFILE
41 then
42     exit 0
43 else
44     exit 1
45 fi
46