[CRIU] [PATCH 2/3] zdtm: check lazy-pages
Mike Rapoport
rppt at linux.vnet.ibm.com
Sun Aug 7 07:22:52 PDT 2016
From: Andrew Vagin <avagin at virtuozzo.com>
Cc: Adrian Reber <areber at redhat.com>
Signed-off-by: Andrew Vagin <avagin at virtuozzo.com>
Signed-off-by: Mike Rapoport <rppt at linux.vnet.ibm.com>
---
test/zdtm.py | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
diff --git a/test/zdtm.py b/test/zdtm.py
index 1438b55..ff1611d 100755
--- a/test/zdtm.py
+++ b/test/zdtm.py
@@ -645,6 +645,7 @@ class criu_cli:
self.__iter = 0
self.__prev_dump_iter = None
self.__page_server = (opts['page_server'] and True or False)
+ self.__lazy_pages = (opts['lazy_pages'] and True or False)
self.__restore_sibling = (opts['sibling'] and True or False)
self.__join_ns = (opts['join_ns'] and True or False)
self.__unshare = (opts['unshare'] and True or False)
@@ -686,6 +687,8 @@ class criu_cli:
print "Forcing %s fault" % fault
env = dict(os.environ, CRIU_FAULT = fault)
cr = subprocess.Popen(strace + [criu_bin, action] + args, env = env, preexec_fn = preexec)
+ if action == "lazy-pages":
+ return cr
return cr.wait()
def set_user_id(self):
@@ -723,6 +726,8 @@ class criu_cli:
__ddir = self.__ddir()
ret = self.__criu(action, s_args, self.__fault, strace, preexec)
+ if action == "lazy-pages":
+ return ret
grep_errors(os.path.join(__ddir, log))
if ret != 0:
if self.__fault and int(self.__fault) < 128:
@@ -801,8 +806,18 @@ class criu_cli:
if os.getenv("GCOV"):
r_opts.append("--ext-mount-map")
r_opts.append("zdtm:%s" % criu_dir)
+
+ lazy_pages_p = None
+ if self.__lazy_pages:
+ self.lazy_pages_p = self.__criu_act("lazy-pages", opts = [])
+ r_opts += ["--lazy-pages"]
+ time.sleep(1) # FIXME wait user fault fd socket
+
self.__criu_act("restore", opts = r_opts + ["--restore-detached"])
+ if lazy_pages_p and lazy_pages_p.wait():
+ raise test_fail_exc("CRIU lazy-pages")
+
@staticmethod
def check(feature):
return criu_cli.__criu("check", ["-v0", "--feature", feature]) == 0
@@ -1154,7 +1169,7 @@ class launcher:
nd = ('nocr', 'norst', 'pre', 'iters', 'page_server', 'sibling', 'unshare',
'fault', 'keep_img', 'report', 'snaps', 'sat', 'script',
- 'join_ns', 'dedup', 'sbs', 'freezecg', 'user', 'dry_run')
+ 'join_ns', 'dedup', 'sbs', 'freezecg', 'user', 'dry_run', 'lazy_pages')
arg = repr((name, desc, flavor, {d: self.__opts[d] for d in nd}))
if self.__use_log:
@@ -1398,6 +1413,8 @@ def run_tests(opts):
run_flavs -= set(['ns', 'uns'])
if opts['unshare']:
run_flavs -= set(['ns', 'uns'])
+ if opts['lazy_pages']:
+ run_flavs -= set(['ns', 'uns'])
if run_flavs:
l.run_test(t, tdesc, run_flavs)
@@ -1610,6 +1627,7 @@ rp.add_argument("-k", "--keep-img", help = "Whether or not to keep images after
choices = ['always', 'never', 'failed'], default = 'failed')
rp.add_argument("--report", help = "Generate summary report in directory")
rp.add_argument("--keep-going", help = "Keep running tests in spite of failures", action = 'store_true')
+rp.add_argument("--lazy-pages", help = "restore pages on demand", action = 'store_true')
lp = sp.add_parser("list", help = "List tests")
lp.set_defaults(action = list_tests)
--
1.9.1
More information about the CRIU
mailing list