[2/4] zdtm: check lazy-pages and page-server exit status after test is gone

Submitted by Mike Rapoport on May 29, 2017, 4:11 p.m.

Details

Message ID 1496074310-21104-3-git-send-email-rppt@linux.vnet.ibm.com
State New
Series "test: improve lazy-pages testing"
Headers show

Commit Message

Mike Rapoport May 29, 2017, 4:11 p.m.
When running with --lazy-pages or --remote-lazy-pages, the daemons should
run in the background, rather than complete before t.stop() is called.
Many tests try to verify things are ok after test_waitsig() and that's
exactly the place where they access memory and cause page faults.

Signed-off-by: Mike Rapoport <rppt@linux.vnet.ibm.com>
---
 test/zdtm.py | 30 ++++++++++++++----------------
 1 file changed, 14 insertions(+), 16 deletions(-)

Patch hide | download patch | download mbox

diff --git a/test/zdtm.py b/test/zdtm.py
index 26b8939..886a866 100755
--- a/test/zdtm.py
+++ b/test/zdtm.py
@@ -798,7 +798,17 @@  class criu:
 		self.__lazy_pages_p = None
 		self.__page_server_p = None
 
-	def fini(self, opts):
+	def fini(self):
+		if self.__lazy_pages_p:
+			ret = self.__lazy_pages_p.wait()
+			self.__lazy_pages_p = None
+			if ret:
+				raise test_fail_exc("criu lazy-pages exited with %s" % ret)
+		if self.__page_server_p:
+			ret = self.__page_server_p.wait()
+			self.__page_server_p = None
+			if ret:
+				raise test_fail_exc("criu page-server exited with %s" % ret)
                 return
 
 	def logs(self):
@@ -1012,18 +1022,6 @@  class criu:
 
 		self.__criu_act("restore", opts = r_opts + ["--restore-detached"])
 
-		if self.__lazy_pages_p:
-			ret = self.__lazy_pages_p.wait()
-			self.__lazy_pages_p = None
-			if ret:
-				raise test_fail_exc("criu lazy-pages exited with %s" % ret)
-
-		if self.__page_server_p:
-			ret = self.__page_server_p.wait()
-			self.__page_server_p = None
-			if ret:
-				raise test_fail_exc("criu page-server exited with %s" % ret)
-
 		if self.__leave_stopped:
 			pstree_check_stopped(self.__test.getpid())
 			pstree_signal(self.__test.getpid(), signal.SIGCONT)
@@ -1041,11 +1039,11 @@  class criu:
 	def kill(self):
 		if self.__lazy_pages_p:
 			self.__lazy_pages_p.terminate()
-			print "criu lazy-pages exited with %s" & self.wait()
+			print "criu lazy-pages exited with %s" % self.__lazy_pages_p.wait()
 			self.__lazy_pages_p = None
 		if self.__page_server_p:
 			self.__page_server_p.terminate()
-			print "criu page-server exited with %s" & self.wait()
+			print "criu page-server exited with %s" % self.__page_server_p.wait()
 			self.__page_server_p = None
 
 
@@ -1383,7 +1381,7 @@  def do_run_test(tname, tdesc, flavs, opts):
 				if opts['join_ns']:
 					check_joinns_state(t)
 				t.stop()
-				cr_api.fini(opts)
+				cr_api.fini()
 				try_run_hook(t, ["--clean"])
 		except test_fail_exc as e:
 			print_sep("Test %s FAIL at %s" % (tname, e.step), '#')