2.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:

test.sh [options] <test_number>

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>

The possible tests are:

  1  -- Compile with many different options
  2  -- Hash function            
  3  -- Standalone init/check
  4  -- Microstealth init/check
  5  -- External program call    
  6  -- Controlling the daemon (signal handling)
  7  -- GnuPG signed files / prelude log
  8  -- Suidcheck
 10  -- Test client/server init/check      
 11  -- Test full client/server init/check 
 12  -- Test full client/server w/gpg      
 13  -- Test full client/server w/mysql    (only with --really-all)
 14  -- Test full client/server w/postgres (only with --really-all)
 all -- All tests (non-applicable tests will be skipped)

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).

NoteThe --really-all option
 

This option enables the following additional tests:

  1. smatch As part of the compile test suite (test 1), the smatch checker will be used (see smatch.sourceforge.net). Requires a appropriate setup (patched gcc in /usr/local/gcc-smatch/bin/, smatch scripts in ../sm_scripts.

  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 postgresqlwill be tested with tests 13/14. Requires a running database with an existing default setup (database/user/password = samhain/samhain/samhain, table = log).

WarningCAVEAT
 

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.