From patchwork Tue Oct 1 19:46:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Reitz X-Patchwork-Id: 11169651 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id ABDE016B1 for ; Tue, 1 Oct 2019 20:34:41 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8AA9320842 for ; Tue, 1 Oct 2019 20:34:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8AA9320842 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:47896 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iFOr1-0002WS-Fo for patchwork-qemu-devel@patchwork.kernel.org; Tue, 01 Oct 2019 16:34:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54429) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iFO83-0004qa-PM for qemu-devel@nongnu.org; Tue, 01 Oct 2019 15:48:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iFO81-00080o-Hz for qemu-devel@nongnu.org; Tue, 01 Oct 2019 15:48:11 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51836) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iFO7x-0007yO-GQ; Tue, 01 Oct 2019 15:48:05 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C2508A44AE1; Tue, 1 Oct 2019 19:48:04 +0000 (UTC) Received: from localhost (unknown [10.40.205.251]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5D72A60619; Tue, 1 Oct 2019 19:48:04 +0000 (UTC) From: Max Reitz To: qemu-block@nongnu.org Subject: [PATCH 20/67] iotests/055: Honor $IMGOPTS Date: Tue, 1 Oct 2019 21:46:28 +0200 Message-Id: <20191001194715.2796-21-mreitz@redhat.com> In-Reply-To: <20191001194715.2796-1-mreitz@redhat.com> References: <20191001194715.2796-1-mreitz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.68]); Tue, 01 Oct 2019 19:48:04 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , qemu-devel@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Max Reitz --- tests/qemu-iotests/055 | 41 +++++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/tests/qemu-iotests/055 b/tests/qemu-iotests/055 index c732a112d6..e44f18570d 100755 --- a/tests/qemu-iotests/055 +++ b/tests/qemu-iotests/055 @@ -23,7 +23,7 @@ import time import os import iotests -from iotests import qemu_img, qemu_io +from iotests import create_test_image, remove_test_image, qemu_io test_img = os.path.join(iotests.test_dir, 'test.img') target_img = os.path.join(iotests.test_dir, 'target.img') @@ -32,7 +32,7 @@ blockdev_target_img = os.path.join(iotests.test_dir, 'blockdev-target.img') image_len = 64 * 1024 * 1024 # MB def setUpModule(): - qemu_img('create', '-f', iotests.imgfmt, test_img, str(image_len)) + create_test_image(test_img, image_len) qemu_io('-f', iotests.imgfmt, '-c', 'write -P0x11 0 64k', test_img) qemu_io('-f', iotests.imgfmt, '-c', 'write -P0x00 64k 128k', test_img) qemu_io('-f', iotests.imgfmt, '-c', 'write -P0x22 162k 32k', test_img) @@ -41,12 +41,12 @@ def setUpModule(): qemu_io('-f', iotests.imgfmt, '-c', 'write -P0x33 67043328 64k', test_img) def tearDownModule(): - os.remove(test_img) + remove_test_image(test_img) class TestSingleDrive(iotests.QMPTestCase): def setUp(self): - qemu_img('create', '-f', iotests.imgfmt, blockdev_target_img, str(image_len)) + create_test_image(blockdev_target_img, image_len) self.vm = iotests.VM().add_drive('blkdebug::' + test_img) self.vm.add_drive(blockdev_target_img, interface="none") @@ -56,7 +56,7 @@ class TestSingleDrive(iotests.QMPTestCase): def tearDown(self): self.vm.shutdown() - os.remove(blockdev_target_img) + remove_test_image(blockdev_target_img) try: os.remove(target_img) except OSError: @@ -163,7 +163,7 @@ class TestSingleDrive(iotests.QMPTestCase): class TestSetSpeed(iotests.QMPTestCase): def setUp(self): - qemu_img('create', '-f', iotests.imgfmt, blockdev_target_img, str(image_len)) + create_test_image(blockdev_target_img, image_len) self.vm = iotests.VM().add_drive('blkdebug::' + test_img) self.vm.add_drive(blockdev_target_img, interface="none") @@ -171,7 +171,7 @@ class TestSetSpeed(iotests.QMPTestCase): def tearDown(self): self.vm.shutdown() - os.remove(blockdev_target_img) + remove_test_image(blockdev_target_img) try: os.remove(target_img) except OSError: @@ -249,7 +249,7 @@ class TestSetSpeed(iotests.QMPTestCase): # would stall. Instead, we limit the block job speed here. class TestSingleTransaction(iotests.QMPTestCase): def setUp(self): - qemu_img('create', '-f', iotests.imgfmt, blockdev_target_img, str(image_len)) + create_test_image(blockdev_target_img, image_len) self.vm = iotests.VM().add_drive(test_img) self.vm.add_drive(blockdev_target_img, interface="none") @@ -259,7 +259,7 @@ class TestSingleTransaction(iotests.QMPTestCase): def tearDown(self): self.vm.shutdown() - os.remove(blockdev_target_img) + remove_test_image(blockdev_target_img) try: os.remove(target_img) except OSError: @@ -452,29 +452,34 @@ class TestSingleTransaction(iotests.QMPTestCase): class TestDriveCompression(iotests.QMPTestCase): image_len = 64 * 1024 * 1024 # MB - fmt_supports_compression = [{'type': 'qcow2', 'args': ()}, - {'type': 'vmdk', 'args': ('-o', 'subformat=streamOptimized')}] + fmt_supports_compression = [{'type': 'qcow2', 'opts': []}, + {'type': 'vmdk', 'opts': ['subformat=streamOptimized']}] + + # Compression does not work with external data files + @iotests.skip_for_imgopts(['data_file']) + def setUp(self): + pass def tearDown(self): self.vm.shutdown() - os.remove(blockdev_target_img) + remove_test_image(blockdev_target_img) try: os.remove(target_img) except OSError: pass - def do_prepare_drives(self, fmt, args, attach_target): + def do_prepare_drives(self, fmt, opts, attach_target): self.vm = iotests.VM().add_drive('blkdebug::' + test_img) - qemu_img('create', '-f', fmt, blockdev_target_img, - str(TestDriveCompression.image_len), *args) + create_test_image(blockdev_target_img, TestDriveCompression.image_len, + fmt=fmt, opts=opts) if attach_target: self.vm.add_drive(blockdev_target_img, format=fmt, interface="none") self.vm.launch() def do_test_compress_complete(self, cmd, format, attach_target, **args): - self.do_prepare_drives(format['type'], format['args'], attach_target) + self.do_prepare_drives(format['type'], format['opts'], attach_target) self.assert_no_active_block_jobs() @@ -499,7 +504,7 @@ class TestDriveCompression(iotests.QMPTestCase): target='drive1') def do_test_compress_cancel(self, cmd, format, attach_target, **args): - self.do_prepare_drives(format['type'], format['args'], attach_target) + self.do_prepare_drives(format['type'], format['opts'], attach_target) self.assert_no_active_block_jobs() @@ -523,7 +528,7 @@ class TestDriveCompression(iotests.QMPTestCase): target='drive1') def do_test_compress_pause(self, cmd, format, attach_target, **args): - self.do_prepare_drives(format['type'], format['args'], attach_target) + self.do_prepare_drives(format['type'], format['opts'], attach_target) self.assert_no_active_block_jobs()