Merge branch 'master' of ssh://git.privoxy.org:23/git/privoxy
[privoxy.git] / doc / webserver / developer-manual / testing.html
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
2 "http://www.w3.org/TR/html4/loose.dtd">
3 <html>
4 <head>
5   <title>Testing Guidelines</title>
6   <meta name="GENERATOR" content="Modular DocBook HTML Stylesheet Version 1.79">
7   <link rel="HOME" title="Privoxy Developer Manual" href="index.html">
8   <link rel="PREVIOUS" title="Coding Guidelines" href="coding.html">
9   <link rel="NEXT" title="Releasing a New Version" href="newrelease.html">
10   <link rel="STYLESHEET" type="text/css" href="../p_doc.css">
11   <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
12 </head>
13 <body class="SECT1" bgcolor="#EEEEEE" text="#000000" link="#0000FF" vlink="#840084" alink="#0000FF">
14   <div class="NAVHEADER">
15     <table summary="Header navigation table" width="100%" border="0" cellpadding="0" cellspacing="0">
16       <tr>
17         <th colspan="3" align="center">Privoxy Developer Manual</th>
18       </tr>
19       <tr>
20         <td width="10%" align="left" valign="bottom"><a href="coding.html" accesskey="P">Prev</a></td>
21         <td width="80%" align="center" valign="bottom"></td>
22         <td width="10%" align="right" valign="bottom"><a href="newrelease.html" accesskey="N">Next</a></td>
23       </tr>
24     </table>
25     <hr align="left" width="100%">
26   </div>
27   <div class="SECT1">
28     <h1 class="SECT1"><a name="TESTING" id="TESTING">5. Testing Guidelines</a></h1>
29     <p>To be filled.</p>
30     <div class="SECT2">
31       <h2 class="SECT2"><a name="TESTING-PLAN" id="TESTING-PLAN">5.1. Testplan for releases</a></h2>
32       <p>Explain release numbers. major, minor. developer releases. etc.</p>
33       <ol type="1">
34         <li>
35           <p>Remove any existing rpm with rpm -e</p>
36         </li>
37         <li>
38           <p>Remove any file that was left over. This includes (but is not limited to)</p>
39           <ul>
40             <li>
41               <p>/var/log/privoxy</p>
42             </li>
43             <li>
44               <p>/etc/privoxy</p>
45             </li>
46             <li>
47               <p>/usr/sbin/privoxy</p>
48             </li>
49             <li>
50               <p>/etc/init.d/privoxy</p>
51             </li>
52             <li>
53               <p>/usr/doc/privoxy*</p>
54             </li>
55           </ul>
56         </li>
57         <li>
58           <p>Install the rpm. Any error messages?</p>
59         </li>
60         <li>
61           <p>start,stop,status <span class="APPLICATION">Privoxy</span> with the specific script (e.g.
62           /etc/rc.d/init/privoxy stop). Reboot your machine. Does autostart work?</p>
63         </li>
64         <li>
65           <p>Start browsing. Does <span class="APPLICATION">Privoxy</span> work? Logfile written?</p>
66         </li>
67         <li>
68           <p>Remove the rpm. Any error messages? All files removed?</p>
69         </li>
70       </ol>
71     </div>
72     <div class="SECT2">
73       <h2 class="SECT2"><a name="PRIVOXY-REGRESSION-TEST" id="PRIVOXY-REGRESSION-TEST">5.2. Testing with <span class=
74       "APPLICATION">Privoxy-Regression-Test</span></a></h2>
75       <p>If you compiled, packaged or merely installed Privoxy, it is recommended to run <span class=
76       "APPLICATION">Privoxy-Regression-Test</span> to verify that at least the tested parts of <span class=
77       "APPLICATION">Privoxy</span> are working as expected.</p>
78       <p>This is actually pretty easy. For details, please see <b class="COMMAND">perldoc
79       privoxy-regression-test.pl</b>.</p>
80     </div>
81     <div class="SECT2">
82       <h2 class="SECT2"><a name="FUZZING" id="FUZZING">5.3. Fuzzing Privoxy</a></h2>
83       <p>To make fuzzing more convenient, Privoxy can be configured with --enable-fuzz which will result in the --fuzz
84       option becoming available.</p>
85       <p>Example (tested on ElectroBSD):</p>
86       <table border="0" bgcolor="#E0E0E0" width="100%">
87         <tr>
88           <td>
89             <pre class="PROGRAMLISTING"># Compile Privoxy with instrumentation for afl
90 $ export CC=afl-clang
91 $ export CFLAGS="-fsanitize=address -ggdb"
92 $ export CPPFLAGS=-I/usr/local/include/
93 $ export LDFLAGS="-fsanitize=address -L/usr/local/lib"
94 $ export AFL_USE_ASAN=1
95 $ export AFL_HARDEN=1
96 $ ./configure --with-debug --enable-extended-host-patterns --enable-accept-filter --enable-no-gifs --enable-compression --enable-strptime-sanity-checks --enable-external-filters --enable-fuzz
97
98 $ ./privoxy --fuzz
99 Privoxy version 3.0.24 (http://www.privoxy.org/)
100 Usage: ./privoxy [--config-test] [--chroot] [--help] [--no-daemon] [--pidfile pidfile] [--pre-chroot-nslookup hostname] [--user user[.group]] [--version] [configfile]
101        ./privoxy --fuzz fuzz-mode ./path/to/fuzzed/input [--stfu]
102
103 Supported fuzz modes and the expected input:
104  action: Text to parse as action file.
105  client-request: Client request to parse. Currently incomplete
106  client-header: Client header to parse.
107  chunked-transfer-encoding: Chunk-encoded data to dechunk.
108  deflate: deflate-compressed data to decompress.
109  filter: Text to parse as filter file.
110  gif: gif to deanimate.
111  gzip: gzip-compressed data to decompress.
112  pcrs-substitute: A pcrs-substitute to compile. Not a whole pcrs job! Example: Bla $1 bla C $3 blah.
113  server-header: Server header to parse.
114  server-response: Server response to parse.
115
116 The following fuzz modes read data from stdin if the 'file' is '-'
117  client-request
118  client-header
119  chunked-transfer-encoding
120  deflate
121  gif
122  gzip
123  pcrs-substitute
124  server-header
125  server-response
126
127 Aborting
128
129 $ export ASAN_OPTIONS='abort_on_error=1'
130 $ mkdir input output
131 $ echo '$1 bla fasel $2' &#62; input/pcrs
132 $ afl-fuzz -i input -o output -m none ~/git/privoxy/privoxy --fuzz pcrs-substitute - --stfu
133
134 $ cat &#62;input/pcrs.txt
135 FILTER: bla fasel
136 s@(.{1})[432](\d+)@$1$2$hostname@UgisT
137
138 $ afl-fuzz -i input/ -o output/ -f bla.filter -m none privoxy --fuzz filter bla.filter --stfu</pre>
139           </td>
140         </tr>
141       </table>
142     </div>
143   </div>
144   <div class="NAVFOOTER">
145     <hr align="left" width="100%">
146     <table summary="Footer navigation table" width="100%" border="0" cellpadding="0" cellspacing="0">
147       <tr>
148         <td width="33%" align="left" valign="top"><a href="coding.html" accesskey="P">Prev</a></td>
149         <td width="34%" align="center" valign="top"><a href="index.html" accesskey="H">Home</a></td>
150         <td width="33%" align="right" valign="top"><a href="newrelease.html" accesskey="N">Next</a></td>
151       </tr>
152       <tr>
153         <td width="33%" align="left" valign="top">Coding Guidelines</td>
154         <td width="34%" align="center" valign="top">&nbsp;</td>
155         <td width="33%" align="right" valign="top">Releasing a New Version</td>
156       </tr>
157     </table>
158   </div>
159 </body>
160 </html>