From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36382) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ansCe-0007jU-U6 for qemu-devel@nongnu.org; Wed, 06 Apr 2016 14:29:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ansCd-0006yo-SG for qemu-devel@nongnu.org; Wed, 06 Apr 2016 14:29:20 -0400 From: Max Reitz Date: Wed, 6 Apr 2016 20:28:47 +0200 Message-Id: <1459967330-4573-12-git-send-email-mreitz@redhat.com> In-Reply-To: <1459967330-4573-1-git-send-email-mreitz@redhat.com> References: <1459967330-4573-1-git-send-email-mreitz@redhat.com> Subject: [Qemu-devel] [PATCH v3 11/14] iotests.py: Add qemu_nbd function List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-block@nongnu.org Cc: Kevin Wolf , Markus Armbruster , qemu-devel@nongnu.org, Max Reitz , Paolo Bonzini , Luiz Capitulino Signed-off-by: Max Reitz --- tests/qemu-iotests/iotests.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index 8499e1b..b3c00dd 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -28,7 +28,7 @@ import qmp import qtest import struct -__all__ = ['imgfmt', 'imgproto', 'test_dir' 'qemu_img', 'qemu_io', +__all__ = ['imgfmt', 'imgproto', 'test_dir' 'qemu_img', 'qemu_io', 'qemu_nbd', 'VM', 'QMPTestCase', 'notrun', 'main', 'verify_image_format', 'verify_platform', 'filter_test_dir', 'filter_win32', 'filter_qemu_io', 'filter_chown', 'log'] @@ -43,6 +43,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_args = [os.environ.get('QEMU_PROG', 'qemu')] if os.environ.get('QEMU_OPTIONS'): qemu_args += os.environ['QEMU_OPTIONS'].strip().split(' ') @@ -91,6 +95,11 @@ 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 the background''' + subp = subprocess.Popen(qemu_nbd_args + list(args)) + return subp + def compare_images(img1, img2): '''Return True if two image files are identical''' return qemu_img('compare', '-f', imgfmt, -- 2.8.0