4 For a developer, the simplest way of running most tests on a local
5 machine from within the git repository is:
9 This runs all unit tests (onnode, takeover, tool, eventscripts) and
10 the tests against local daemons (simple) using the script
13 When running tests against a real or virtual cluster the script
14 tests/run_cluster_tests.sh can be used. This runs all integration
15 tests (simple, complex).
17 Both of these scripts can also take a list of tests to run. You can
18 also pass options, which are then passed to run_tests. However, if
19 you just try to pass options to run_tests then you lose the default
20 list of tests that are run. You can't have everything...
25 The above scripts invoke tests/scripts/run_tests. This script has a
26 lot of command-line switches. Some of the more useful options
29 -s Print a summary of tests results after running all tests
31 -l Use local daemons for integration tests
33 This allows the tests in "simple" to be run against local
36 All integration tests communicate with cluster nodes using
37 onnode or the ctdb tool, which both have some test hooks to
38 support local daemons.
40 By default 3 daemons are used. If you want to use a different
41 number of daemons then do not use this option but set
42 TEST_LOCAL_DAEMONS to the desired number of daemons instead.
43 The -l option just sets TEST_LOCAL_DAEMONS to 3... :-)
45 -e Exit on the first test failure
47 -C Clean up - kill daemons and remove $TEST_VAR_DIR when done
49 Tests uses a temporary/var directory for test state. By default,
50 this directory is not removed when tests are complete, so you
51 can do forensics or, for integration tests, re-run tests that
52 have failed against the same directory (with the same local
53 daemons setup). So this option cleans things up.
55 Also kills local daemons associated with directory.
57 -V Use <dir> as $TEST_VAR_DIR
59 Use the specified temporary temporary/var directory.
61 -H No headers - for running single test with other wrapper
63 This allows tests to be embedded in some other test framework
64 and executed one-by-one with all the required
65 environment/infrastructure.
67 This replaces the old ctdb_test_env script.
69 How do the tests find remote test programs?
70 -------------------------------------------
72 If the all of the cluster nodes have the CTDB git tree in the same
73 location as on the test client then no special action is necessary.
74 The simplest way of doing this is to share the tree to cluster nodes
75 and test clients via NFS.
77 If cluster nodes do not have the CTDB git tree then
78 CTDB_TEST_REMOTE_DIR can be set to a directory that, on each cluster
79 node, contains the contents of tests/scripts/ and tests/bin/.
81 In the future this will hopefully (also) be supported via a ctdb-test
84 Running the ctdb tool under valgrind
85 ------------------------------------
87 The easiest way of doing this is something like:
89 VALGRIND="valgrind -q" scripts/run_tests ...
91 This can be used to cause all invocations of the ctdb client (and,
92 with local daemons, the ctdbd daemons themselves) to occur under
95 NOTE: Some libc calls seem to do weird things and perhaps cause
96 spurious output from ctdbd at start time. Please read valgrind output
97 carefully before reporting bugs. :-)
99 How is the ctdb tool invoked?
100 -----------------------------
102 $CTDB determines how to invoke the ctdb client. If not already set
103 and if $VALGRIND is set, this is set to "$VALGRIND ctdb". If this is
104 not already set but $VALGRIND is not set, this is simply set to "ctdb"