From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41012) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bufnB-0005bi-Lc for qemu-devel@nongnu.org; Thu, 13 Oct 2016 09:11:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bufnA-0001A3-Nd for qemu-devel@nongnu.org; Thu, 13 Oct 2016 09:11:25 -0400 Date: Thu, 13 Oct 2016 15:11:15 +0200 From: Kevin Wolf Message-ID: <20161013131115.GJ5803@noname.redhat.com> References: <20160928205602.17275-1-mreitz@redhat.com> <20160928205602.17275-10-mreitz@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160928205602.17275-10-mreitz@redhat.com> 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: Max Reitz Cc: qemu-block@nongnu.org, qemu-devel@nongnu.org, Eric Blake , Paolo Bonzini , Markus Armbruster 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/iotests.py > index 3329bc1..5a2678f 100644 > --- a/tests/qemu-iotests/iotests.py > +++ b/tests/qemu-iotests/iotests.py > @@ -39,6 +39,10 @@ qemu_io_args = [os.environ.get('QEMU_IO_PROG', 'qemu-io')] > if os.environ.get('QEMU_IO_OPTIONS'): > qemu_io_args += os.environ['QEMU_IO_OPTIONS'].strip().split(' ') > > +qemu_nbd_args = [os.environ.get('QEMU_NBD_PROG', 'qemu-nbd')] > +if os.environ.get('QEMU_NBD_OPTIONS'): > + qemu_nbd_args += os.environ['QEMU_NBD_OPTIONS'].strip().split(' ') > + > qemu_prog = os.environ.get('QEMU_PROG', 'qemu') > qemu_opts = os.environ.get('QEMU_OPTIONS', '').strip().split(' ') > > @@ -87,6 +91,10 @@ def qemu_io(*args): > sys.stderr.write('qemu-io received signal %i: %s\n' % (-exitcode, ' '.join(args))) > return subp.communicate()[0] > > +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)) Wouldn't it be better to always use -t, track the PID and shut it down explicitly when the test exits? 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 in the background. Kevin