[CRIU] [PATCH] zdtm.py: catch KeyError instead of ValueError for sets
Andrew Vagin
avagin at virtuozzo.com
Wed Dec 9 23:01:21 PST 2015
On Wed, Dec 09, 2015 at 08:12:46PM +0300, Pavel Emelyanov wrote:
> On 12/09/2015 08:06 PM, Andrey Vagin wrote:
> > From: Andrey Vagin <avagin at openvz.org>
> >
> > In [3]: a
> > Out[3]: {1, 2, 3}
> >
> > In [4]: a.remove(5)
> > ---------------------------------------------------------------------------
> > KeyError Traceback (most recent call last)
> > <ipython-input-4-af76ca25878a> in <module>()
> > ----> 1 a.remove(5)
> >
> > KeyError: 5
> >
> > Signed-off-by: Andrey Vagin <avagin at openvz.org>
> > ---
> > seize.c | 2 +-
> > test/zdtm.py | 2 +-
> > 2 files changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/seize.c b/seize.c
> > index de5c929..b6df908 100644
> > --- a/seize.c
> > +++ b/seize.c
> > @@ -352,7 +352,7 @@ static void pstree_wait(struct pstree_item *root_item)
> > continue;
> >
> > for (i = 0; i < item->nr_threads; i++) {
> > - pid = wait4(-1, &status, __WALL, NULL);
> > + pid = wait4(item->threads[i].real, &status, __WALL, NULL);
>
> Is this fixlet also critical for zdtm.py exception handling?
Sure :-D
>
> > if (pid < 0) {
> > pr_perror("wait4 failed");
> > break;
> > diff --git a/test/zdtm.py b/test/zdtm.py
> > index 6f0744a..f51b3c5 100755
> > --- a/test/zdtm.py
> > +++ b/test/zdtm.py
> > @@ -977,7 +977,7 @@ def run_tests(opts):
> > if not criu_cli.check("userns"):
> > try:
> > run_flavs.remove("uns")
> > - except ValueError:
> > + except KeyError:
> > # don't worry if uns isn't in run_flavs
> > pass
> >
> >
>
More information about the CRIU
mailing list