[CRIU] zdtm.py --keep-going output
Andrei Vagin
avagin at virtuozzo.com
Wed Mar 21 01:01:34 MSK 2018
On Tue, Mar 20, 2018 at 05:02:36PM +0100, Adrian Reber wrote:
> Hello Andrei,
>
> I just saw that the --keep-going output has switched back to printing
>
> * testname(unkown)
>
> instead of:
>
> ################### 2 TEST(S) FAILED (TOTAL 297/SKIPPED 34) ####################
> * zdtm/static/sched_policy00(ns)
> * zdtm/static/cgroup02(h)
> ##################################### FAIL #####################################
>
> This is caused by your commit:
>
> commit 5785dbd93dec20f56a89245b94f6fde28cd098ac
> Author: Andrei Vagin <avagin at virtuozzo.com>
> Date: Thu Oct 26 00:27:43 2017 +0300
>
> zdtm.py: fix decode_flav()
>
> Signed-off-by: Andrei Vagin <avagin at virtuozzo.com>
>
> diff --git a/test/zdtm.py b/test/zdtm.py
> index efed134..d3e0c9a 100755
> --- a/test/zdtm.py
> +++ b/test/zdtm.py
> @@ -293,7 +293,7 @@ def encode_flav(f):
>
>
> def decode_flav(i):
> - return flavors.keys().get([i - 128], "unknown")
> + return flavors.get(i - 128, "unknown")
>
>
> def tail(path):
>
> decode_flav was already changed from the working code with commit
>
> commit c9ca83f05ae30810bd90e092dfc98fa7afe310b9
> Author: Andrei Vagin <avagin at openvz.org>
> Date: Mon Oct 23 09:57:48 2017 -0700
>
>
> The get() method requires a key and now we are using an index. That
> will never work correctly as it is now.
>
> Any reasons for your change? Or could we change it back?
The reason was described in the commit message of c9ca83f05a:
test/zdtm.py:181:4: E722 do not use bare except'
I'm agree that my fix was incorrect. We can return the origin code and
specify the IndexError exception, ot we can fix this by this way:
diff --git a/test/zdtm.py b/test/zdtm.py
index 030065dde..6ec0fe88d 100755
--- a/test/zdtm.py
+++ b/test/zdtm.py
@@ -289,18 +289,18 @@ class userns_flavor(ns_flavor):
flavors = {'h': host_flavor, 'ns': ns_flavor, 'uns': userns_flavor}
-
+flavors_codes = dict(zip(xrange(len(flavors)), sorted(flavors.keys())))
#
# Helpers
#
def encode_flav(f):
- return (flavors.keys().index(f) + 128)
+ return sorted(flavors.keys()).index(f) + 128
def decode_flav(i):
- return flavors.get(i - 128, "unknown")
+ return flavors_codes.get(i - 128, "unknown")
def tail(path):
>
> Adrian
More information about the CRIU
mailing list