Running unit tests
Keywords: clamdoc

##
Running unit tests

ClamAV includes unit tests that allow you to test that the compiled binaries work correctly on your platform.

The first step is to use your OS's package manager to install the `check` package. If your OS doesn't have that package, you can download it from `http://check.sourceforge.net/`, build it and install it.

To help clamav's configure script locate `check`, it is recommended that you install `pkg-config`, preferably using your OS's package manager, or from `http://pkg-config.freedesktop.org`.

The recommended way to run unit-tests is the following, which ensures you will get an error if unit tests cannot be built: 7

    	 $ ./configure --enable-check
    	 $ make
    	 $ make check

When `make check` is finished, you should get a message similar to this:

    ==================
    All 8 tests passed
    ==================

If a unit test fails, you get a message similar to the following. See the next section on how to report a bug when a unit test fails.

    ========================================
    1 of 8 tests failed
    Please report to http://bugs.clamav.net/
    ========================================

If unit tests are disabled (and you didn't use -enable-check), you will get this message:

    *** Unit tests disabled in this build
    *** Use ./configure --enable-check to enable them

    SKIP: check_clamav
    PASS: check_clamd.sh
    PASS: check_freshclam.sh
    PASS: check_sigtool.sh
    PASS: check_clamscan.sh
    ======================
    All 4 tests passed
    (1 tests were not run)
    ======================

Running `./configure --enable-check` should tell you why.