From: Martin Schwenke Date: Thu, 5 Apr 2018 05:37:42 +0000 (+1000) Subject: ctdb-daemon: Add testing environment variable CTDB_TEST_MODE X-Git-Tag: ldb-1.4.0~488 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3c7b766e5a2fc23149d7cb78ca1167e3ec1ca5a3;p=thirdparty%2Fsamba.git ctdb-daemon: Add testing environment variable CTDB_TEST_MODE This is a generic indicator that tests are being run. For local daemons, this will replace --sloppy-start and --nopublicipcheck - it also does --nosetsched, which isn't being removed at this point. Signed-off-by: Martin Schwenke Reviewed-by: Amitay Isaacs --- diff --git a/ctdb/server/ctdbd.c b/ctdb/server/ctdbd.c index 021fe907d8f..9c9e84e686c 100644 --- a/ctdb/server/ctdbd.c +++ b/ctdb/server/ctdbd.c @@ -140,6 +140,7 @@ int main(int argc, const char *argv[]) poptContext pc; struct tevent_context *ev; const char *ctdb_base; + const char *t; /* Environment variable overrides default */ ctdbd_pidfile = getenv("CTDB_PIDFILE"); @@ -326,6 +327,13 @@ int main(int argc, const char *argv[]) ctdb->do_checkpublicip = (options.no_publicipcheck == 0); + t = getenv("CTDB_TEST_MODE"); + if (t != NULL) { + ctdb->do_setsched = false; + ctdb->do_checkpublicip = false; + fast_start = true; + } + if (options.max_persistent_check_errors < 0) { ctdb->max_persistent_check_errors = 0xFFFFFFFFFFFFFFFFLL; } else { diff --git a/ctdb/tests/README b/ctdb/tests/README index 92b637ae768..c9eec4d48ba 100644 --- a/ctdb/tests/README +++ b/ctdb/tests/README @@ -120,3 +120,20 @@ 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" + +Test and debugging variable options +----------------------------------- + + CTDB_TEST_MODE + + Set this environment variable to enable test mode. + + When testing with multiple local daemons on a single + machine this does 3 things: + + * Disables checks related to public IP addresses + + * Speeds up the initial recovery during startup at the + expense of some consistency checking + + * Disables real-time scheduling diff --git a/ctdb/tests/run_tests.sh b/ctdb/tests/run_tests.sh index a7ca44e863e..3649d76e34e 100755 --- a/ctdb/tests/run_tests.sh +++ b/ctdb/tests/run_tests.sh @@ -235,6 +235,8 @@ find_and_run_one_test () fi } +export CTDB_TEST_MODE="yes" + # Following 2 lines may be modified by installation script export CTDB_TESTS_ARE_INSTALLED=false export CTDB_TEST_DIR=$(dirname "$0")