3122a1a6ccb87367fbe30e326515c65160d98b4e
[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) 2016 Roland Rosenfeld <roland@debian.org>
7
8 PORT=8119
9
10 if [ -z "$ADTTMP" ]; then
11     ADTTMP=$(mktemp -d)
12 fi
13
14 CONFIG=$ADTTMP/config
15 PIDFILE=$ADTTMP/privoxy.pid
16 sed -e "s/^listen-address.*/listen-address 127.0.0.1:$PORT/" \
17     -e "s%^logdir.*%logdir $ADTTMP%" \
18     -e "s/^enable-edit-actions.*/enable-edit-actions 1/" \
19     -e "s/^keep-alive-timeout.*/keep-alive-timeout 21/" \
20     -e "s/^#connection-sharing.*/connection-sharing 1/" \
21     < /usr/share/privoxy/config > $CONFIG
22 echo "actionsfile regression-tests.action" >> $CONFIG
23
24 echo "Starting privoxy on port $PORT"
25 /usr/sbin/privoxy --pidfile $PIDFILE $CONFIG
26
27 http_proxy=http://127.0.0.1:$PORT/
28 export http_proxy
29
30 OUTFILE=$ADTTMP/output
31
32 /usr/bin/privoxy-regression-test --max-level 200 --show-skipped-tests \
33     | tee $OUTFILE 2>&1
34
35 echo "Stopping privoxy on port $PORT"
36 kill $(cat $PIDFILE)
37
38 if grep -q 'Executed.*, 0 failures.' $OUTFILE
39 then
40     exit 0
41 else
42     exit 1
43 fi
44