From patchwork Mon Feb 29 23:19:30 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Reitz X-Patchwork-Id: 8460231 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id A7E049F52D for ; Mon, 29 Feb 2016 23:22:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1880420204 for ; Mon, 29 Feb 2016 23:22:13 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E822620160 for ; Mon, 29 Feb 2016 23:22:11 +0000 (UTC) Received: from localhost ([::1]:39645 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aaX8l-0005Gh-8X for patchwork-qemu-devel@patchwork.kernel.org; Mon, 29 Feb 2016 18:22:11 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44859) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aaX6t-0002Fv-K5 for qemu-devel@nongnu.org; Mon, 29 Feb 2016 18:20:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aaX6s-0006NB-Lh for qemu-devel@nongnu.org; Mon, 29 Feb 2016 18:20:15 -0500 Received: from mx1.redhat.com ([209.132.183.28]:58611) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aaX6j-0006H8-CP; Mon, 29 Feb 2016 18:20:09 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id 173543B758; Mon, 29 Feb 2016 23:20:05 +0000 (UTC) Received: from localhost (ovpn-116-81.ams2.redhat.com [10.36.116.81]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u1TNK351010480 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 29 Feb 2016 18:20:04 -0500 From: Max Reitz To: qemu-block@nongnu.org Date: Tue, 1 Mar 2016 00:19:30 +0100 Message-Id: <1456787973-19348-14-git-send-email-mreitz@redhat.com> In-Reply-To: <1456787973-19348-1-git-send-email-mreitz@redhat.com> References: <1456787973-19348-1-git-send-email-mreitz@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Kevin Wolf , Markus Armbruster , qemu-devel@nongnu.org, Max Reitz , Paolo Bonzini , Luiz Capitulino Subject: [Qemu-devel] [PATCH v2 13/16] iotests.py: Add qemu_nbd function X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 0a238ec..dd8805a 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'] # This will not work if arguments contain spaces but is necessary if we @@ -41,6 +41,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(' ') @@ -86,6 +90,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,