[CRIU] [PATCH 1/5] zdtm.py: Auto-reap all ns children

Pavel Emelyanov xemul at parallels.com
Thu Oct 8 05:18:51 PDT 2015


When test is run in pseudo-container (--parallel execution) the new namespace's
init is the python script itself. Thus all dying tests get reparent-ed to it and
sit as zombies forever.

Create pseudo-init for such containers ripping all the children.

Signed-off-by: Pavel Emelyanov <xemul at parallels.com>

---

diff --git a/test/zdtm.py b/test/zdtm.py
index 6eebc5f..fa5e429 100755
--- a/test/zdtm.py
+++ b/test/zdtm.py
@@ -531,8 +543,18 @@ def list_tests(opts, tlist):
 #
 
 if os.environ.has_key('ZDTM_CT_TEST_INFO'):
-	tinfo = eval(os.environ['ZDTM_CT_TEST_INFO'])
-	do_run_test(tinfo[0], tinfo[1], tinfo[2], tinfo[3])
+	# Fork here, since we're new pidns init and are supposed to
+	# collect this namespace's zombies
+	pid = os.fork()
+	if pid == 0:
+		tinfo = eval(os.environ['ZDTM_CT_TEST_INFO'])
+		do_run_test(tinfo[0], tinfo[1], tinfo[2], tinfo[3])
+	else:
+		while True:
+			wpid, status = os.wait()
+			if wpid == pid:
+				break;
+
 	sys.exit(0)
 
 p = argparse.ArgumentParser("ZDTM test suite")




More information about the CRIU mailing list