[CRIU] [PATCH v2 4/4] join-ns: add join-ns zdtm test

Andrew Vagin avagin at virtuozzo.com
Fri Apr 29 15:22:46 PDT 2016


======================= Run zdtm/static/socket6_udp in h =======================
Start test
./socket6_udp --pidfile=socket6_udp.pid --outfile=socket6_udp.out
Run criu dump
Run criu restore
=[log]=> dump/zdtm/static/socket6_udp/24/1/restore.log
------------------------ grep Error ------------------------
(00.014268)     24: Error (sk-inet.c:748): Can't connect inet socket back: Network is unreachable
(00.014342) Error (cr-restore.c:2248): Restoring FAILED.
------------------------ ERROR OVER ------------------------
############## Test zdtm/static/socket6_udp FAIL at CRIU restore ###############

On Sat, Apr 09, 2016 at 10:00:13AM +0800, Dengguangxing wrote:
> join-ns zdtm test will skip ns and uns flavors, and
> some socket related test, too. Because join-ns test will
> try to join an existing network namespace.
> 
> Signed-off-by: Deng Guangxing <dengguangxing at huawei.com>
> ---
>  test/zdtm.py                              | 23 +++++++++++++++++++++--
>  test/zdtm/static/packet_sock.desc         |  2 +-
>  test/zdtm/static/socket-tcp-local.desc    |  2 +-
>  test/zdtm/static/socket-tcp.desc          |  2 +-
>  test/zdtm/static/socket-tcp6.desc         |  2 +-
>  test/zdtm/static/socket-tcpbuf-local.desc |  2 +-
>  test/zdtm/static/socket-tcpbuf.desc       |  2 +-
>  test/zdtm/static/socket-tcpbuf6.desc      |  2 +-
>  test/zdtm/static/socket_udp.desc          |  1 +
>  test/zdtm/static/socket_udplite.desc      |  1 +
>  test/zdtm/transition/socket-tcp.desc      |  2 +-
>  test/zdtm/transition/socket-tcp6.desc     |  2 +-
>  12 files changed, 32 insertions(+), 11 deletions(-)
>  create mode 100644 test/zdtm/static/socket_udp.desc
>  create mode 100644 test/zdtm/static/socket_udplite.desc
> 
> diff --git a/test/zdtm.py b/test/zdtm.py
> index 27e938b..a4368ea 100755
> --- a/test/zdtm.py
> +++ b/test/zdtm.py
> @@ -601,6 +601,7 @@ test_classes = { 'zdtm': zdtm_test, 'inhfd': inhfd_test, 'groups': groups_test }
>  #
> 
>  criu_bin = "../criu/criu"
> +join_ns_file = '/run/netns/zdtm_netns'
>  class criu_cli:
>  	def __init__(self, opts):
>  		self.__test = None
> @@ -609,6 +610,7 @@ class criu_cli:
>  		self.__prev_dump_iter = None
>  		self.__page_server = (opts['page_server'] and True or False)
>  		self.__restore_sibling = (opts['sibling'] and True or False)
> +		self.__join_ns = (opts['join_ns'] and True or False)
>  		self.__fault = (opts['fault'])
>  		self.__sat = (opts['sat'] and True or False)
>  		self.__dedup = (opts['dedup'] and True or False)
> @@ -741,6 +743,9 @@ class criu_cli:
>  			r_opts = ["--restore-sibling"]
>  			self.__test.auto_reap = False
>  		r_opts += self.__test.getropts()
> +		if self.__join_ns:
> +			r_opts.append("--join-ns")
> +			r_opts.append("net:%s" % join_ns_file)
> 
>  		self.__prev_dump_iter = None
>  		criu_dir = os.path.dirname(os.getcwd())
> @@ -1057,7 +1062,7 @@ class launcher:
>  		self.__nr += 1
>  		self.__show_progress()
> 
> -		nd = ('nocr', 'norst', 'pre', 'iters', 'page_server', 'sibling', \
> +		nd = ('nocr', 'norst', 'pre', 'iters', 'page_server', 'sibling', 'join_ns', \
>  				'fault', 'keep_img', 'report', 'snaps', 'sat', \
>  				'dedup', 'sbs', 'freezecg', 'user', 'dry_run')
>  		arg = repr((name, desc, flavor, { d: self.__opts[d] for d in nd }))
> @@ -1226,6 +1231,9 @@ def run_tests(opts):
>  		print "Parallel launch with freezer not supported"
>  		opts['parallel'] = None
> 
> +	if opts['join_ns']:
> +		subprocess.Popen(["ip", "netns", "add", "zdtm_netns"])

You need to wait and check an return code here.

> +
>  	l = launcher(opts, len(torun))
>  	try:
>  		for t in torun:
> @@ -1266,6 +1274,11 @@ def run_tests(opts):
>  					l.skip(t, "criu root prio needed")
>  					continue
> 
> +			if opts['join_ns']:
> +				if test_flag(tdesc, 'samens'):
> +					l.skip(t, "samens test in the same namespace")
> +					continue
> +
>  			test_flavs = tdesc.get('flavor', 'h ns uns').split()
>  			opts_flavs = (opts['flavor'] or 'h,ns,uns').split(',')
>  			if opts_flavs != ['best']:
> @@ -1290,13 +1303,18 @@ def run_tests(opts):
>  				except KeyError:
>  					pass
> 
> +			#remove ns and uns flavor in join_ns
> +			if opts['join_ns']:
> +				run_flavs -= set(['ns', 'uns'])
> +
>  			if run_flavs:
>  				l.run_test(t, tdesc, run_flavs)
>  			else:
>  				l.skip(t, "no flavors")
>  	finally:
>  		l.finish()
> -
> +		if opts['join_ns']:
> +			subprocess.Popen(["ip", "netns", "delete", "zdtm_netns"])
> 
>  sti_fmt = "%-40s%-10s%s"
> 
> @@ -1476,6 +1494,7 @@ 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("--join-ns", help = "Restore tests and join existing namespace", action = 'store_true')
>  rp.add_argument("--pre", help = "Do some pre-dumps before dump (n[:pause])")
>  rp.add_argument("--snaps", help = "Instead of pre-dumps do full dumps", action = 'store_true')
>  rp.add_argument("--dedup", help = "Auto-deduplicate images on iterations", action = 'store_true')
> diff --git a/test/zdtm/static/packet_sock.desc b/test/zdtm/static/packet_sock.desc
> index 2eac7e6..8c39ed1 100644
> --- a/test/zdtm/static/packet_sock.desc
> +++ b/test/zdtm/static/packet_sock.desc
> @@ -1 +1 @@
> -{'flags': 'suid'}
> +{'flags': 'suid samens'}
> diff --git a/test/zdtm/static/socket-tcp-local.desc b/test/zdtm/static/socket-tcp-local.desc
> index e02979e..6a406f6 100644
> --- a/test/zdtm/static/socket-tcp-local.desc
> +++ b/test/zdtm/static/socket-tcp-local.desc
> @@ -1 +1 @@
> -{'flavor': 'h ns uns', 'opts': '--tcp-established', 'flags': 'nouser'}
> +{'flavor': 'h ns uns', 'opts': '--tcp-established', 'flags': 'nouser samens'}
> diff --git a/test/zdtm/static/socket-tcp.desc b/test/zdtm/static/socket-tcp.desc
> index 7c1ae7a..ca3268b 100644
> --- a/test/zdtm/static/socket-tcp.desc
> +++ b/test/zdtm/static/socket-tcp.desc
> @@ -1 +1 @@
> -{'flavor': 'h', 'opts': '--tcp-established', 'flags': 'nouser'}
> +{'flavor': 'h', 'opts': '--tcp-established', 'flags': 'nouser samens'}
> diff --git a/test/zdtm/static/socket-tcp6.desc b/test/zdtm/static/socket-tcp6.desc
> index 7c1ae7a..ca3268b 100644
> --- a/test/zdtm/static/socket-tcp6.desc
> +++ b/test/zdtm/static/socket-tcp6.desc
> @@ -1 +1 @@
> -{'flavor': 'h', 'opts': '--tcp-established', 'flags': 'nouser'}
> +{'flavor': 'h', 'opts': '--tcp-established', 'flags': 'nouser samens'}
> diff --git a/test/zdtm/static/socket-tcpbuf-local.desc b/test/zdtm/static/socket-tcpbuf-local.desc
> index e02979e..6a406f6 100644
> --- a/test/zdtm/static/socket-tcpbuf-local.desc
> +++ b/test/zdtm/static/socket-tcpbuf-local.desc
> @@ -1 +1 @@
> -{'flavor': 'h ns uns', 'opts': '--tcp-established', 'flags': 'nouser'}
> +{'flavor': 'h ns uns', 'opts': '--tcp-established', 'flags': 'nouser samens'}
> diff --git a/test/zdtm/static/socket-tcpbuf.desc b/test/zdtm/static/socket-tcpbuf.desc
> index 7c1ae7a..ca3268b 100644
> --- a/test/zdtm/static/socket-tcpbuf.desc
> +++ b/test/zdtm/static/socket-tcpbuf.desc
> @@ -1 +1 @@
> -{'flavor': 'h', 'opts': '--tcp-established', 'flags': 'nouser'}
> +{'flavor': 'h', 'opts': '--tcp-established', 'flags': 'nouser samens'}
> diff --git a/test/zdtm/static/socket-tcpbuf6.desc b/test/zdtm/static/socket-tcpbuf6.desc
> index 7c1ae7a..ca3268b 100644
> --- a/test/zdtm/static/socket-tcpbuf6.desc
> +++ b/test/zdtm/static/socket-tcpbuf6.desc
> @@ -1 +1 @@
> -{'flavor': 'h', 'opts': '--tcp-established', 'flags': 'nouser'}
> +{'flavor': 'h', 'opts': '--tcp-established', 'flags': 'nouser samens'}
> diff --git a/test/zdtm/static/socket_udp.desc b/test/zdtm/static/socket_udp.desc
> new file mode 100644
> index 0000000..2add893
> --- /dev/null
> +++ b/test/zdtm/static/socket_udp.desc
> @@ -0,0 +1 @@
> +{'flags': 'samens'}
> diff --git a/test/zdtm/static/socket_udplite.desc b/test/zdtm/static/socket_udplite.desc
> new file mode 100644
> index 0000000..2add893
> --- /dev/null
> +++ b/test/zdtm/static/socket_udplite.desc
> @@ -0,0 +1 @@
> +{'flags': 'samens'}
> diff --git a/test/zdtm/transition/socket-tcp.desc b/test/zdtm/transition/socket-tcp.desc
> index 7c1ae7a..ca3268b 100644
> --- a/test/zdtm/transition/socket-tcp.desc
> +++ b/test/zdtm/transition/socket-tcp.desc
> @@ -1 +1 @@
> -{'flavor': 'h', 'opts': '--tcp-established', 'flags': 'nouser'}
> +{'flavor': 'h', 'opts': '--tcp-established', 'flags': 'nouser samens'}
> diff --git a/test/zdtm/transition/socket-tcp6.desc b/test/zdtm/transition/socket-tcp6.desc
> index 7c1ae7a..ca3268b 100644
> --- a/test/zdtm/transition/socket-tcp6.desc
> +++ b/test/zdtm/transition/socket-tcp6.desc
> @@ -1 +1 @@
> -{'flavor': 'h', 'opts': '--tcp-established', 'flags': 'nouser'}
> +{'flavor': 'h', 'opts': '--tcp-established', 'flags': 'nouser samens'}
> -- 
> 2.5.0
> 
> _______________________________________________
> CRIU mailing list
> CRIU at openvz.org
> https://lists.openvz.org/mailman/listinfo/criu


More information about the CRIU mailing list