[SCM] CTDB repository - branch master updated - ctdb-1.13-173-g6e68797

Ronnie Sahlberg sahlberg at samba.org
Wed May 16 19:03:13 MDT 2012


The branch, master has been updated
       via  6e68797af67bee36f2bad045f94806e7e98f27e9 (commit)
       via  2bcd58b30d7cf6dd48ad7f019810c6965a44c85a (commit)
       via  863ad337fa3c4effe1fd370d3ba414027c600bd6 (commit)
       via  f4b7d14f2e3c7345e7a09abb27c32923fb78cbc4 (commit)
       via  c7d6e4557d00de674737e2c8d6cbebaa2461c303 (commit)
       via  d661f09c6c76543bd091d51bc0e6fe97ed0f55d1 (commit)
       via  ed2db1f4e8d2b222d7f912a4a007ce48a23e83b0 (commit)
       via  d2514051761ba23deee0e118c25afab2ab8d854e (commit)
       via  a00e80c701a0f9695f41c24e0360c25c0873d49d (commit)
       via  6b8507d4d3062e709409b3790117d87311b3460d (commit)
       via  db8cf8f5e644a0b21a6040287887fee40f38d4db (commit)
       via  9f20fbf91706db94f65f62dbd6a4e087890c1da9 (commit)
       via  61c80f58a8cfbaca7e669ef8cd95b4f6b5dc66c7 (commit)
       via  e7ba0a30e7b7fe78e83e493128b349708cf0038a (commit)
       via  14a630cbc638d2f3bf699de5d94131e5f7d1a3ea (commit)
       via  1957d53b78f101cd0cd37d9705a225deef5174a2 (commit)
       via  f0a14169883661a702a352aa0311a2b433071a83 (commit)
       via  5c23244591b8005f91d8e25e719cd332c711db14 (commit)
      from  e3dc5bd3f1ef1f0ed08f57a5b5bafcac936e9ed0 (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 6e68797af67bee36f2bad045f94806e7e98f27e9
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date:   Thu May 17 10:17:51 2012 +1000

    Debug: When scripts hang, we may need to collect additional data in order to debug why the script hung.
    
    Break this debug and datacollection out into an external script to make it easier to modify what data we need to collect.
    For now we only collect a pstree so we can see what part of the script we hung in.
    
    S1037271

-----------------------------------------------------------------------

Summary of changes:
 Makefile.in                                 |    3 +-
 config/ctdb.init                            |    1 +
 config/ctdb.sysconfig                       |    3 +
 config/debug-hung-script.sh                 |    7 ++
 config/functions                            |   12 ++-
 include/ctdb_private.h                      |    3 +
 packaging/RPM/ctdb.spec.in                  |   65 +++++++++++++++--
 server/ctdb_tunables.c                      |    2 +-
 server/ctdbd.c                              |   11 +++
 server/eventscript.c                        |   66 ++++++++++++-----
 tests/INSTALL                               |   10 +--
 tests/eventscripts/13.per_ip_routing.002.sh |    2 +-
 tests/eventscripts/scripts/local.sh         |    3 +-
 tests/run_cluster_tests.sh                  |   19 +-----
 tests/run_tests.sh                          |   40 ++++++++--
 tests/scripts/integration.bash              |   42 ++++++++--
 tests/scripts/run_tests                     |   60 +++++++++++-----
 tests/simple/18_ctdb_reloadips.sh           |  106 +++++++++++++++++++++++++++
 18 files changed, 362 insertions(+), 93 deletions(-)
 create mode 100644 config/debug-hung-script.sh
 mode change 100755 => 120000 tests/run_cluster_tests.sh
 create mode 100755 tests/simple/18_ctdb_reloadips.sh


Changeset truncated at 500 lines:

diff --git a/Makefile.in b/Makefile.in
index ecf03f2..cdebbd7 100755
--- a/Makefile.in
+++ b/Makefile.in
@@ -356,6 +356,7 @@ install: all $(PMDA_INSTALL)
 	if [ -f doc/ltdbtool.1 ]; then ${INSTALLCMD} -m 644 doc/ltdbtool.1 $(DESTDIR)$(mandir)/man1; fi
 	if [ -f doc/ping_pong.1 ];then ${INSTALLCMD} -m 644 doc/ping_pong.1 $(DESTDIR)$(mandir)/man1; fi
 	if [ ! -f $(DESTDIR)$(etcdir)/ctdb/notify.sh ];then ${INSTALLCMD} -m 755 config/notify.sh $(DESTDIR)$(etcdir)/ctdb; fi
+	${INSTALLCMD} -m 755 config/debug-hung-script.sh $(DESTDIR)$(etcdir)/ctdb
 	if [ ! -f $(DESTDIR)$(etcdir)/ctdb/ctdb-crash-cleanup.sh ];then ${INSTALLCMD} -m 755 config/ctdb-crash-cleanup.sh $(DESTDIR)$(etcdir)/ctdb; fi
 
 install_pmda:
@@ -369,7 +370,7 @@ install_tests: all
 	tests/INSTALL --destdir=$(DESTDIR) --datarootdir=$(prefix)/share --libdir=$(libdir) --bindir=$(bindir) --etcdir=$(etcdir)
 
 test: all
-	tests/run_tests.sh
+	tests/run_tests.sh -V tests/var
 
 test_cluster: all
 	tests/run_cluster_tests.sh
diff --git a/config/ctdb.init b/config/ctdb.init
index 0a4d29b..5d01a9c 100755
--- a/config/ctdb.init
+++ b/config/ctdb.init
@@ -95,6 +95,7 @@ build_ctdb_options () {
     maybe_set "--event-script-dir"       "$CTDB_EVENT_SCRIPT_DIR"
     maybe_set "--transport"              "$CTDB_TRANSPORT"
     maybe_set "-d"                       "$CTDB_DEBUGLEVEL"
+    maybe_set "--debug-hung-script"      "$CTDB_DEBUG_HUNG_SCRIPT"
     maybe_set "--notification-script"    "$CTDB_NOTIFY_SCRIPT"
     maybe_set "--start-as-disabled"      "$CTDB_START_AS_DISABLED"    "yes"
     maybe_set "--start-as-stopped "      "$CTDB_START_AS_STOPPED"     "yes"
diff --git a/config/ctdb.sysconfig b/config/ctdb.sysconfig
index 163a0dd..fecc7a5 100644
--- a/config/ctdb.sysconfig
+++ b/config/ctdb.sysconfig
@@ -92,6 +92,9 @@ CTDB_RECOVERY_LOCK="/some/place/on/shared/storage"
 # a script to run when node health changes
 # CTDB_NOTIFY_SCRIPT=/etc/ctdb/notify.sh
 
+# a script to collect data when an eventscript has hung
+# CTDB_DEBUG_HUNG_SCRIPT=/etc/ctdb/debug-hung-script.sh
+
 # the directory to put the local ctdb database files in
 # defaults to /var/ctdb
 # CTDB_DBDIR=/var/ctdb
diff --git a/config/debug-hung-script.sh b/config/debug-hung-script.sh
new file mode 100644
index 0000000..d468cc6
--- /dev/null
+++ b/config/debug-hung-script.sh
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+. $CTDB_BASE/functions
+loadconfig
+
+echo "Pstree output for the hung script:"
+pstree -p -a $1
diff --git a/config/functions b/config/functions
index ca89c38..9c2898c 100755
--- a/config/functions
+++ b/config/functions
@@ -211,14 +211,20 @@ nfs_check_rpc_service ()
 {
     _prog_name="$1" ; shift
 
-    _version=1
+    _v=""
+    case "$1" in
+	-*) : ;;
+	*) _v="$1" ; shift ;;
+    esac
+
+    _version=${_v:-1}
     _rpc_prog="$_prog_name"
     _restart=""
     _opts=""
     case "$_prog_name" in
 	knfsd)
 	    _rpc_prog=nfs
