From patchwork Thu Nov 16 16:54:58 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Nefedov X-Patchwork-Id: 10061515 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id EE977604D4 for ; Thu, 16 Nov 2017 16:56:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DFF152A5BE for ; Thu, 16 Nov 2017 16:56:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D4E092AB55; Thu, 16 Nov 2017 16:56:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 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.wl.linuxfoundation.org (Postfix) with ESMTPS id 533092AB1A for ; Thu, 16 Nov 2017 16:56:38 +0000 (UTC) Received: from localhost ([::1]:41812 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eFNSv-0001S3-IK for patchwork-qemu-devel@patchwork.kernel.org; Thu, 16 Nov 2017 11:56:37 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40192) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eFNRm-0001R8-LT for qemu-devel@nongnu.org; Thu, 16 Nov 2017 11:55:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eFNRl-0007T2-0j for qemu-devel@nongnu.org; Thu, 16 Nov 2017 11:55:26 -0500 Received: from mail-he1eur01on0120.outbound.protection.outlook.com ([104.47.0.120]:43088 helo=EUR01-HE1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eFNRk-0007Fo-AZ; Thu, 16 Nov 2017 11:55:24 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=hZ2e/Ju36tzG4lGnDLPLOYJXcF1Vwxy+b0DGPV1DO0U=; b=hvBaVt1rygH/QUuUqzJO2Z2AtCGcxiro8bgoIMuwn6My2kqSaRo0Tl6kbnlDTMXxiLabJwbmUFE/bsVxcVm9vSzIw4hM9VXJF61U+lWdjn5ornv3gMhHvguxqxw8zCrC87tTnpXSwju3zRT8YVi+qy/Q+bTs9Z6ClsRqzzfVySA= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=anton.nefedov@virtuozzo.com; Received: from xantnef-ws.sw.ru (195.214.232.6) by DB6PR0801MB1992.eurprd08.prod.outlook.com (2603:10a6:4:76::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.239.5; Thu, 16 Nov 2017 16:55:20 +0000 From: Anton Nefedov To: qemu-devel@nongnu.org Date: Thu, 16 Nov 2017 19:54:58 +0300 Message-Id: <1510851298-59922-5-git-send-email-anton.nefedov@virtuozzo.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1510851298-59922-1-git-send-email-anton.nefedov@virtuozzo.com> References: <1510851298-59922-1-git-send-email-anton.nefedov@virtuozzo.com> MIME-Version: 1.0 X-Originating-IP: [195.214.232.6] X-ClientProxiedBy: DB3PR0202CA0008.eurprd02.prod.outlook.com (2603:10a6:8:1::21) To DB6PR0801MB1992.eurprd08.prod.outlook.com (2603:10a6:4:76::9) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a327a508-4dee-4556-77a4-08d52d12d2c6 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(4534020)(4602075)(7168017)(4627115)(201703031133081)(201702281549075)(2017052603258); SRVR:DB6PR0801MB1992; X-Microsoft-Exchange-Diagnostics: 1; DB6PR0801MB1992; 3:a3BJNYcDhHHKJAF0UV1Y2Asfyqqv6pGi4JsY38OURIVwb7i/oqg/3pFoUVW2ZQYoBv9alomkk8yhLz07HKx05V5VvkrNjJ1GZcTUNTIfqjmfSRD3CWdEXL/Zsjl9Ej/ZVglbF6+rhZ7QCdaDMz7ZkzVxRv6hW6e7Ko6ziA7hwbGM4JavlOPGJBlktj5KRPwQ4IrVsaYPuJBQABIosTmXf8nP7kTNrHmIDE1X6d0iY8+M3eC5eXhXd2EDzSMFN3Dc; 25:bbMZymfEeH0KTX9YMbqyMEvfwvgtwcc92eKxzZJ0QEveOiBgsb3Wwl0Yp68NyVCR7C1pfJNU9lN5/MZVtqVoI9ndE81lQpLkfm9in23UT8yO9M+zj6JQCYBVvhBjtXbUwXvRmMjhDrWU/uNcKZ3LXt2Yf25OmgaHDlqzrjAXKeYHwk6QfddIi5CPERUbIzxShb/iZriR3HoyJNqLeMfQb3RDAbp5cqRA442/tgtptrEeQxGBIfnZ/kiLwDW8hHHirNBAZNCdG+zG+yda8Zyynd0wsr386YlJ90aArqDSbqV+0s+n8YXOM/lw0C3efa/7U6sVI0WxVidCN3o79WQEbA==; 31:ACgd010T2W9UHKoX+wyNYI1lPlsQwHFrHsilQ+uo3BZXHfoMJ4hX4qjWsHtiRTfPc702ccw7XAvg9bo7OejEmevOsbnYlZeue85WiHiOddA8BAktl1KwT8b70P0mjO5o6L33Y2ERfLxAtjXZ5WEo+kfTm0ueu893f0zrMdux3jqmHFE68lldjcJqlSPaWG0K4Lr6n5FbgzdfWeG93szjSawhDNLnjQZDLE3FBY5K2xE= X-MS-TrafficTypeDiagnostic: DB6PR0801MB1992: X-Microsoft-Exchange-Diagnostics: 1; DB6PR0801MB1992; 20:GfDrJ889KPk3ms3HJt23XcK6RGi4HGvgYRqftPq4wIrxyazD9vx3YOCiH3x8INuQaB419fiYrDx6XFEvpzqdU9AdKEfKTfxLVjlusF2U6WrrozNOyHGg5/iuvDn5hL4KehAYlUR/3kVdSD4Mi8XdBXSaLPQNxFztr9ZWPJiXD31vefF3iDyWEfXCAdZtqbKllC4b4JSxE5yzhIN+fuiWXF7UGptCdQJAB1D96uAVny18e9CQ6DbUWQS5o/n34LTLIIGskgGcYtdiFVGGiRZSY/3nmcV/8lR6eGCtx3vHp1iEs+U7H0lPkAkoCqKj5vEbNF+rL8+a8ikhTWT5QDsHbhoavnhOlyZ1i2zHC2Ypv5vjNYY72/IKUbqfugZ9R7LZHJSQaW3M5XMgA6gdGBK5pxJusZXQnz+pxhk1S4FCqY8=; 4:mHf0WuYT0GE/jqUogcJR6fL7/Xggl1QNCnMfsHbyfrUWgWz6Ipm28Xf5GRh3v2yR7AmmbGsFxeEZv+lKY1XXVgN4PsZVC9nTMfwtIwtypjfqjpw72lPo7JDh8Q37/woBpTVLv6YZgByKwLpmoA+P/YS8yhPJpUp6SBy4xcutWBViih5XTZeNvq6fvagW4Eacf1rUaFRgUJkauGbmGytKo/4j3KjGZCZ0ljFNIcxR6H8xwY2mp1BISYGdTB1mUFhd3AtIW7z6BuHf5bd8kmcNrg== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(8121501046)(5005006)(3002001)(10201501046)(3231022)(100000703101)(100105400095)(93006095)(93001095)(6041248)(20161123562025)(20161123560025)(20161123564025)(20161123555025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123558100)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:DB6PR0801MB1992; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:DB6PR0801MB1992; X-Forefront-PRVS: 0493852DA9 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(6009001)(376002)(346002)(189002)(199003)(189998001)(69596002)(97736004)(2950100002)(6916009)(6666003)(47776003)(50466002)(66066001)(3846002)(48376002)(5660300001)(316002)(6116002)(16586007)(86362001)(5003940100001)(16526018)(33646002)(6512007)(478600001)(2361001)(106356001)(53936002)(105586002)(2351001)(36756003)(7736002)(76176999)(50986999)(107886003)(305945005)(50226002)(68736007)(53416004)(8676002)(81156014)(81166006)(25786009)(4326008)(8936002)(6506006)(101416001)(6486002)(2906002); DIR:OUT; SFP:1102; SCL:1; SRVR:DB6PR0801MB1992; H:xantnef-ws.sw.ru; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: virtuozzo.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DB6PR0801MB1992; 23:qd/VEpZNQmnIg/cx0C9FhQ61zuCHXXk7HO0Ig8K?= =?us-ascii?Q?DUZMDIl3OmWW80MazfZR3FQFdhldNAy70RqW5y2k5hgNJZAH/DAliTsFW5n3?= =?us-ascii?Q?eD4RcV22sViBcl1f135QWqh/obb+JiHgifZw7OSsJmC9EYHnNrM98u1ph0rM?= =?us-ascii?Q?hPG0B/S2vw8DKGlgv36bUM7C8EG6ewTmvnaRFQXCubMLTy5igOfaENV8Fsrd?= =?us-ascii?Q?B03KK20HGNege7VH9JjNPQtgkvrF21KuzsXTDVWYF855B/EaDflpJ7qBHXbo?= =?us-ascii?Q?KfeQaxS4nScbu25btn1ignr/JUzqVDnIbxnmU/tF9aD8KuQFyNYkAUQK7r0Y?= =?us-ascii?Q?SFeBAfTAtpqpBSXgQjrrO1P2r9ekBNd11zgA9cqwYblXFFoROeFuODWpmz5+?= =?us-ascii?Q?3sNvjOezSWFtw3H+HMM73uH+4sRvgcYWOmaNIL36MraLk3c8BDPiqUAhym+L?= =?us-ascii?Q?2ZQylZUAHkyALkFSVPqn9yEgmzb9/+AzB4W5tcwG4B731bxXNoi9HlxR0z9c?= =?us-ascii?Q?W/ABANFXS9UruUAdmVsQpjiTCEnaagFWOTB6PET5R1PoW0F552PJD3N97tZg?= =?us-ascii?Q?d+3iXNOXwrazRmvp2HvB57L4EUT17bD4raSRbm2MXQkLT7t//5H6kh/2qZEl?= =?us-ascii?Q?TkAv+oDmP57t2NVz5oCFlle/vryR7jO89ULTlEXlerJxO0Gfs5heedg8Iz7f?= =?us-ascii?Q?pFk6tN6F4dRK/Fv+ahzXpbVIO37u1Mwhw/IRpjTQyAYgM3K7ztr1reFATVoY?= =?us-ascii?Q?A/4UHF7q6xFDyGqjZXTaPA2IRGYY/fhH6pG/+Xi8FDuEtPGLLbbZ/ucPtHF7?= =?us-ascii?Q?TWKCW0Tyz5F7IrE2DzMHJUK2AaRGmfQWkBK+ld4EWIrkUHCJtDz3BR2ZFqtf?= =?us-ascii?Q?p0lKgWRX+utNbKMlDE9dnwAPxwP/kpGIQbXYayZf+zCtmy7srclPQpi4cQTA?= =?us-ascii?Q?PI1Xi3Y961jE0UlonfWtekCaDdkWX6hexp51Qozxiv8zp4FJsZZStK7UAhSY?= =?us-ascii?Q?3o2maXgNaP/lIbR4IRgJGNy1LlNQIqjHPynx6mCYQnTh8kR4oqLytj0imBbq?= =?us-ascii?Q?SElVMvnIFiNpO96Yq9901kzXM55WUQXNXKWvkIqMIJ7Q0+Xm+YRUCKr/p4pt?= =?us-ascii?Q?6C4ggQxkMObUR7Zv3lppwFJyNDkV/UUecIs0U0h4HUdDOdBqVTXlkAw=3D?= =?us-ascii?Q?=3D?= X-Microsoft-Exchange-Diagnostics: 1; DB6PR0801MB1992; 6:KSyQg7WJNkEUgzfp8WonDIO8KyQq1Vy98h4uMGuXy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gZXw8TTo3sQvyvf573hEDOkO9JEJPa61n89XEy3O79/TJd0ETo= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Nov 2017 16:55:20.4176 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a327a508-4dee-4556-77a4-08d52d12d2c6 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0801MB1992 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 104.47.0.120 Subject: [Qemu-devel] [PATCH v2 4/4] iotests: 030: add compressed block-stream test X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, Anton Nefedov , famz@redhat.com, den@virtuozzo.com, qemu-block@nongnu.org, mreitz@redhat.com, stefanha@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Anton Nefedov --- tests/qemu-iotests/030 | 66 +++++++++++++++++++++++++++++++++++++++++++++- tests/qemu-iotests/030.out | 4 +-- 2 files changed, 67 insertions(+), 3 deletions(-) diff --git a/tests/qemu-iotests/030 b/tests/qemu-iotests/030 index 457984b..831d6f3 100755 --- a/tests/qemu-iotests/030 +++ b/tests/qemu-iotests/030 @@ -21,7 +21,7 @@ import time import os import iotests -from iotests import qemu_img, qemu_io +from iotests import qemu_img, qemu_img_pipe, qemu_io backing_img = os.path.join(iotests.test_dir, 'backing.img') mid_img = os.path.join(iotests.test_dir, 'mid.img') @@ -804,5 +804,69 @@ class TestSetSpeed(iotests.QMPTestCase): self.cancel_and_wait(resume=True) +class TestCompressed(iotests.QMPTestCase): + supported_fmts = ['qcow2'] + cluster_size = 64 * 1024; + image_len = 1 * 1024 * 1024; + + def setUp(self): + qemu_img('create', '-f', iotests.imgfmt, '-o', 'cluster_size=%d' % TestCompressed.cluster_size, backing_img, str(TestCompressed.image_len)) + qemu_io('-c', 'write -P 1 0 ' + str(TestCompressed.image_len), backing_img) + qemu_img('create', '-f', iotests.imgfmt, '-o', 'backing_file=%s,cluster_size=%d' % (backing_img, TestCompressed.cluster_size), test_img) + + # write '3' in every 3rd cluster + step = 3 + for off in range(0, TestCompressed.image_len, TestCompressed.cluster_size * step): + qemu_io('-c', 'write -P %d %d %d' % + (step, off, TestCompressed.cluster_size), test_img) + + self.vm = iotests.VM().add_drive(test_img) + self.vm.launch() + + def tearDown(self): + os.remove(test_img) + os.remove(backing_img) + + def _first_divider(self, x, divs): + return divs[0] if not x%divs[0] else self._first_divider(x, divs[1:]) + + def test_compressed(self): + self.assert_no_active_block_jobs() + + result = self.vm.qmp('block-stream', device='drive0', compress=True) + if iotests.imgfmt not in TestCompressed.supported_fmts: + self.assert_qmp( + result, 'error/desc', + 'Compression is not supported for this drive drive0') + return + self.assert_qmp(result, 'return', {}) + + # write '4' in every 4th cluster + step = 4 + for off in range(0, TestCompressed.image_len, TestCompressed.cluster_size * step): + result = self.vm.qmp('human-monitor-command', + command_line= + 'qemu-io drive0 "write -P %d %d %d"' % + (step, off, TestCompressed.cluster_size)) + self.assert_qmp(result, 'return', "") + + self.wait_until_completed() + self.assert_no_active_block_jobs() + + self.vm.shutdown() + + for i in range(TestCompressed.image_len / TestCompressed.cluster_size): + outp = qemu_io('-c', 'read -P %d %d %d' % + (self._first_divider(i, [4, 3, 1]), + i * TestCompressed.cluster_size, + TestCompressed.cluster_size), + test_img) + self.assertTrue(not 'fail' in outp) + self.assertTrue('read' in outp and 'at offset' in outp) + + self.assertTrue( + "File contains external, encrypted or compressed clusters." + in qemu_img_pipe('map', test_img)) + if __name__ == '__main__': iotests.main(supported_fmts=['qcow2', 'qed']) diff --git a/tests/qemu-iotests/030.out b/tests/qemu-iotests/030.out index 391c857..42314e9 100644 --- a/tests/qemu-iotests/030.out +++ b/tests/qemu-iotests/030.out @@ -1,5 +1,5 @@ -....................... +........................ ---------------------------------------------------------------------- -Ran 23 tests +Ran 24 tests OK