[CRIU] [PATCH 2/2] tests: add --dry-run to zdtm.py

Pavel Emelyanov xemul at virtuozzo.com
Thu Mar 3 09:57:45 PST 2016


On 03/03/2016 08:14 PM, Tycho Andersen wrote:
> v2: print test name + flavor info for each test too. Output looks like this
> now:
> 
> === Run 1/242 ----------------
> Skipping zdtm/transition/thread-bomb (manual run only)
> Skipping zdtm/transition/file_aio (manual run only)
> 
> ======================= Run zdtm/transition/maps007 in h =======================
> 
> ====================== Run zdtm/transition/maps007 in ns =======================
> 
> ====================== Run zdtm/transition/maps007 in uns ======================
> === Run 4/242 ----------------
> Skipping zdtm/transition/epoll (manual run only)
> 
> ==================== Run zdtm/transition/pipe_shared00 in h ====================
> 
> =================== Run zdtm/transition/pipe_shared00 in ns ====================
> 
> =================== Run zdtm/transition/pipe_shared00 in uns ===================
> === Run 6/242 ----------------
> 
> ======================== Run zdtm/transition/fork in h =========================
> 
> ======================== Run zdtm/transition/fork in ns ========================
> 
> ======================= Run zdtm/transition/fork in uns ========================
> === Run 7/242 ----------------
> Skipping zdtm/transition/ptrace (manual run only)
> Skipping zdtm/transition/socket_loop00 (manual run only)
> 
> ======================== Run zdtm/transition/ipc in ns =========================
> === Run 10/242 ----------------
> Skipping zdtm/transition/netlink00 (manual run only)
> 
> ===================== Run zdtm/transition/socket-tcp6 in h =====================
> === Run 12/242 ----------------
> ...
> 
> Signed-off-by: Tycho Andersen <tycho.andersen at canonical.com>
> ---
>  test/zdtm.py | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/test/zdtm.py b/test/zdtm.py
> index 966ed3d..bb36f4b 100755
> --- a/test/zdtm.py
> +++ b/test/zdtm.py
> @@ -939,6 +939,8 @@ def do_run_test(tname, tdesc, flavs, opts):
>  	for f in flavs:
>  		print
>  		print_sep("Run %s in %s" % (tname, f))
> +		if "CR_CT_TEST_DRY_RUN" in os.environ:
> +			continue
>  		flav = flavors[f](opts)
>  		t = tclass(tname, tdesc, flav, fcg)
>  		cr_api = criu_cli(opts)
> @@ -1016,9 +1018,12 @@ class launcher:
>  			logf = None
>  			log = None
>  
> +		env = dict(os.environ, CR_CT_TEST_INFO=arg)

Actually in order to pass the CLI options down to do_run_test this
CR_CR_TET_INFO thing is used. Just add the "dry_run" key into the
nd variable above and it will be available in do_run_test() as
opts['dry_run']

> +		if self.__opts['dry_run']:
> +			env['CR_CT_TEST_DRY_RUN'] = "yes"
> +
>  		sub = subprocess.Popen(["./zdtm_ct", "zdtm.py"], \
> -				env = dict(os.environ, CR_CT_TEST_INFO = arg ), \
> -				stdout = log, stderr = subprocess.STDOUT)
> +				env = env, stdout = log, stderr = subprocess.STDOUT)
>  		self.__subs[sub.pid] = { 'sub': sub, 'log': logf }
>  
>  		if test_flag(desc, 'excl'):
> @@ -1387,6 +1392,7 @@ rp.add_argument("--user", help = "Run CRIU as regular user", action = 'store_tru
>  
>  rp.add_argument("--page-server", help = "Use page server dump", action = 'store_true')
>  rp.add_argument("-p", "--parallel", help = "Run test in parallel")
> +rp.add_argument("--dry-run", help="Don't run tests, just pretend to", action='store_true')
>  
>  rp.add_argument("-k", "--keep-img", help = "Whether or not to keep images after test",
>  		choices = [ 'always', 'never', 'failed' ], default = 'failed')
> 



More information about the CRIU mailing list