11. The testsuite

Samhain comes with a suite of verification/regression tests located in the test/ subdirectory of the source tree.

The driver script is test/test.sh. Calling it without arguments will provide some usage information. The script should be called as:

        bash$ test/test.sh [options] <test_number>

To get the list of possible tests, use:

        bash$ test/test.sh -h

The recognized options are as follows:

  1. -q|--quiet No output; success/failure is reported vi exit status only.

  2. -v|--verbose Report additional information.

  3. -s|--stoponerr Stop when a test fails.

  4. --no-cleanup Don't clean up generated test data (useful to investigate the reason for a failure).

  5. --srcdir=... Tell the script the location of the source tree (not necessary if run from the top source directory).

  6. --color=always|never|auto Whether to use colour for output. Default is 'auto' (no colour if stdout is not a terminal).

  7. --really-all This option enable additional test that are not run usually (see below).

[Note]The --really-all option

This option enables the following additional tests:

  1. clang/cppcheck As part of the compile test suite (test 1), the cppcheck checker will be used, and the source will be compiled twice, once with the default compiler and second with the clang compiler.

  2. prelude logging Logging to prelude will be tested as part of test 7. Requires prelude-manager, and requires that samhain is already registered as analyzer. This test is designed such that it should not interfere with an eventually running instance of prelude-manager.

  3. mysql/postgresql logging Logging to mysql and/or postgresql will be tested with tests 13/14. Requires a running database with an existing default setup (database/user/password = samhain/samhain/samhain, table = log).


The database tests (13/14) with --really-all will modify (i.e. log to) the database. These are the only tests that are not confined to the directory where the test is run.