ctdb-daemon: Do not fork when CTDB_TEST_MODE is set
authorMartin Schwenke <martin@meltin.net>
Thu, 18 Oct 2018 07:02:13 +0000 (18:02 +1100)
committerAmitay Isaacs <amitay@samba.org>
Tue, 6 Nov 2018 09:30:14 +0000 (10:30 +0100)
Explicitly background ctdbd instead.

This has the advantage of leaving stdin open.  ctdbd can then be
enhanced to exit when stdin closes, allowing better cleanup in a test
environment.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Autobuild-User(master): Amitay Isaacs <amitay@samba.org>
Autobuild-Date(master): Tue Nov  6 10:30:14 CET 2018 on sn-devel-144

ctdb/server/ctdbd.c
ctdb/tests/local_daemons.sh

index ebe111ddde63c840fd73b4b8274ad2a7a1c2414b..a2870d0d11135e4c57bdc9551d99a849c39d3399 100644 (file)
@@ -374,6 +374,9 @@ int main(int argc, const char *argv[])
                fast_start = true;
        }
 
+       /* Don't fork when running in test mode */
+       interactive = interactive || test_mode != NULL;
+
        /* start the protocol running (as a child) */
        return ctdb_start_daemon(ctdb, !interactive);
 
index 6f6d03ffa086ee967a9570b8fd6c98fc60fe122d..9329a60643c78a0f02eaf1b79f32293f670c80dc 100755 (executable)
@@ -334,7 +334,7 @@ local_daemons_start ()
 
        onnode_common
 
-       onnode "$_nodes" "${VALGRIND:-} ctdbd"
+       onnode "$_nodes" "${VALGRIND:-} ctdbd &"
 }
 
 local_daemons_stop ()