From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40667) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZtHZt-0003rd-9P for qemu-devel@nongnu.org; Mon, 02 Nov 2015 11:03:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZtHZs-0005dH-5W for qemu-devel@nongnu.org; Mon, 02 Nov 2015 11:03:25 -0500 References: <9e4f958b3895b7259b98d845bb46f000ba362869.1446232490.git.jcody@redhat.com> <5633DD87.1090302@redhat.com> <87a8qw4zso.fsf@blackfin.pond.sub.org> From: Max Reitz Message-ID: <5637893E.6030200@redhat.com> Date: Mon, 2 Nov 2015 17:03:10 +0100 MIME-Version: 1.0 In-Reply-To: <87a8qw4zso.fsf@blackfin.pond.sub.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="GRfunukVpawe6xfNwnMeC8AbfnFfikiC1" Subject: Re: [Qemu-devel] [PATCH v3 1/2] qemu-iotests: fix cleanup of background processes List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: kwolf@redhat.com, Jeff Cody , jsnow@redhat.com, qemu-devel@nongnu.org, qemu-block@nongnu.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --GRfunukVpawe6xfNwnMeC8AbfnFfikiC1 Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: quoted-printable On 02.11.2015 08:37, Markus Armbruster wrote: > Max Reitz writes: >=20 >> On 30.10.2015 20:25, Jeff Cody wrote: >>> Commit 934659c switched the iotests to run qemu and qemu-nbd from a b= ash >>> 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 >>> Signed-off-by: Jeff Cody >>> --- >>> 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=3D1 # failure is the default! >>> =20 >>> nbd_unix_socket=3D$TEST_DIR/test_qemu_nbd_socket >>> nbd_snapshot_img=3D"nbd:unix:$nbd_unix_socket" >>> +rm -f "${TEST_DIR}/qemu-nbd.pid" >>> =20 >>> _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. :-)= >=20 > The little pedant in me screams "but I will!", and the little prankster= > next to him is clapping enthusiastically. >=20 > Kidding aside: not worth a respin, but could be cleaned up on commit > (maintainer's discretion). Oh, if that's the case, then I have another thing for you: The use of =3D= =3D in patch 2! ;-) (I'm a bit disappointed Eric doesn't have a mail filter for #!/bin/(ba)?sh ... if.*=3D=3D for his mail client.) Max >=20 >> Reviewed-by: Max Reitz >> >>> + kill "$NBD_SNAPSHOT_PID" >>> + fi >>> fi >>> rm -f "$nbd_unix_socket" >>> } --GRfunukVpawe6xfNwnMeC8AbfnFfikiC1 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAEBCAAGBQJWN4k+AAoJEDuxQgLoOKytqz4H/0jLexdtVITiXZR+oZghYO7D jRV3fCRQ4papb6Lqh/+RrtfaokGQOb1Z/zyzcMKNKqUi4D99nR38GXl8Pdqyo+vH IPBa9roXkV5hU2/9DRRPu6kuWpLbCHz42+WyIWQ2HkjjesKEAeTKgJgSyEmjlcP5 mOedf4mcBy9+jKOujK91Z7vxfm5h1OgTkWgK/Uv6/GqHBtuxlDiZpAlkMJp0d/+I I+LtV+Avm0mBpPpd5iCUvpvXhh6CWhWFe7m3kyUgBwW/raCuw86ZxnWPDlewPkeP vse6UCl8aIpbtXtqbqIIAZnFwXi2Ny1RHv6woOo0StjwinYeXajV4NvdGz+Vg8U= =IOkn -----END PGP SIGNATURE----- --GRfunukVpawe6xfNwnMeC8AbfnFfikiC1--