From: Kevin Wolf <kwolf@redhat.com>
To: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org, mreitz@redhat.com,
jsnow@redhat.com, eblake@redhat.com, stefanha@redhat.com,
den@openvz.org
Subject: Re: [Qemu-devel] [PATCH 1/3] iotests.py: improve verify_image_format helper
Date: Wed, 4 Apr 2018 11:50:29 +0200 [thread overview]
Message-ID: <20180404095029.GC4482@localhost.localdomain> (raw)
In-Reply-To: <e4d7751e-3d88-e31b-7b73-23b8417eca88@virtuozzo.com>
Am 04.04.2018 um 10:48 hat Vladimir Sementsov-Ogievskiy geschrieben:
> 03.04.2018 16:54, Kevin Wolf wrote:
> > Am 30.03.2018 um 17:16 hat Vladimir Sementsov-Ogievskiy geschrieben:
> > > Add an assert (we don't want set both arguments) and remove
> > > duplication.
> > >
> > > Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
> > > ---
> > > tests/qemu-iotests/iotests.py | 6 +++---
> > > 1 file changed, 3 insertions(+), 3 deletions(-)
> > >
> > > diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
> > > index b5d7945..83c454d 100644
> > > --- a/tests/qemu-iotests/iotests.py
> > > +++ b/tests/qemu-iotests/iotests.py
> > > @@ -532,9 +532,9 @@ def notrun(reason):
> > > sys.exit(0)
> > > def verify_image_format(supported_fmts=[], unsupported_fmts=[]):
> > > - if supported_fmts and (imgfmt not in supported_fmts):
> > > - notrun('not suitable for this image format: %s' % imgfmt)
> > > - if unsupported_fmts and (imgfmt in unsupported_fmts):
> > > + assert not (supported_fmts and unsupported_fmts)
> > > + not_sup = supported_fmts and (imgfmt not in supported_fmts)
> > > + if not_sup or (imgfmt in unsupported_fmts):
> > > notrun('not suitable for this image format: %s' % imgfmt)
> > Before the change, we accepted None for both parameters. Now None is
> > still accepted for supported_fmts, but not for unsupported_fmts any
> > more.
> >
> > I don't think we actually make use of None for either, so I don't really
> > mind whether we allow it or not, but we should be consistent between
> > both parameters.
> >
> > Kevin
>
> I think, we should not care about it. The function takes lists. So, you can
> 1. pass a parameter, which must be list
> 2. do not pass it, it will become [] by default.
>
> So if someone pass None directly, its a bug. Like if someone will pass int
> or float..
Yeah, brain fart. Somehow I thought you could just check 'imgfmt not in
supported_fmts' without checking 'supported_fmt' first, but obviously
that would make the default that nothing is accepted. Your version is
fine.
Kevin
next prev parent reply other threads:[~2018-04-04 9:50 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-30 15:16 [Qemu-devel] [PATCH 0/3] iotests: blacklist bochs and cloop for 205 and 208 Vladimir Sementsov-Ogievskiy
2018-03-30 15:16 ` [Qemu-devel] [PATCH 1/3] iotests.py: improve verify_image_format helper Vladimir Sementsov-Ogievskiy
2018-04-03 13:54 ` Kevin Wolf
2018-04-04 8:48 ` Vladimir Sementsov-Ogievskiy
2018-04-04 9:50 ` Kevin Wolf [this message]
2018-03-30 15:16 ` [Qemu-devel] [PATCH 2/3] iotests.py: support unsupported_fmts in main() Vladimir Sementsov-Ogievskiy
2018-03-30 15:16 ` [Qemu-devel] [PATCH 3/3] iotests: blacklist bochs and cloop for 205 and 208 Vladimir Sementsov-Ogievskiy
2018-04-03 13:36 ` Kevin Wolf
2018-04-09 11:30 ` Vladimir Sementsov-Ogievskiy
2018-04-09 13:29 ` Kevin Wolf
2018-03-30 15:17 ` [Qemu-devel] [PATCH for 2.12 0/3] " Vladimir Sementsov-Ogievskiy
2018-03-31 8:29 ` [Qemu-devel] [PATCH " no-reply
2018-03-31 8:58 ` no-reply
2018-04-04 10:05 ` Kevin Wolf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180404095029.GC4482@localhost.localdomain \
--to=kwolf@redhat.com \
--cc=den@openvz.org \
--cc=eblake@redhat.com \
--cc=jsnow@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
--cc=vsementsov@virtuozzo.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.