ctdb-tests: Factor out new local daemons functions ps_ctdbd
authorMartin Schwenke <martin@meltin.net>
Tue, 13 Sep 2016 03:44:04 +0000 (13:44 +1000)
committerMartin Schwenke <martins@samba.org>
Wed, 14 Sep 2016 06:39:29 +0000 (08:39 +0200)
Useful for being able to ensure that tests are doing what is expected.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12254

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb/tests/simple/28_zero_eventscripts.sh
ctdb/tests/simple/scripts/local_daemons.bash

index 7c03ae496810b87e2f818162538da32d69d5e3d4..fc31c4a2c121d39191ffaa89f25ab30c7290bf3f 100755 (executable)
@@ -35,11 +35,6 @@ CTDB_EVENT_SCRIPT_DIR="$empty_dir" daemons_start
 
 wait_until_ready
 
-# 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
+ps_ctdbd
 
-echo
 echo "Good, that seems to work!"
index fb1e7e1cd5f6b7887253680151dfebcf24a5565e..2d6ec56b80f246a9f2afc9121c3a2a6d43830499 100644 (file)
@@ -173,3 +173,13 @@ _restart_ctdb_all ()
     daemons_stop
     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
+}