zdtm: Call criu.available() only for `run` action

Submitted by Radostin Stoyanov on Aug. 27, 2018, 1:28 p.m.

Details

Message ID 20180827132856.19800-1-rstoyanov1@gmail.com
State Accepted
Series "zdtm: Call criu.available() only for `run` action"
Headers show

Commit Message

Radostin Stoyanov Aug. 27, 2018, 1:28 p.m.
When zdtm.py is executed with `list` sub-command the 'criu_bin'
option is not defined and criu.available() fails.

$ python test/zdtm.py list
Traceback (most recent call last):
  File "test/zdtm.py", line 2243, in <module>
    criu.available()
  File "test/zdtm.py", line 1185, in available
    if not os.access(opts['criu_bin'], os.X_OK):
KeyError: u'criu_bin'

However, we don't need to check the existence of criu_bin
unless we use the `run` action.

Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
---
 test/zdtm.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/test/zdtm.py b/test/zdtm.py
index 90c1ac5a..c2778752 100755
--- a/test/zdtm.py
+++ b/test/zdtm.py
@@ -2239,7 +2239,8 @@  if opts.get('sat', False):
 if opts['debug']:
 	sys.settrace(traceit)
 
-criu.available()
+if opts['action'] == 'run':
+	criu.available()
 for tst in test_classes.values():
 	tst.available()
 

Comments

Adrian Reber Aug. 27, 2018, 8:49 p.m.
Thanks. I have seen this before and forgot about it.

Acked-by: Adrian Reber <areber@redhat.com>

On Mon, Aug 27, 2018 at 02:28:56PM +0100, Radostin Stoyanov wrote:
> When zdtm.py is executed with `list` sub-command the 'criu_bin'
> option is not defined and criu.available() fails.
> 
> $ python test/zdtm.py list
> Traceback (most recent call last):
>   File "test/zdtm.py", line 2243, in <module>
>     criu.available()
>   File "test/zdtm.py", line 1185, in available
>     if not os.access(opts['criu_bin'], os.X_OK):
> KeyError: u'criu_bin'
> 
> However, we don't need to check the existence of criu_bin
> unless we use the `run` action.
> 
> Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
> ---
>  test/zdtm.py | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/test/zdtm.py b/test/zdtm.py
> index 90c1ac5a..c2778752 100755
> --- a/test/zdtm.py
> +++ b/test/zdtm.py
> @@ -2239,7 +2239,8 @@ if opts.get('sat', False):
>  if opts['debug']:
>  	sys.settrace(traceit)
>  
> -criu.available()
> +if opts['action'] == 'run':
> +	criu.available()
>  for tst in test_classes.values():
>  	tst.available()
>  
> -- 
> 2.17.1
Andrey Vagin Aug. 29, 2018, 12:09 p.m.
Applied, thanks!

On Mon, Aug 27, 2018 at 02:28:56PM +0100, Radostin Stoyanov wrote:
> When zdtm.py is executed with `list` sub-command the 'criu_bin'
> option is not defined and criu.available() fails.
> 
> $ python test/zdtm.py list
> Traceback (most recent call last):
>   File "test/zdtm.py", line 2243, in <module>
>     criu.available()
>   File "test/zdtm.py", line 1185, in available
>     if not os.access(opts['criu_bin'], os.X_OK):
> KeyError: u'criu_bin'
> 
> However, we don't need to check the existence of criu_bin
> unless we use the `run` action.
> 
> Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
> ---
>  test/zdtm.py | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/test/zdtm.py b/test/zdtm.py
> index 90c1ac5a..c2778752 100755
> --- a/test/zdtm.py
> +++ b/test/zdtm.py
> @@ -2239,7 +2239,8 @@ if opts.get('sat', False):
>  if opts['debug']:
>  	sys.settrace(traceit)
>  
> -criu.available()
> +if opts['action'] == 'run':
> +	criu.available()
>  for tst in test_classes.values():
>  	tst.available()
>  
> -- 
> 2.17.1
> 
> _______________________________________________
> CRIU mailing list
> CRIU@openvz.org
> https://lists.openvz.org/mailman/listinfo/criu