[CRIU] [PATCH v3 1/5] tests: only wait for the pid we spawned

Tycho Andersen tycho.andersen at canonical.com
Wed Jul 13 08:10:53 PDT 2016


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 <avagin at openvz.org>
Signed-off-by: Tycho Andersen <tycho.andersen at canonical.com>
---
 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 b432f54..8c67abe 100644
--- a/test/zdtm/lib/ns.c
+++ b/test/zdtm/lib/ns.c
@@ -338,8 +338,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);
 }
-- 
2.7.4



More information about the CRIU mailing list