1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-28 07:21:54 +03:00
samba-mirror/ctdb/tests
Martin Schwenke e003699686 tests/eventscripts: Tests for memory checking in 00.ctdb
... plus updates to test infrastructure to support.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 4a388fc6bf54636b7e1f6da8e6aa451cddd574f7)
2013-09-11 15:34:42 +10:00
..
complex tests/complex: Fix NFS tests to work with root_squash 2013-07-23 11:28:07 +10:00
events.d tests: simple tests against local daemons should check $TEST_LOCAL_DEAMONS 2012-07-26 22:03:00 +10:00
eventscripts tests/eventscripts: Tests for memory checking in 00.ctdb 2013-09-11 15:34:42 +10:00
onnode tests: Unit tests should use $TEST_VAR_DIR 2012-04-27 15:42:42 +10:00
scripts tests: Always tally the number of passed/failed tests 2013-07-29 15:49:23 +10:00
simple tests/simple: Minimise the chance of a monitor event being cancelled 2013-08-22 17:00:20 +10:00
src tests: Add a test program to hold a lock on a database 2013-08-01 11:08:26 +10:00
takeover tests/takeover: New test with 900 IPs 2013-05-24 22:31:22 +10:00
tool tests/tool: New tests for natgwlist, getcapabilities, lvs, lvsmaster 2012-09-28 17:05:34 +10:00
INSTALL eventscripts: 60.nfs uses nfs_check_rpc_services() to check NFS RPC services 2013-05-07 12:55:09 +10:00
README tests: Update README 2012-04-27 17:19:45 +10:00
recover.sh more code rearrangement 2007-06-07 22:16:48 +10:00
run_cluster_tests.sh tests: Fix wrapper scripts to handle options and tests without breakage 2012-05-14 15:02:19 +10:00
run_tests.sh run_tests.sh: fix a comment 2012-07-03 14:30:24 +02:00
test_check_tcp_ports.sh add a simple test script to test ctdb_check_tcp_ports 2009-01-30 22:49:17 +01:00
TODO For now, make tests/run_tests.sh runs the new test suite. Add 2009-01-12 15:47:12 +11:00

Introduction
------------

For a developer, the simplest way of running most tests on a local
machine from within the git repository is:

  make test

This runs all unit tests (onnode, takeover, tool, eventscripts) and
the tests against local daemons (simple) using the script
tests/run_tests.sh.

When running tests against a real or virtual cluster the script
tests/run_cluster_tests.sh can be used.  This runs all integration
tests (simple, complex).

Both of these scripts can also take a list of tests to run.  You can
also pass options, which are then passed to run_tests.  However, if
you just try to pass options to run_tests then you lose the default
list of tests that are run.  You can't have everything...

scripts/run_tests
-----------------

The above scripts invoke tests/scripts/run_tests.  This script has a
lot of command-line switches.  Some of the more useful options
include:

  -s  Print a summary of tests results after running all tests

  -l  Use local daemons for integration tests

      This allows the tests in "simple" to be run against local
      daemons.

      All integration tests communicate with cluster nodes using
      onnode or the ctdb tool, which both have some test hooks to
      support local daemons.

      By default 3 daemons are used.  If you want to use a different
      number of daemons then do not use this option but set
      TEST_LOCAL_DAEMONS to the desired number of daemons instead.
      The -l option just sets TEST_LOCAL_DAEMONS to 3...  :-)

  -e  Exit on the first test failure

  -C  Clean up - kill daemons and remove $TEST_VAR_DIR when done

      Tests uses a temporary/var directory for test state.  By default,
      this directory is not removed when tests are complete, so you
      can do forensics or, for integration tests, re-run tests that
      have failed against the same directory (with the same local
      daemons setup).  So this option cleans things up.

      Also kills local daemons associated with directory.

  -V  Use <dir> as $TEST_VAR_DIR

      Use the specified temporary temporary/var directory.

  -H  No headers - for running single test with other wrapper

      This allows tests to be embedded in some other test framework
      and executed one-by-one with all the required
      environment/infrastructure.

      This replaces the old ctdb_test_env script.

How do the tests find remote test programs?
-------------------------------------------

If the all of the cluster nodes have the CTDB git tree in the same
location as on the test client then no special action is necessary.
The simplest way of doing this is to share the tree to cluster nodes
and test clients via NFS.

If cluster nodes do not have the CTDB git tree then
CTDB_TEST_REMOTE_DIR can be set to a directory that, on each cluster
node, contains the contents of tests/scripts/ and tests/bin/.

In the future this will hopefully (also) be supported via a ctdb-test
package.

Running the ctdb tool under valgrind
------------------------------------

The easiest way of doing this is something like:

  VALGRIND="valgrind -q" scripts/run_tests ...

This can be used to cause all invocations of the ctdb client (and,
with local daemons, the ctdbd daemons themselves) to occur under
valgrind.

NOTE: Some libc calls seem to do weird things and perhaps cause
spurious output from ctdbd at start time.  Please read valgrind output
carefully before reporting bugs.  :-)

How is the ctdb tool invoked?
-----------------------------

$CTDB determines how to invoke the ctdb client.  If not already set
and if $VALGRIND is set, this is set to "$VALGRIND ctdb".  If this is
not already set but $VALGRIND is not set, this is simply set to "ctdb"