qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Cc: "thuth@redhat.com" <thuth@redhat.com>,
	"ehabkost@redhat.com" <ehabkost@redhat.com>,
	"qemu-block@nongnu.org" <qemu-block@nongnu.org>,
	"philmd@redhat.com" <philmd@redhat.com>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
	"mreitz@redhat.com" <mreitz@redhat.com>,
	"jsnow@redhat.com" <jsnow@redhat.com>
Subject: Re: [PATCH v2 1/2] iotests: Require Python 3.6 or later
Date: Fri, 20 Sep 2019 11:27:29 +0200	[thread overview]
Message-ID: <20190920092729.GC5458@localhost.localdomain> (raw)
In-Reply-To: <5f0e3c27-1c33-0f9b-485b-c3e4a6700138@virtuozzo.com>

Am 20.09.2019 um 10:40 hat Vladimir Sementsov-Ogievskiy geschrieben:
> 19.09.2019 19:29, Kevin Wolf wrote:
> > Running iotests is not required to build QEMU, so we can have stricter
> > version requirements for Python here and can make use of new features
> > and drop compatibility code earlier.
> > 
> > This makes qemu-iotests skip all Python tests if a Python version before
> > 3.6 is used for the build.
> > 
> > Suggested-by: Eduardo Habkost <ehabkost@redhat.com>
> > Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> > ---
> >   tests/qemu-iotests/check | 13 ++++++++++++-
> >   1 file changed, 12 insertions(+), 1 deletion(-)
> > 
> > diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check
> > index 875399d79f..588c453a94 100755
> > --- a/tests/qemu-iotests/check
> > +++ b/tests/qemu-iotests/check
> > @@ -633,6 +633,12 @@ then
> >       export SOCKET_SCM_HELPER="$build_iotests/socket_scm_helper"
> >   fi
> >   
> > +python_usable=false
> > +if $PYTHON -c 'import sys; sys.exit(0 if sys.version_info >= (3,6) else 1)'
> > +then
> > +    python_usable=true
> > +fi
> > +
> >   default_machine=$($QEMU_PROG -machine help | sed -n '/(default)/ s/ .*//p')
> >   default_alias_machine=$($QEMU_PROG -machine help | \
> >      sed -n "/(alias of $default_machine)/ { s/ .*//p; q; }")
> > @@ -809,7 +815,12 @@ do
> >           start=$(_wallclock)
> >   
> >           if [ "$(head -n 1 "$source_iotests/$seq")" == "#!/usr/bin/env python" ]; then
> > -            run_command="$PYTHON $seq"
> > +            if $python_usable; then
> 
> hmm I wanted to say that this should not work, as python_usable is a
> string. But I checked and see - it's work. Wow. Googled. And now I
> understand that here "false" or "true" command is called, to obtain
> it's return value.. I don't like bash and don't know its best
> practice, but I'd prefer python_usable to be just return value of your
> python command, like
> 
> above:
> 
>    $PYTHON -c 'import sys; sys.exit(0 if sys.version_info >= (3,6) else 1)'
>    python_usable=$?
> 
> and here:
> 
>    if [ $python_usable -eq 0 ]; then

I'm just trying to be consistent with other variables used in the
'check' script. It has many boolean variables and they all end up
calling the true/false commands.

And actually I think the version used is easier to read, even if maybe
not as easy to understand why exactly it works.

Kevin


  reply	other threads:[~2019-09-20  9:29 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-19 16:29 [PATCH v2 0/2] iotests: Require Python 3.6 or later Kevin Wolf
2019-09-19 16:29 ` [PATCH v2 1/2] " Kevin Wolf
2019-09-19 16:38   ` Eduardo Habkost
2019-09-19 16:41   ` Thomas Huth
2019-09-20  8:40   ` Vladimir Sementsov-Ogievskiy
2019-09-20  9:27     ` Kevin Wolf [this message]
2019-09-20  9:44       ` Vladimir Sementsov-Ogievskiy
2019-09-19 16:29 ` [PATCH v2 2/2] iotests: Remove Python 2 compatibility code Kevin Wolf
2019-09-19 16:38   ` Eduardo Habkost
2019-09-19 16:42   ` Thomas Huth
2019-09-19 19:14   ` John Snow
2019-09-20  8:51   ` Vladimir Sementsov-Ogievskiy
2019-09-19 17:15 ` [PATCH v2 0/2] iotests: Require Python 3.6 or later Philippe Mathieu-Daudé

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=20190920092729.GC5458@localhost.localdomain \
    --to=kwolf@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=jsnow@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=philmd@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=thuth@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).