From caeb8db5cebc0e56b3a3220da45e30a4e440b66e Mon Sep 17 00:00:00 2001 From: Andrew Vagin Date: Tue, 22 Dec 2015 00:35:00 +0300 Subject: [PATCH] zdtm:mntns_open: wait when a child process opens descriptors Reported-by: Mr Jenkins Signed-off-by: Andrew Vagin Signed-off-by: Pavel Emelyanov --- test/zdtm/live/static/mntns_open.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/test/zdtm/live/static/mntns_open.c b/test/zdtm/live/static/mntns_open.c index 99c220917..3ddfa76ed 100644 --- a/test/zdtm/live/static/mntns_open.c +++ b/test/zdtm/live/static/mntns_open.c @@ -58,6 +58,8 @@ static int get_mntid(int fd) return mnt_id; } +task_waiter_t t; + int ns_child(void *_arg) { struct ns_exec_args *args = _arg; @@ -65,6 +67,7 @@ int ns_child(void *_arg) int id1, id2; fd2 = open(fpath, O_RDWR); + task_waiter_complete(&t, 1); test_waitsig(); id1 = get_mntid(args->fd); @@ -87,6 +90,8 @@ int main(int argc, char **argv) test_init(argc, argv); + task_waiter_init(&t); + snprintf(fpath, sizeof(fpath), "%s/%s", dirname, MPTS_FILE); if (mkdir(dirname, 0600) < 0) { fail("Can't make zdtm_sys"); @@ -109,10 +114,11 @@ int main(int argc, char **argv) close(args.fd); } + task_waiter_wait4(&t, 1); + test_daemon(); test_waitsig(); - if (pid > 0) { kill(pid, SIGTERM); int status = 1;