[CRIU] [PATCH] zdtm.py: Ability to delay between iterations and pre-dumps
Pavel Emelyanov
xemul at parallels.com
Tue Oct 27 06:29:16 PDT 2015
Signed-off-by: Pavel Emelyanov <xemul at parallels.com>
---
test/zdtm.py | 18 ++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)
diff --git a/test/zdtm.py b/test/zdtm.py
index 3f1ad13..a7db8d9 100755
--- a/test/zdtm.py
+++ b/test/zdtm.py
@@ -476,15 +476,22 @@ def try_run_hook(test, args):
# Main testing entity -- dump (probably with pre-dumps) and restore
#
+def iter_parm(opt, dflt):
+ x = ((opt or str(dflt)) + ":0").split(':')
+ return (xrange(0, int(x[0])), float(x[1]))
+
def cr(cr_api, test, opts):
if opts['nocr']:
return
cr_api.set_test(test)
- for i in xrange(0, int(opts['iters'] or 1)):
- for p in xrange(0, int(opts['pre'] or 0)):
+ iters = iter_parm(opts['iters'], 1)
+ for i in iters[0]:
+ pres = iter_parm(opts['pre'], 0)
+ for p in pres[0]:
cr_api.dump("pre-dump")
+ time.sleep(pres[1])
if opts['norst']:
cr_api.dump("dump", opts = ["--leave-running"])
@@ -494,6 +501,9 @@ def cr(cr_api, test, opts):
try_run_hook(test, ["--pre-restore"])
cr_api.restore()
+ time.sleep(iters[1])
+
+
# Additional checks that can be done outside of test process
def get_maps(test):
@@ -782,10 +792,10 @@ rp.add_argument("-f", "--flavor", help = "Flavor to run")
rp.add_argument("-x", "--exclude", help = "Exclude tests from --all run", action = 'append')
rp.add_argument("--sibling", help = "Restore tests as siblings", action = 'store_true')
-rp.add_argument("--pre", help = "Do some pre-dumps before dump")
+rp.add_argument("--pre", help = "Do some pre-dumps before dump (n[:pause])")
rp.add_argument("--nocr", help = "Do not CR anything, just check test works", action = 'store_true')
rp.add_argument("--norst", help = "Don't restore tasks, leave them running after dump", action = 'store_true')
-rp.add_argument("--iters", help = "Do CR cycle several times before check")
+rp.add_argument("--iters", help = "Do CR cycle several times before check (n[:pause])")
rp.add_argument("--fault", help = "Test fault injection")
rp.add_argument("--page-server", help = "Use page server dump", action = 'store_true')
--
1.9.3
More information about the CRIU
mailing list