From: Jeff Cody <jcody@redhat.com>
To: Max Reitz <mreitz@redhat.com>
Cc: Kevin Wolf <kwolf@redhat.com>,
qemu-devel@nongnu.org, qemu-block@nongnu.org
Subject: Re: [Qemu-devel] [Qemu-block] [PATCH 1/2] iotests: Do not suppress segfaults in bash tests
Date: Wed, 2 Sep 2015 11:30:32 -0400 [thread overview]
Message-ID: <20150902153032.GP11016@localhost.localdomain> (raw)
In-Reply-To: <55E71135.1060403@redhat.com>
On Wed, Sep 02, 2015 at 05:09:41PM +0200, Max Reitz wrote:
> On 01.09.2015 00:55, Jeff Cody wrote:
> > On Mon, Aug 31, 2015 at 09:05:12PM +0200, Max Reitz wrote:
> >> Currently, if a qemu/qemu-io/qemu-img/qemu-nbd invocation receives a
> >> segmentation fault, that message is invisible in most cases since the
> >> output is generally filtered and bash suppresses the segmentation fault
> >> notice for any but the last element of a pipe.
> >>
> >> Most of the time, the test will then fail anyway because of missing
> >> output, but not necessarily (as happened with test 82 recently).
> >>
> >> Fix this by making the corresponding environment variables point to
> >> wrapper functions which execute the respective command in a subshell.
> >>
> >> Signed-off-by: Max Reitz <mreitz@redhat.com>
> >> ---
> >> tests/qemu-iotests/039 | 19 ++++++-------------
> >> tests/qemu-iotests/039.out | 6 +++---
> >> tests/qemu-iotests/061 | 6 ++++--
> >> tests/qemu-iotests/061.out | 2 ++
> >> tests/qemu-iotests/check | 8 ++++----
> >> tests/qemu-iotests/common.config | 34 ++++++++++++++++++++++++++++++----
> >> tests/qemu-iotests/common.rc | 12 +++++++++++-
> >> tests/qemu-iotests/iotests.py | 6 +++---
> >> 8 files changed, 63 insertions(+), 30 deletions(-)
> >>
[snip]
> >>
> >> -export QEMU="$QEMU_PROG $QEMU_OPTIONS"
> >> -export QEMU_IMG=$QEMU_IMG_PROG
> >> -export QEMU_IO="$QEMU_IO_PROG $QEMU_IO_OPTIONS"
> >> -export QEMU_NBD=$QEMU_NBD_PROG
> >> +export QEMU_CMD="$QEMU_PROG $QEMU_OPTIONS"
> >> +export QEMU_IMG_CMD=$QEMU_IMG_PROG
> >> +export QEMU_IO_CMD="$QEMU_IO_PROG $QEMU_IO_OPTIONS"
> >> +export QEMU_NBD_CMD=$QEMU_NBD_PROG
> >> +
> >
> > Unfortunately, these exports (old and new) make it so that pathnames
> > with spaces won't work (in case someone hasn't had it beaten into them
> > that spaced pathnames is begging for trouble...). But luckily, I
> > think your patch make it easier to fix this, since you have the
> > wrapper!
> >
> > I think we want to drop the _OPTIONS in each of the exports, e.g.:
> >
> > -export QEMU="$QEMU_PROG $QEMU_OPTIONS"
> > +export QEMU_CMD="$QEMU_PROG"
> >
> > And then instead of this:
> >
> >> +_qemu_wrapper()
> >> +{
> >> + (exec $QEMU_CMD "$@")
> >> +}
> >> +
> >
> > Use this form, instead:
> >
> > +_qemu_wrapper()
> > +{
> > + (exec "$QEMU_CMD" "$QEMU_OPTIONS" "$@")
> > +}
> > +
>
> Yes, I tried not to break anything in that regard that wasn't already
> broken, but if we have the chance to fix something, then we (I) should
> go for it.
>
> QEMU_CMD is used for the Python tests as the command line to be used for
> qemu invocation, so it cannot be modified like that. But what I can do
> is to drop QEMU.*_CMD and replace it by "$QEMU.*_PROG" "$QEMU.*_OPTIONS"
> everywhere, I guess. I'll have a look.
>
Good point.
I don't think it needs to be done in this patch series, as your
patches don't change this behavior. It could be done in a follow-up
series, by you or someone else.
I'm happy to give my r-b as-is, and we can change it later.:
Reviewed-by: Jeff Cody <jcody@redhat.com>
> Thanks for reviewing!
>
> Max
You're welcome :)
>
> >> +_qemu_img_wrapper()
> >> +{
> >> + (exec $QEMU_IMG_CMD "$@")
> >> +}
> >> +
> >> +_qemu_io_wrapper()
> >> +{
> >> + (exec $QEMU_IO_CMD "$@")
> >> +}
> >> +
> >> +_qemu_nbd_wrapper()
> >> +{
> >> + (exec $QEMU_NBD_CMD "$@")
> >> +}
> >> +
> >
> > Repeat as appropriate, above.
> >
> >> +export QEMU=_qemu_wrapper
> >> +export QEMU_IMG=_qemu_img_wrapper
> >> +export QEMU_IO=_qemu_io_wrapper
> >> +export QEMU_NBD=_qemu_nbd_wrapper
> >> +
> >> default_machine=$($QEMU -machine \? | awk '/(default)/{print $1}')
> >> default_alias_machine=$($QEMU -machine \? |\
> >> awk -v var_default_machine="$default_machine"\)\
> >> diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc
> >> index 22d3514..28e4bea 100644
> >> --- a/tests/qemu-iotests/common.rc
> >> +++ b/tests/qemu-iotests/common.rc
> >> @@ -439,7 +439,17 @@ _unsupported_imgopts()
> >> #
> >> _require_command()
> >> {
> >> - eval c=\$$1
> >> + if [ "$1" = "QEMU" ]; then
> >> + c=$QEMU_PROG
> >> + elif [ "$1" = "QEMU_IMG" ]; then
> >> + c=$QEMU_IMG_PROG
> >> + elif [ "$1" = "QEMU_IO" ]; then
> >> + c=$QEMU_IO_PROG
> >> + elif [ "$1" = "QEMU_NBD" ]; then
> >> + c=$QEMU_NBD_PROG
> >> + else
> >> + eval c=\$$1
> >> + fi
> >> [ -x "$c" ] || _notrun "$1 utility required, skipped this test"
> >> }
> >>
> >> diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
> >> index 5579253..927c74a 100644
> >> --- a/tests/qemu-iotests/iotests.py
> >> +++ b/tests/qemu-iotests/iotests.py
> >> @@ -33,9 +33,9 @@ __all__ = ['imgfmt', 'imgproto', 'test_dir' 'qemu_img', 'qemu_io',
> >>
> >> # This will not work if arguments or path contain spaces but is necessary if we
> >> # want to support the override options that ./check supports.
> >> -qemu_img_args = os.environ.get('QEMU_IMG', 'qemu-img').strip().split(' ')
> >> -qemu_io_args = os.environ.get('QEMU_IO', 'qemu-io').strip().split(' ')
> >> -qemu_args = os.environ.get('QEMU', 'qemu').strip().split(' ')
> >> +qemu_img_args = os.environ.get('QEMU_IMG_CMD', 'qemu-img').strip().split(' ')
> >> +qemu_io_args = os.environ.get('QEMU_IO_CMD', 'qemu-io').strip().split(' ')
> >> +qemu_args = os.environ.get('QEMU_CMD', 'qemu').strip().split(' ')
> >>
> >> imgfmt = os.environ.get('IMGFMT', 'raw')
> >> imgproto = os.environ.get('IMGPROTO', 'file')
> >> --
> >> 2.5.0
> >>
> >>
>
>
next prev parent reply other threads:[~2015-09-02 15:30 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-31 19:05 [Qemu-devel] [PATCH 0/2] iotests: Emit signal-kill messages Max Reitz
2015-08-31 19:05 ` [Qemu-devel] [PATCH 1/2] iotests: Do not suppress segfaults in bash tests Max Reitz
2015-08-31 22:55 ` [Qemu-devel] [Qemu-block] " Jeff Cody
2015-09-02 15:09 ` Max Reitz
2015-09-02 15:30 ` Jeff Cody [this message]
2015-10-29 14:57 ` [Qemu-devel] " Kevin Wolf
2015-10-29 18:05 ` [Qemu-devel] [Qemu-block] " Jeff Cody
2015-08-31 19:05 ` [Qemu-devel] [PATCH 2/2] iotests: Warn if python subprocess is killed Max Reitz
2015-09-08 21:25 ` [Qemu-devel] [Qemu-block] " John Snow
2015-09-08 21:29 ` Max Reitz
2015-09-08 21:37 ` John Snow
2015-09-08 21:38 ` Max Reitz
2015-09-08 21:42 ` John Snow
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=20150902153032.GP11016@localhost.localdomain \
--to=jcody@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
/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.