From d5bee200a103cc1466aa98007ccc955a57ba4dc6 Mon Sep 17 00:00:00 2001 From: Tycho Andersen Date: Wed, 13 Jul 2016 15:10:53 +0000 Subject: [PATCH] tests: only wait for the pid we spawned In the next patch, we'll introduce an option to allow for leaving zombie processes in the pid ns for the test so that we can test the behavior of zombies. Let's not reap everything after restore, since we'll reap the restored zombies as well. v2: restore the old behavior when in reap mode CC: Andrey Vagin Signed-off-by: Tycho Andersen Acked-by: Andrew Vagin Signed-off-by: Pavel Emelyanov --- test/zdtm/lib/ns.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/test/zdtm/lib/ns.c b/test/zdtm/lib/ns.c index 2a0aee4df..9b0614a97 100644 --- a/test/zdtm/lib/ns.c +++ b/test/zdtm/lib/ns.c @@ -343,8 +343,13 @@ int ns_init(int argc, char **argv) kill(pid, SIGTERM); ret = 0; - while (ret != -1) - ret = wait(NULL); + if (reap) { + while (ret != -1) + ret = wait(NULL); + } else { + waitpid(pid, NULL, 0); + } + exit(1); }