-	    _version=3
+	    _version=${_v:-3}
 	    _restart="echo 'Trying to restart NFS service'"
 	    _restart="${_restart}; startstop_nfs restart"
 	    ;;
@@ -230,7 +236,7 @@ nfs_check_rpc_service ()
 	    ;;
 	lockd)
 	    _rpc_prog=nlockmgr
-	    _version=4
+	    _version=${_v:-4}
 	    _restart="echo 'Trying to restart lock manager service'"
 	    _restart="${_restart}; startstop_nfslock restart"
 	    ;;
diff --git a/include/ctdb_private.h b/include/ctdb_private.h
index 086e427..a1b4b89 100644
--- a/include/ctdb_private.h
+++ b/include/ctdb_private.h
@@ -458,6 +458,7 @@ struct ctdb_context {
 	bool do_setsched;
 	void *saved_scheduler_param;
 	const char *event_script_dir;
+	const char *debug_hung_script;
 	const char *notification_script;
 	const char *default_public_interface;
 	pid_t ctdbd_pid;
@@ -502,6 +503,7 @@ struct ctdb_context {
 
 	const char *public_addresses_file;
 	struct trbt_tree *child_processes; 
+	TALLOC_CTX *debug_hung_script_ctx;
 };
 
 struct ctdb_db_context {
@@ -1150,6 +1152,7 @@ int ctdb_set_single_public_ip(struct ctdb_context *ctdb,
 			      const char *ip);
 int ctdb_set_event_script(struct ctdb_context *ctdb, const char *script);
 int ctdb_set_event_script_dir(struct ctdb_context *ctdb, const char *script_dir);
+int ctdb_set_debug_hung_script(struct ctdb_context *ctdb, const char *script);
 int ctdb_set_notification_script(struct ctdb_context *ctdb, const char *script);
 void lcp2_forcerebalance(struct ctdb_context *ctdb, uint32_t pnn);
 int ctdb_takeover_run(struct ctdb_context *ctdb, struct ctdb_node_map *nodemap);
diff --git a/packaging/RPM/ctdb.spec.in b/packaging/RPM/ctdb.spec.in
index f9a5cef..09a30f4 100644
--- a/packaging/RPM/ctdb.spec.in
+++ b/packaging/RPM/ctdb.spec.in
@@ -12,18 +12,42 @@ URL: http://ctdb.samba.org/
 
 Source: ctdb-%{version}.tar.gz
 
-Prereq: /bin/mktemp /usr/bin/killall
-Prereq: fileutils sed /etc/init.d
+# Packages
+Requires: coreutils, sed, gawk, iptables, iproute, procps, ethtool
+# Commands - package name might vary
+Requires: /usr/bin/killall, /bin/kill, /bin/netstat
+# Directories
+Requires: /etc/init.d
 
 Provides: ctdb = %{version}
 
 Prefix: /usr
 BuildRoot: %{_tmppath}/%{name}-%{version}-root
 
+# Always use the bundled versions of these libraries.
+%define with_included_talloc 1
+%define with_included_tdb 1
+%define with_included_tevent 1
+
+# If the above options are changed then mandate minimum system
+# versions.
+%define libtalloc_version 2.0.6
+%define libtdb_version 1.2.9
+%define libtevent_version 0.9.13
+
+%if ! %with_included_talloc
+BuildRequires: libtalloc-devel >= %{libtalloc_version}
+%endif
+%if ! %with_included_tdb
+BuildRequires: libtdb-devel >= %{libtdb_version}
+%endif
+%if ! %with_included_tevent
+BuildRequires: libtevent-devel >= %{libtevent_version}
+%endif
+
 %description
 ctdb is the clustered database used by samba
 
-
 #######################################################################
 
 
@@ -48,6 +72,15 @@ export CC
 ./autogen.sh
 
 CFLAGS="$RPM_OPT_FLAGS $EXTRA -O0 -D_GNU_SOURCE -DCTDB_VERS=\"%{version}-%{release}\"" ./configure \
+%if %with_included_talloc
+	--with-included-talloc \
+%endif
+%if %with_included_tdb
+	--with-included-tdb \
+%endif
+%if %with_included_tevent
+	--with-included-tevent \
+%endif
 	--prefix=%{_prefix} \
 	--sysconfdir=%{_sysconfdir} \
 	--mandir=%{_mandir} \
@@ -64,7 +97,7 @@ rm -rf $RPM_BUILD_ROOT
 mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig
 mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/init.d
 
-make DESTDIR=$RPM_BUILD_ROOT docdir=%{_docdir} install
+make DESTDIR=$RPM_BUILD_ROOT docdir=%{_docdir} install install_tests
 
 install -m644 config/ctdb.sysconfig $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/ctdb
 install -m755 config/ctdb.init $RPM_BUILD_ROOT%{initdir}/ctdb
@@ -88,6 +121,7 @@ rm -rf $RPM_BUILD_ROOT
 
 %config(noreplace) %{_sysconfdir}/sysconfig/ctdb
 %config(noreplace) %{_sysconfdir}/ctdb/notify.sh
+%config(noreplace) %{_sysconfdir}/ctdb/debug-hung-script.sh
 %config(noreplace) %{_sysconfdir}/ctdb/ctdb-crash-cleanup.sh
 %config(noreplace) %{_sysconfdir}/ctdb/functions
 %attr(755,root,root) %{initdir}/ctdb
@@ -129,8 +163,8 @@ rm -rf $RPM_BUILD_ROOT
 %{_docdir}/ctdb/tests/bin/ctdb_transaction
 
 %package devel
-Summary: CTDB developmnet libraries
-Group: Development
+Summary: CTDB development libraries
+Group: Development/Libraries
 
 %description devel
 development libraries for ctdb
@@ -144,6 +178,25 @@ development libraries for ctdb
 %{_includedir}/ctdb_typesafe_cb.h
 %{_libdir}/libctdb.a
 
+%package tests
+Summary: CTDB test suite
+Group: Development/Tools
+Requires: ctdb = %{version}
+
+%description tests
+test suite for ctdb
+
+%files tests
+%defattr(-,root,root)
+%dir %{_datadir}/%{name}-tests
+%{_datadir}/%{name}-tests/*
+%dir %{_libdir}/%{name}-tests
+%{_libdir}/%{name}-tests/*
+%{_bindir}/ctdb_run_tests
+%{_bindir}/ctdb_run_cluster_tests
+%doc tests/README
+
+
 %changelog
 * Thu Mar 1 2012 : Version 1.13
  - This is the new stable branch for modern features for ctdb.
diff --git a/server/ctdb_tunables.c b/server/ctdb_tunables.c
index 41ff7ae..5103cc2 100644
--- a/server/ctdb_tunables.c
+++ b/server/ctdb_tunables.c
@@ -38,7 +38,7 @@ static const struct {
 	{ "MonitorInterval",     15,  offsetof(struct ctdb_tunable, monitor_interval), false },
 	{ "TickleUpdateInterval",20,  offsetof(struct ctdb_tunable, tickle_update_interval), false },
 	{ "EventScriptTimeout",  30,  offsetof(struct ctdb_tunable, script_timeout), false },
-	{ "EventScriptTimeoutCount", 1,  offsetof(struct ctdb_tunable, script_timeout_count), false },
+	{ "EventScriptTimeoutCount", 20,  offsetof(struct ctdb_tunable, script_timeout_count), false },
 	{ "EventScriptUnhealthyOnTimeout", 0, offsetof(struct ctdb_tunable, script_unhealthy_on_timeout), true },
 	{ "RecoveryGracePeriod", 120,  offsetof(struct ctdb_tunable, recovery_grace_period), false },
 	{ "RecoveryBanPeriod",  300,  offsetof(struct ctdb_tunable, recovery_ban_period), false },
diff --git a/server/ctdbd.c b/server/ctdbd.c
index eafef8d..8eee5f2 100644
--- a/server/ctdbd.c
+++ b/server/ctdbd.c
@@ -33,6 +33,7 @@ static struct {
 	const char *public_address_list;
 	const char *event_script_dir;
 	const char *notification_script;
+	const char *debug_hung_script;
 	const char *logfile;
 	const char *recovery_lock_file;
 	const char *db_dir;
@@ -61,6 +62,7 @@ static struct {
 	.db_dir_persistent = VARDIR "/ctdb/persistent",
 	.db_dir_state = VARDIR "/ctdb/state",
 	.script_log_level = DEBUG_ERR,
+	.debug_hung_script = "/etc/ctdb/debug-hung-script.sh",
 };
 
 int script_log_level;
@@ -126,6 +128,7 @@ int main(int argc, const char *argv[])
 		{ "nlist", 0, POPT_ARG_STRING, &options.nlist, 0, "node list file", "filename" },
 		{ "node-ip", 0, POPT_ARG_STRING, &options.node_ip, 0, "node ip", "ip-address"},
 		{ "notification-script", 0, POPT_ARG_STRING, &options.notification_script, 0, "notification script", "filename" },
+		{ "debug-hung-script", 0, POPT_ARG_STRING, &options.debug_hung_script, 0, "debug script for hung eventscripts", "filename" },
 		{ "listen", 0, POPT_ARG_STRING, &options.myaddress, 0, "address to listen on", "address" },
 		{ "transport", 0, POPT_ARG_STRING, &options.transport, 0, "protocol transport", NULL },
 		{ "dbdir", 0, POPT_ARG_STRING, &options.db_dir, 0, "directory for the tdb files", NULL },
@@ -313,6 +316,14 @@ int main(int argc, const char *argv[])
 		}
 	}
 
+	if (options.debug_hung_script != NULL) {
+		ret = ctdb_set_debug_hung_script(ctdb, options.debug_hung_script);
+	}
+	if (ret == -1) {
+		DEBUG(DEBUG_ALERT,("Unable to setup script to debug hung eventscripts\n"));
+		exit(1);
+	}
+
 	ctdb->valgrinding = options.valgrinding;
 	if (options.valgrinding || options.nosetsched) {
 		ctdb->do_setsched = 0;
diff --git a/server/eventscript.c b/server/eventscript.c
index 838b12e..fe4299b 100644
--- a/server/eventscript.c
+++ b/server/eventscript.c
@@ -503,15 +503,23 @@ static void ctdb_event_script_handler(struct event_context *ev, struct fd_event
 	}
 }
 
-static void debug_timeout(struct ctdb_event_script_state *state)
+/*
+  setup the script to debug hung eventscripts
+*/
+int ctdb_set_debug_hung_script(struct ctdb_context *ctdb, const char *script)
+{
+	ctdb->debug_hung_script = talloc_strdup(ctdb, script);
+	CTDB_NO_MEMORY(ctdb, ctdb->debug_hung_script);
+	return 0;
+}
+
+static void ctdb_run_debug_hung_script(struct ctdb_context *ctdb, struct ctdb_event_script_state *state)
 {
 	struct ctdb_script_wire *current = get_current_script(state);
 	char *cmd;
 	pid_t pid;
-	time_t t;
-	char tbuf[100], buf[200];
 
-	cmd = child_command_string(state->ctdb, state,
+	cmd = child_command_string(ctdb, state,
 				   state->from_user, current->name,
 				   state->call, state->options);
 	CTDB_NO_MEMORY_VOID(state->ctdb, cmd);
@@ -520,26 +528,44 @@ static void debug_timeout(struct ctdb_event_script_state *state)
 			 cmd, timeval_elapsed(&current->start), state->child));
 	talloc_free(cmd);
 
-	t = time(NULL);
-	strftime(tbuf, sizeof(tbuf)-1, "%Y%m%d%H%M%S", 	localtime(&t));
-	sprintf(buf, "{ pstree -p; cat /proc/locks; ls -li /var/ctdb/ /var/ctdb/persistent; }"
-			" >/tmp/ctdb.event.%s.%d", tbuf, getpid());
-
-	pid = ctdb_fork(state->ctdb);
-	if (pid == 0) {
-		system(buf);
-		/* Now we can kill the child */
+	talloc_free(ctdb->debug_hung_script_ctx);
+	ctdb->debug_hung_script_ctx = talloc_new(ctdb);
+ 	if (!ctdb_fork_with_logging(ctdb->debug_hung_script_ctx, ctdb, "Hung script", NULL, NULL, &pid)) {
+		DEBUG(DEBUG_ERR,("Failed to fork a child process with logging to track hung event script\n"));
 		ctdb_kill(state->ctdb, state->child, SIGTERM);
-		exit(0);
+		return;
 	}
 	if (pid == -1) {
 		DEBUG(DEBUG_ERR,("Fork for debug script failed : %s\n",
 				 strerror(errno)));
-	} else {
-		DEBUG(DEBUG_ERR,("Logged timedout eventscript : %s\n", buf));
-		/* Don't kill child until timeout done. */
-		state->child = 0;
+		ctdb_kill(state->ctdb, state->child, SIGTERM);
+		return;
+	}
+	if (pid == 0) {
+		struct stat st;
+		char buf[200];
+
+		if (stat(ctdb->debug_hung_script, &st) != 0) {
+			DEBUG(DEBUG_ERR,("Failed to stat the script to debug hung eventscript. Is it not installed correctly? (script:%s)\n", ctdb->debug_hung_script));
+			ctdb_kill(state->ctdb, state->child, SIGTERM);
+			_exit(0);
+		}		
+		if (!(st.st_mode & S_IXUSR)) {
+			DEBUG(DEBUG_DEBUG,("Debug script %s is not executable.\n", ctdb->debug_hung_script));
+			ctdb_kill(state->ctdb, state->child, SIGTERM);
+			_exit(0);
+		}
+
+		sprintf(buf, "%s %d", ctdb->debug_hung_script, state->child);
+		system(buf);
+
+		/* Now we can kill the child */
+		ctdb_kill(state->ctdb, state->child, SIGTERM);
+		_exit(0);
 	}
+
+	/* Don't kill child until timeout done. */
+	state->child = 0;
 }
 
 /* called when child times out */
@@ -560,14 +586,14 @@ static void ctdb_event_script_timeout(struct event_context *ev, struct timed_eve
 	case CTDB_EVENT_TAKE_IP:
 	case CTDB_EVENT_RELEASE_IP:
 	case CTDB_EVENT_STOPPED:
-	case CTDB_EVENT_MONITOR:
 	case CTDB_EVENT_STATUS:
 		state->scripts->scripts[state->current].status = 0;
 		DEBUG(DEBUG_ERR,("Ignoring hung script for %s call %d\n", state->options, state->call));
+		ctdb_run_debug_hung_script(ctdb, state);
 		break;
         default:
 		state->scripts->scripts[state->current].status = -ETIME;
-		debug_timeout(state);
+		ctdb_run_debug_hung_script(ctdb, state);
 	}
 
 	talloc_free(state);
diff --git a/tests/INSTALL b/tests/INSTALL
index 6f43650..c67d76d 100755
--- a/tests/INSTALL
+++ b/tests/INSTALL
@@ -83,9 +83,7 @@ cp -pr "tests/bin/" "${ctdb_libdir}"
 ctdb_bindir="${destdir}${bindir}"
 echo "Installing wrapper scripts into ${ctdb_bindir}..."
 mkdir -p "${ctdb_bindir}"
-for i in tests/run_tests.sh tests/run_cluster_tests.sh ; do
-    b=$(basename "$i" ".sh")
-    out="${ctdb_bindir}/ctdb_${b}"
-    sed -e "s@^test_dir=.*@test_dir=${datarootdir}/ctdb-tests\nexport TEST_BIN_DIR=\"${libdir}/ctdb-tests\"@" "$i" >"${out}"
-    chmod 755 "$out"
-done
+out="${ctdb_bindir}/ctdb_run_tests"
+sed -e "s@^test_dir=.*@test_dir=${datarootdir}/ctdb-tests\nexport TEST_BIN_DIR=\"${libdir}/ctdb-tests\"@" "tests/run_tests.sh" >"$out"
+chmod 755 "$out"
+ln -s "ctdb_run_tests" "${ctdb_bindir}/ctdb_run_cluster_tests"
diff --git a/tests/eventscripts/13.per_ip_routing.002.sh b/tests/eventscripts/13.per_ip_routing.002.sh
index 3198ef3..62a4c65 100755
--- a/tests/eventscripts/13.per_ip_routing.002.sh
+++ b/tests/eventscripts/13.per_ip_routing.002.sh
@@ -8,7 +8,7 @@ setup_ctdb
 setup_ctdb_policy_routing
 
 required_result 1 <<EOF
-error: CTDB_PER_IP_ROUTING_CONF=${TEST_SUBDIR}/etc-ctdb/policy_routing file not found
+error: CTDB_PER_IP_ROUTING_CONF=${CTDB_BASE}/policy_routing file not found
 EOF
 
 simple_test_event "ipreallocated"
diff --git a/tests/eventscripts/scripts/local.sh b/tests/eventscripts/scripts/local.sh
index afecf50..b2deb05 100644
--- a/tests/eventscripts/scripts/local.sh
+++ b/tests/eventscripts/scripts/local.sh
@@ -31,7 +31,8 @@ else
 fi
 
 if [ -d "${TEST_SUBDIR}/etc-ctdb" ] ; then
-    CTDB_BASE="${TEST_SUBDIR}/etc-ctdb"
+    cp -prL "${TEST_SUBDIR}/etc-ctdb" "$EVENTSCRIPTS_TESTS_VAR_DIR"
+    export CTDB_BASE="${EVENTSCRIPTS_TESTS_VAR_DIR}/etc-ctdb"
 else
     die "Unable to set \$CTDB_BASE"
 fi
diff --git a/tests/run_cluster_tests.sh b/tests/run_cluster_tests.sh
deleted file mode 100755
index fa45534..0000000
--- a/tests/run_cluster_tests.sh
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/bin/sh
-
-test_dir=$(dirname "$0")
-
-if [ -n "$1" ] ; then
-    "${test_dir}/scripts/run_tests" -l -s "$@" || exit 1
-else
-    cd "$test_dir"
-
-    # By default, run all unit tests and the tests against local
-    # daemons
-    dirs="simple complex"
-
-    ./scripts/run_tests -s $dirs || exit 1
-fi
-
-echo "All OK"
-exit 0
diff --git a/tests/run_cluster_tests.sh b/tests/run_cluster_tests.sh
new file mode 120000
index 0000000..5236e32
--- /dev/null
+++ b/tests/run_cluster_tests.sh
@@ -0,0 +1 @@
+run_tests.sh
\ No newline at end of file
diff --git a/tests/run_tests.sh b/tests/run_tests.sh
index f3cc840..50924fc 100755
--- a/tests/run_tests.sh
+++ b/tests/run_tests.sh
@@ -2,17 +2,39 @@
 
 test_dir=$(dirname "$0")
 
-if [ -n "$1" ] ; then
-    "${test_dir}/scripts/run_tests" -l -s "$@" || exit 1
-else
-    cd "$test_dir"
+case $(basename "$0") in
+    *run_cluster_tests*)
+	# Running on a cluster:


-- 
CTDB repository


More information about the samba-cvs mailing list