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