ctdb-tests: Be more efficient about starting/stopping local daemons
[samba.git] / ctdb / tests / simple / scripts / local_daemons.bash
index f4a32aa5289f24c0ed39b622fc49888ede6eed4f..04597e9f1b3bd1eba785fbd52802b0985ec9460e 100644 (file)
@@ -1,9 +1,6 @@
 # If we're not running on a real cluster then we need a local copy of
 # ctdb (and other stuff) in $PATH and we will use local daemons.
 
-# For ctdbd_wrapper
-PATH="${CTDB_SCRIPTS_BASE}:${PATH}"
-
 hdir="$CTDB_SCRIPTS_HELPER_BINDIR"
 export CTDB_EVENTD="${hdir}/ctdb-eventd"
 export CTDB_EVENT_HELPER="${hdir}/ctdb-event"
@@ -166,37 +163,28 @@ start_ctdb_1 ()
 {
        local pnn="$1"
 
-       CTDBD="${VALGRIND} ctdbd" \
-            onnode "$pnn" ctdbd_wrapper start
+       onnode "$pnn" $VALGRIND ctdbd
 }
 
-daemons_start ()
+ctdb_start_all ()
 {
-    echo "Starting $TEST_LOCAL_DAEMONS ctdb daemons..."
+       echo "Starting $TEST_LOCAL_DAEMONS ctdb daemons..."
 
-    local pnn
-    for pnn in $(seq 0 $(($TEST_LOCAL_DAEMONS - 1))) ; do
-       start_ctdb_1 "$pnn"
-    done
+       onnode all $VALGRIND ctdbd
 }
 
 stop_ctdb_1 ()
 {
        local pnn="$1"
 
-       onnode "$pnn" ctdbd_wrapper stop
+       onnode "$pnn" $CTDB shutdown
 }
 
-daemons_stop ()
+ctdb_stop_all ()
 {
-    echo "Stopping $TEST_LOCAL_DAEMONS ctdb daemons..."
+       echo "Stopping $TEST_LOCAL_DAEMONS ctdb daemons..."
 
-    local pnn
-    for pnn in $(seq 0 $(($TEST_LOCAL_DAEMONS - 1))) ; do
-       stop_ctdb_1 "$pnn"
-    done
-
-    rm -rf "${SIMPLE_TESTS_VAR_DIR}/test.db"
+       onnode -p all $CTDB shutdown
 }
 
 restart_ctdb_1 ()
@@ -205,31 +193,6 @@ restart_ctdb_1 ()
        start_ctdb_1 "$1"
 }
 
-maybe_stop_ctdb ()
-{
-    daemons_stop
-}
-
-ctdb_stop_all ()
-{
-       daemons_stop
-}
-
-_ctdb_start_all ()
-{
-       daemons_start
-}
-
-ps_ctdbd ()
-{
-       # If this fails to find processes then the tests fails, so
-       # look at full command-line so this will work with valgrind.
-       # Note that the output could be generated with pgrep's -a
-       # option but it doesn't exist in older versions.
-       ps -p $(pgrep -f '\<ctdbd\>' | xargs | sed -e 's| |,|g') -o args ww
-       echo
-}
-
 # onnode will use CTDB_BASES to help the ctdb tool connection to each
 # daemon
 export CTDB_BASES=""