git-svn: trunk@3967
Török Edvin authored on 2008/07/17 01:32:27... | ... |
@@ -247,6 +247,7 @@ |
247 | 247 |
A note for Solaris/SPARC users: you must set the \emph{ABI} system |
248 | 248 |
variable to 32 (e.g. \verb+setenv ABI 32+) before running the |
249 | 249 |
configuration script of GMP. |
250 |
+ \item \verb+check+ unit testing framework \footnote{See section \ref{unit-testing} on how to run the unit tests}. |
|
250 | 251 |
\end{itemize} |
251 | 252 |
|
252 | 253 |
\subsection{Installing on shell account} |
... | ... |
@@ -302,6 +303,80 @@ |
302 | 302 |
$ ./configure --enable-milter |
303 | 303 |
\end{verbatim} |
304 | 304 |
|
305 |
+ \subsection{Running unit tests}\label{unit-testing} |
|
306 |
+ ClamAV includes unit tests that allow you to test that the compiled binaries work correctly on your platform. |
|
307 |
+ |
|
308 |
+ The first step is to use your OS's package manager to install the \verb+check+ package. |
|
309 |
+ If your OS doesn't have that package, you can download it from \url{http://check.sourceforge.net/}, |
|
310 |
+ build it and install it. |
|
311 |
+ |
|
312 |
+ To help clamav's configure script locate \verb+check+, it is recommended that you install \verb+pkg-config+, preferably |
|
313 |
+ using your OS's package manager, or from \url{http://pkg-config.freedesktop.org}. |
|
314 |
+ |
|
315 |
+ The recommended way to run unit-tests is the following, which ensures you will get an error if unit tests cannot be built: |
|
316 |
+ \footnote{The configure script in ClamAV automatically enables the unit tests, if it finds the check framework, however it doesn't consider it a fatal error if unit tests cannot be enabled.} |
|
317 |
+ \begin{verbatim} |
|
318 |
+ $ ./configure --enable-check |
|
319 |
+ $ make |
|
320 |
+ $ make check |
|
321 |
+ \end{verbatim} |
|
322 |
+ |
|
323 |
+ When \verb+make check+ is finished, you should get a message similar to this: |
|
324 |
+ \begin{verbatim} |
|
325 |
+================== |
|
326 |
+All 5 tests passed |
|
327 |
+================== |
|
328 |
+ \end{verbatim} |
|
329 |
+ |
|
330 |
+ If a unit test fails, you get a message similar to the following. |
|
331 |
+ See the next section on how to report a bug when a unit test fails. |
|
332 |
+ \begin{verbatim} |
|
333 |
+======================================== |
|
334 |
+1 of 5 tests failed |
|
335 |
+Please report to http://bugs.clamav.net/ |
|
336 |
+======================================== |
|
337 |
+ \end{verbatim} |
|
338 |
+ |
|
339 |
+ If unit tests are disabled (and you didn't use --enable-check), you will get this message: |
|
340 |
+ \begin{verbatim} |
|
341 |
+*** Unit tests disabled in this build |
|
342 |
+*** Use ./configure --enable-check to enable them |
|
343 |
+ |
|
344 |
+SKIP: check_clamav |
|
345 |
+PASS: check_clamd.sh |
|
346 |
+PASS: check_freshclam.sh |
|
347 |
+PASS: check_sigtool.sh |
|
348 |
+PASS: check_clamscan.sh |
|
349 |
+====================== |
|
350 |
+All 4 tests passed |
|
351 |
+(1 tests were not run) |
|
352 |
+====================== |
|
353 |
+ \end{verbatim} |
|
354 |
+ Running \verb+./configure --enable-check+ should tell you why. |
|
355 |
+ |
|
356 |
+ \subsection{Reporting a unit test failure bug} |
|
357 |
+ If \verb+make check+ says that some tests failed we encourage you to report a bug on our bugzilla: \url{http://bugs.clamav.net}. |
|
358 |
+ The information we need is (see also \url{http://clamav.net/bugs}): |
|
359 |
+ \begin{itemize} |
|
360 |
+ \item The exact output from \verb+make check+ |
|
361 |
+ \item Output of \verb+uname -mrsp+ |
|
362 |
+ \item your \verb+config.log+ |
|
363 |
+ \item The following files from the \verb+unit-tests/+ directory: |
|
364 |
+ \begin{itemize} |
|
365 |
+ \item \verb+test.log+ |
|
366 |
+ \item \verb+clamscan.log+ |
|
367 |
+ \item \verb+clamdscan.log+ |
|
368 |
+ \end{itemize} |
|
369 |
+ \item \verb+/tmp/clamd-test.log+ if it exists |
|
370 |
+ \item where and how you installed the check package |
|
371 |
+ \item Output of \verb+pkg-config check --cflags --libs+ |
|
372 |
+ \item Optionally if \verb+valgrind+ is available on your platform, the output of the following: |
|
373 |
+ \begin{verbatim} |
|
374 |
+$ make check |
|
375 |
+$ CK_FORK=no ./libtool --mode=execute valgrind unit_tests/check-clamav |
|
376 |
+ \end{verbatim} |
|
377 |
+ \end{itemize} |
|
378 |
+ |
|
305 | 379 |
\section{Configuration} |
306 | 380 |
|
307 | 381 |
\subsection{clamd} |