This can be used to test the version checking logic. Cache the
version to avoid re-checking the environment variable each time.
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@samba.org>
static uint32_t keepalive_version(void)
{
- return (SAMBA_VERSION_MAJOR << 16) | SAMBA_VERSION_MINOR;
+ static uint32_t version = 0;
+
+ if (version == 0) {
+ const char *t;
+
+ version = (SAMBA_VERSION_MAJOR << 16) | SAMBA_VERSION_MINOR;
+
+ t = getenv("CTDB_TEST_SAMBA_VERSION");
+ if (t != NULL) {
+ int v;
+
+ v = atoi(t);
+ if (v <= 0) {
+ DBG_WARNING("Failed to parse env var: %s\n", t);
+ } else {
+ version = v;
+ }
+ }
+ }
+
+ return version;
}
static uint32_t keepalive_uptime(struct ctdb_context *ctdb)
Default is no.
+ CTDB_TEST_SAMBA_VERSION=VERSION
+
+ VERSION is a 32-bit number containg the Samba major
+ version in the most significant 16 bits and the minor
+ version in the least significant 16 bits. This can be
+ used to test CTDB's checking of incompatible versions
+ without installing an incompatible version. This is
+ probably best set like this:
+
+ export CTDB_TEST_SAMBA_VERSION=$(( (4 << 16) | 12 ))
+
CTDB_VARDIR=DIRECTORY
DIRECTORY containing CTDB files that are modified at runtime.