From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50252) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bvSaT-0004GV-HC for qemu-devel@nongnu.org; Sat, 15 Oct 2016 13:17:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bvSaR-00008m-J7 for qemu-devel@nongnu.org; Sat, 15 Oct 2016 13:17:32 -0400 References: <20160928205602.17275-1-mreitz@redhat.com> <20160928205602.17275-10-mreitz@redhat.com> <20161013131115.GJ5803@noname.redhat.com> From: Max Reitz Message-ID: Date: Sat, 15 Oct 2016 19:17:19 +0200 MIME-Version: 1.0 In-Reply-To: <20161013131115.GJ5803@noname.redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="LTk1es8MrBO9KQ65TuNJ4ktCT6DghxquQ" Subject: Re: [Qemu-devel] [PATCH v4 09/12] iotests.py: Add qemu_nbd function List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: qemu-block@nongnu.org, qemu-devel@nongnu.org, Eric Blake , Paolo Bonzini , Markus Armbruster This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --LTk1es8MrBO9KQ65TuNJ4ktCT6DghxquQ From: Max Reitz To: Kevin Wolf Cc: qemu-block@nongnu.org, qemu-devel@nongnu.org, Eric Blake , Paolo Bonzini , Markus Armbruster Message-ID: Subject: Re: [PATCH v4 09/12] iotests.py: Add qemu_nbd function References: <20160928205602.17275-1-mreitz@redhat.com> <20160928205602.17275-10-mreitz@redhat.com> <20161013131115.GJ5803@noname.redhat.com> In-Reply-To: <20161013131115.GJ5803@noname.redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable On 13.10.2016 15:11, Kevin Wolf wrote: > Am 28.09.2016 um 22:55 hat Max Reitz geschrieben: >> Signed-off-by: Max Reitz >> --- >> tests/qemu-iotests/iotests.py | 8 ++++++++ >> 1 file changed, 8 insertions(+) >> >> diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotest= s.py >> index 3329bc1..5a2678f 100644 >> --- a/tests/qemu-iotests/iotests.py >> +++ b/tests/qemu-iotests/iotests.py >> @@ -39,6 +39,10 @@ qemu_io_args =3D [os.environ.get('QEMU_IO_PROG', 'q= emu-io')] >> if os.environ.get('QEMU_IO_OPTIONS'): >> qemu_io_args +=3D os.environ['QEMU_IO_OPTIONS'].strip().split(' '= ) >> =20 >> +qemu_nbd_args =3D [os.environ.get('QEMU_NBD_PROG', 'qemu-nbd')] >> +if os.environ.get('QEMU_NBD_OPTIONS'): >> + qemu_nbd_args +=3D os.environ['QEMU_NBD_OPTIONS'].strip().split('= ') >> + >> qemu_prog =3D os.environ.get('QEMU_PROG', 'qemu') >> qemu_opts =3D os.environ.get('QEMU_OPTIONS', '').strip().split(' ') >> =20 >> @@ -87,6 +91,10 @@ def qemu_io(*args): >> sys.stderr.write('qemu-io received signal %i: %s\n' % (-exitc= ode, ' '.join(args))) >> return subp.communicate()[0] >> =20 >> +def qemu_nbd(*args): >> + '''Run qemu-nbd in daemon mode and return the parent's exit code'= '' >> + return subprocess.call(qemu_nbd_args + ['--fork'] + list(args)) >=20 > Wouldn't it be better to always use -t, track the PID and shut it down > explicitly when the test exits? Probably. It's a lot more complicated, though. I'll see what I can do but I'm not sure if I can do a lot before 2.8. Max > The way you're using qemu-nbd here is fine if the test case passes, but= > if it fails before we access the NBD server, the server keeps running i= n > the background. >=20 > Kevin --LTk1es8MrBO9KQ65TuNJ4ktCT6DghxquQ Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQEvBAEBCAAZBQJYAmSfEhxtcmVpdHpAcmVkaGF0LmNvbQAKCRD0B9sAYdXPQHah B/98pPxzEPcL2soXigjtDNmq5MJior7btjqBNVKRwDfPw0A4GbGF1e+YFe9TwcaQ hOyiOsZJQIJajcKQ8U2vT5ahpMQ0kYx4rjKkyQ1JDaTlBje2JS3H2gksgD4nIgOO 51ymHTUfDez1uH63HwedZqaZnxXr5S+VYBXccj3rlXCstUp6R9MWlEPTGMhm6n6t Sbt+s5WBBN3yzKC5uskrWmTwhtfOsWNY81jOtI1w6TiWKElpBlBdiF8KEXhPVQbj bPjPOs+V1rECItm81Sdp0M19bYb0Gn0anQ3xxdEep3xMGT19BMIKuBQlV2y4kBFF gY6wfyBxInLue6JWx0D5m+/K =G0FT -----END PGP SIGNATURE----- --LTk1es8MrBO9KQ65TuNJ4ktCT6DghxquQ--