summaryrefslogtreecommitdiff
path: root/ctdb
diff options
context:
space:
mode:
authorAmitay Isaacs <amitay@gmail.com>2017-11-22 11:08:14 +1100
committerMartin Schwenke <martins@samba.org>2017-11-24 11:49:19 +0100
commitc19fc7c9cc94dcf708a3ad0e417304a9d5c965ff (patch)
treea501980601ee526c733b20a0653ecb7ed8a3cf4e /ctdb
parent926e7a7cb46ef2b243f1247eee48c87ea546849b (diff)
downloadsamba-c19fc7c9cc94dcf708a3ad0e417304a9d5c965ff.tar.gz
ctdb-tests: Make sure child processes are waited on after termination
Looks like the if a process holding fcntl lock (on pid file) is killed, then the lock is not released till the process is reaped using either wait() or waitpid(). Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
Diffstat (limited to 'ctdb')
-rw-r--r--ctdb/tests/src/sock_daemon_test.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/ctdb/tests/src/sock_daemon_test.c b/ctdb/tests/src/sock_daemon_test.c
index 505ff78e768..5641d37bcd1 100644
--- a/ctdb/tests/src/sock_daemon_test.c
+++ b/ctdb/tests/src/sock_daemon_test.c
@@ -984,6 +984,10 @@ static void test5(TALLOC_CTX *mem_ctx, const char *pidfile,
ret = kill(pid_server, SIGTERM);
assert(ret == 0);
+
+ pid = waitpid(pid_server, &ret, 0);
+ assert(pid == pid_server);
+ assert(WEXITSTATUS(ret) == 0);
}
/*
@@ -1272,8 +1276,9 @@ static void test6(TALLOC_CTX *mem_ctx, const char *pidfile,
test6_client(sockpath);
- pid = wait(&ret);
- assert(pid != -1);
+ pid = waitpid(pid_server, &ret, 0);
+ assert(pid == pid_server);
+ assert(WEXITSTATUS(ret) == 0);
}
/*
@@ -1731,6 +1736,10 @@ static void test10(TALLOC_CTX *mem_ctx, const char *pidfile,
ret = kill (pid, SIGKILL);
assert(ret == 0);
+ pid2 = waitpid(pid, &ret, 0);
+ assert(pid2 == pid);
+ assert(WEXITSTATUS(ret) == 0);
+
ret = stat(sockpath, &st);
assert(ret == 0);