qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Max Reitz <mreitz@redhat.com>
To: Jeff Cody <jcody@redhat.com>, qemu-devel@nongnu.org
Cc: kwolf@redhat.com, jsnow@redhat.com, qemu-block@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v3 1/2] qemu-iotests: fix cleanup of background processes
Date: Fri, 30 Oct 2015 22:13:43 +0100	[thread overview]
Message-ID: <5633DD87.1090302@redhat.com> (raw)
In-Reply-To: <9e4f958b3895b7259b98d845bb46f000ba362869.1446232490.git.jcody@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1957 bytes --]

On 30.10.2015 20:25, Jeff Cody wrote:
> Commit 934659c switched the iotests to run qemu and qemu-nbd from a bash
> subshell, in order to catch segfaults.  Unfortunately, this means the
> process PID cannot be captured via '$!'. We stopped killing qemu and
> qemu-nbd processes, leaving a lot of orphaned, running qemu processes
> after executing iotests.
> 
> Since the process is using exec in the subshell, the PID is the
> same as the subshell PID.
> 
> Track these PIDs for cleanup using pidfiles in the $TEST_DIR. Only
> track the qemu PID, however, if requested - not all usage requires
> killing the process.
> 
> Reported-by: John Snow <jsnow@redhat.com>
> Signed-off-by: Jeff Cody <jcody@redhat.com>
> ---
>  tests/qemu-iotests/058           | 12 ++++++++----
>  tests/qemu-iotests/common.config | 14 ++++++++++++--
>  tests/qemu-iotests/common.qemu   | 18 ++++++++++++------
>  tests/qemu-iotests/common.rc     |  8 +++++---
>  4 files changed, 37 insertions(+), 15 deletions(-)
> 
> diff --git a/tests/qemu-iotests/058 b/tests/qemu-iotests/058
> index f2bdd0b..63a6598 100755
> --- a/tests/qemu-iotests/058
> +++ b/tests/qemu-iotests/058
> @@ -32,11 +32,17 @@ status=1	# failure is the default!
>  
>  nbd_unix_socket=$TEST_DIR/test_qemu_nbd_socket
>  nbd_snapshot_img="nbd:unix:$nbd_unix_socket"
> +rm -f "${TEST_DIR}/qemu-nbd.pid"
>  
>  _cleanup_nbd()
>  {
> -    if [ -n "$NBD_SNAPSHOT_PID" ]; then
> -        kill "$NBD_SNAPSHOT_PID"
> +    local NBD_SNAPSHOT_PID
> +    if [ -f "${TEST_DIR}/qemu-nbd.pid" ]; then
> +        read NBD_SNAPSHOT_PID < "${TEST_DIR}/qemu-nbd.pid"
> +        rm -f "${TEST_DIR}/qemu-nbd.pid"
> +        if [ -n "$NBD_SNAPSHOT_PID" ]; then

No, I won't complain about using ! -z "" elsewhere and -n "" here. :-)

Reviewed-by: Max Reitz <mreitz@redhat.com>

> +            kill "$NBD_SNAPSHOT_PID"
> +        fi
>      fi
>      rm -f "$nbd_unix_socket"
>  }



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

  reply	other threads:[~2015-10-30 21:13 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-30 19:25 [Qemu-devel] [PATCH v3 0/2] qemu-iotests: fix cleanup of background processes Jeff Cody
2015-10-30 19:25 ` [Qemu-devel] [PATCH v3 1/2] " Jeff Cody
2015-10-30 21:13   ` Max Reitz [this message]
2015-11-02  7:37     ` Markus Armbruster
2015-11-02 16:03       ` Max Reitz
2015-11-02 16:32         ` Eric Blake
2015-10-30 19:25 ` [Qemu-devel] [PATCH v3 2/2] qemu-iotests: fix -valgrind option for check Jeff Cody
2015-10-30 21:14   ` Max Reitz
2015-11-02 20:31 ` [Qemu-devel] [PATCH v3 0/2] qemu-iotests: fix cleanup of background processes Max Reitz
2015-11-02 20:35   ` Max Reitz

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=5633DD87.1090302@redhat.com \
    --to=mreitz@redhat.com \
    --cc=jcody@redhat.com \
    --cc=jsnow@redhat.com \
    --cc=kwolf@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 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).