From patchwork Tue Nov 14 10:16:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Nefedov X-Patchwork-Id: 10057269 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 7538C601D3 for ; Tue, 14 Nov 2017 10:21:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 49D74292DF for ; Tue, 14 Nov 2017 10:21:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3E0CF292FF; Tue, 14 Nov 2017 10:21:10 +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 8D673292DF for ; Tue, 14 Nov 2017 10:21:09 +0000 (UTC) Received: from localhost ([::1]:58642 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eEYL6-0005Ap-VI for patchwork-qemu-devel@patchwork.kernel.org; Tue, 14 Nov 2017 05:21:09 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48355) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eEYHc-0003Gf-Uy for qemu-devel@nongnu.org; Tue, 14 Nov 2017 05:17:36 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eEYHY-0007K4-RO for qemu-devel@nongnu.org; Tue, 14 Nov 2017 05:17:32 -0500 Received: from mail-db5eur01on0131.outbound.protection.outlook.com ([104.47.2.131]:12736 helo=EUR01-DB5-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 1eEYHY-0007Iy-Fc; Tue, 14 Nov 2017 05:17:28 -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=dsjoX+QIRYJUsOn9neb6nYxV61ovzxBlv/ekheKUOjY=; b=Hs0+MVTJdXhXlzx4PnMbBoJhGaOwCTQggLkF5yPZvX6Zb9hJc8IuccJLimuWY3Df8/HlqaRUZFNlIRXy1gCGu/lvEOf0dT02c3rniwypquIlT9GL2gPRCxro+CE1KaPGy2Vdh4k2PJ0Yxg42ePzKG4vGteiGdHELIn4yW3ZOokU= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=anton.nefedov@virtuozzo.com; Received: from xantnef-ws.sw.ru (195.214.232.6) by HE1PR0801MB1993.eurprd08.prod.outlook.com (2603:10a6:3:4f::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.218.12; Tue, 14 Nov 2017 10:17:26 +0000 From: Anton Nefedov To: qemu-devel@nongnu.org Date: Tue, 14 Nov 2017 13:16:53 +0300 Message-Id: <1510654613-47868-6-git-send-email-anton.nefedov@virtuozzo.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1510654613-47868-1-git-send-email-anton.nefedov@virtuozzo.com> References: <1510654613-47868-1-git-send-email-anton.nefedov@virtuozzo.com> MIME-Version: 1.0 X-Originating-IP: [195.214.232.6] X-ClientProxiedBy: HE1PR0202CA0012.eurprd02.prod.outlook.com (2603:10a6:3:8c::22) To HE1PR0801MB1993.eurprd08.prod.outlook.com (2603:10a6:3:4f::23) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7531b6c2-9c4a-433e-37ce-08d52b48e79b X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(2017052603258); SRVR:HE1PR0801MB1993; X-Microsoft-Exchange-Diagnostics: 1; HE1PR0801MB1993; 3:e9GPF52YsVrMN3vLkM+EKWs2QepsHodyAuxecnDsWPEqQ/yA3ihtdsakmHVfHUXmRFv6tvpJO0oWJNJATdsswePf+bNSq7Yx1UItQ16dz6y1NzlzWb0i27nRrLzR5tC+NePNqBq+33+YVWzS+gTFx48eLAcpHXJr2QsnDcBxUMkELUw1IbfBe48WlqYtHpS7C79QYo4ilsrTsW9qXyM42AZpHxayEnC0FGtZDKGvi5U9bBSxNsJgtbMM+aRS+TZH; 25:7FFPDy2JhHAU1QJ+ytdfaL643UjpkS40IcWNwuv5MTntzEYK8arpXVbvfbLTw3FiQN7MdQIqGDZoGzG1/IBOjFm8NkjXAgkdgHuynCyM0heuIOWF3aBcl6jWTn3VdwnErtkF54D9ocWH8UNgAeJbFVowUlvny5jkxrEiupRUxBmgT2O6iNn0KErtbzF+ROyY83F50F42NRPVNpjZzZHgFciE+4nkpdYA8+RfmU5p0Nc5cbL7AKJF0tQM7mMXct4anys/NOeK21WbWiTZOpomRAgXLqjhvpbdZxwItEPsttNXNgCaVEmRJRr5+m38hF2n6lA21ka3qzknOnjDUUeThE06tkYEyaYK69+0QvJ0QKE=; 31:H5s9M8lvKhxX2uOV+mvLzCLIFu0PqkUP9LZKM1TL/hUeyJ4yUWuvw9LjxxjBv8GojW6vxJDa6nKulcFnWy/T+a2hub4/az+gydt14TE6NtEEXGGxyZVZFNvy72wESVKDjdit42sGuad7Iapan5+itUSYbaFkGsnobwmGBz5Ki6KzVIaTHeyJB4WYs+wfQyKlWyt5C6RKnb5iy/skXFVJiABPvkCN28360LP3h2VA1M8= X-MS-TrafficTypeDiagnostic: HE1PR0801MB1993: X-Microsoft-Exchange-Diagnostics: 1; HE1PR0801MB1993; 20:nsSMJ5P4kc+rUHO8f9DyhgEo62IB3J3rOwjr2HM0J/PY8U5U4jZt4AECkdkc9LW5lVOgT/A55n8T8duXScX1Ub+jdmakHURYk02Yks6w+rz7S5r3aAerkp8nhVBzK+qijteu3sjbZqrEAJvX0B98xTkdx8C6543D9bCdAABQrx8wCwRESzbnigeeclVIRfz5870f65W5q9LS3kj1YpUzmVBVaGp14BIJBJGqKcMC/xySCEGEooTzLPNzcL7zKDLF8FMIyNeznYGV23Bmeuw5yz7YESVxdPnlDFe8nWeYrXkCrdXV1FU7tpCFDj5t3Pf4N+OzZMOLMvzwZvPrOOsH9HU6x6YVm2SUz/xxXkJorNBw0yZ1hyfrGK9e7tbzOkfTzjE8NKrgItBRFIsBfrRCmuw5Sd6rHodbnuKCVayejKo=; 4:z8kCu0kzkAAlcYIzrVupXIo1K6ncCo/OCT0GXkIUli64J9xrwc0gDJ0Svbg84sFkvywKTiSKvEoag+Oz+HeQwrQgsbVAM2/FKfVVHnfdx1I1BnBs5/Lc/ByCBYW0jXjJIEmFND2tPpX+6EsPv9IMy9QkhFgu+lHdZgxm008ep3brhQDEup/W/yhSwCtPMviI7jz5+/3OSP9BxLVCz+8FKMNiGzvBFFZ5gGrrVLfKAa55KeAmABrWLsB7KV4Eny5RZvv7ZB9f9K44faoAKmflgw== 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)(5005006)(8121501046)(3231022)(3002001)(10201501046)(100000703101)(100105400095)(93006095)(93001095)(6041248)(20161123562025)(20161123558100)(20161123564025)(20161123560025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123555025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:HE1PR0801MB1993; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:HE1PR0801MB1993; X-Forefront-PRVS: 04916EA04C X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(6009001)(376002)(346002)(39830400002)(189002)(199003)(97736004)(5003940100001)(6916009)(3846002)(2361001)(5660300001)(69596002)(6116002)(8936002)(8676002)(81156014)(2950100002)(48376002)(33646002)(81166006)(2351001)(25786009)(6666003)(189998001)(50226002)(47776003)(6506006)(16526018)(106356001)(107886003)(105586002)(68736007)(478600001)(305945005)(36756003)(76176999)(50986999)(101416001)(316002)(16586007)(50466002)(4326008)(6512007)(2906002)(6486002)(53416004)(66066001)(53936002)(7736002)(86362001); DIR:OUT; SFP:1102; SCL:1; SRVR:HE1PR0801MB1993; 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; HE1PR0801MB1993; 23:+5puWYCmYV4JjQPvAfwJaq2ChvypnQgh+vrNxeh?= =?us-ascii?Q?bX9/gRSQvc+EPI1U6dTo65DUoyZlCLwSJWLi/K9XePe2YaRlMTN6EuTbuF+W?= =?us-ascii?Q?BueTQVrQFx2kbM8C5J0tX+e6oTfVVlOvvR/xEz4zw+nT/4+cbSfqFEak1ZAH?= =?us-ascii?Q?mBY4ytBQxSUnUBl6SZ6R1QpkKtK3WqPQaH9Ye+xQL36DZpeS+/B+lpKo8eQ3?= =?us-ascii?Q?C91GEwEVxRrvTehzpRNDtFge5sCkuquK/XJYuO8JnxXL7Gzxc+b5Ws4/c/Z8?= =?us-ascii?Q?TTCKJbGZk1gnfwRGCL78FnLWwJcq1BytWZqSODyosrW1TtK7vWid9lVM/HwN?= =?us-ascii?Q?NgRaaJ5SoExz/fOh0MMDZ+dYlXcHnsa2rWzl6pk6gZ9tMPTB3tRCaU97tjN1?= =?us-ascii?Q?zOl2BwT404tZGSDWKTYy4a/FsDxpw8Tp9RrvMYKrzXgaS9hWy+rV7o9XHQrf?= =?us-ascii?Q?cT4/Wrhbnz/KXrfj61Ngy9mf+NV3jACQ2rs5AzcxH/V9A6jrheICsz39mM4h?= =?us-ascii?Q?+uB4MAdkD65jkDuCqqWxB+3bx9PzWiLoW3nYjxNiZaWZRwCyMb6b4kMj88nA?= =?us-ascii?Q?4PbouIXwwj+9cJNueQ5jajAclwvmeFiScckcz8r/xOnzSH0+rchoSCaIvQph?= =?us-ascii?Q?bp1DZ8LolQWEpA9T1/cUw9Zrn8hE0g7Xy88CBhwsDPehZchzUHj4mqJx/mgh?= =?us-ascii?Q?RNtZBGa17TKLeh+n3hIUraEG23pnYvFIEP9DvHg6n7519PRJQtz7xREWFPEx?= =?us-ascii?Q?1Nh+PBAzl1Ntt0as+x3U1dtenqa+FMjt5aAZSBkH+LPgXRxVygmJS6dMSFi8?= =?us-ascii?Q?botE9aetVwkTZBZrPsI2sDW9VL0ymThreG0U5sUXX0q4/eL/l6XFtDAGXGcG?= =?us-ascii?Q?hKg1ByWFhMB45g+UKYPEW4HBNKrrLWYLNjXbl6R35QD47fMhec/hcxkySTFP?= =?us-ascii?Q?akX8HEESzPtHx7Kz1Kjdh90tSqY6AzzlkQCMQy/FSP81GhTSjFQyYcAD2uVY?= =?us-ascii?Q?xrJ5UJLKWEOjUKGfjDj29HV2uY1AIj8zi1jZRpGYqNRX/eJysBIp8O2uL8eG?= =?us-ascii?Q?9T+b9JMprwNUiXgB3so+I8n0x0q+ABuERQk970sdcO7UhAftSJQm2YvE9FYI?= =?us-ascii?Q?xiYlzfGxoqTrvTcBI+sDslQh2aKbmtBeITR/VBt20UhXesDk6EBZDRCk36hT?= =?us-ascii?Q?nof3CNe5McSzI8cQ=3D?= X-Microsoft-Exchange-Diagnostics: 1; HE1PR0801MB1993; 6:wLmHVzr9mJza75AvYzvkPX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QTz+urw2fAhacbEY5N38SSqC0K1PJZiGGv57vtaod/h2JeFnMyGQBQfLDlQWhfC5s= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Nov 2017 10:17:26.0360 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7531b6c2-9c4a-433e-37ce-08d52b48e79b X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0801MB1993 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 104.47.2.131 Subject: [Qemu-devel] [PATCH 5/5] iotest 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 | 69 +++++++++++++++++++++++++++++++++++++++++++++- tests/qemu-iotests/030.out | 4 +-- 2 files changed, 70 insertions(+), 3 deletions(-) diff --git a/tests/qemu-iotests/030 b/tests/qemu-iotests/030 index 1883894..52cbe5d 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') @@ -800,5 +800,72 @@ class TestSetSpeed(iotests.QMPTestCase): self.cancel_and_wait() +class TestCompressed(iotests.QMPTestCase): + supported_fmts = ['qcow2'] + cluster_size = 64 * 1024; + image_len = 1 * 1024 * 1024; + + def setUp(self): + qemu_img('create', backing_img, str(TestCompressed.image_len)) + qemu_io('-f', 'raw', '-c', 'write -P 1 0 ' + str(TestCompressed.image_len), backing_img) + qemu_img('create', '-f', iotests.imgfmt, '-o', 'backing_file=%s' % backing_img, test_img) + + # write '4' in every 4th cluster + step=4 + for i in range(TestCompressed.image_len / TestCompressed.cluster_size / step + 1): + qemu_io('-c', 'write -P %d %d %d' % + (step, step * i * TestCompressed.cluster_size, + 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 _pattern(self, x, divs): + return divs[-1] if not x%divs[-1] else self._pattern(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 '2' in every 2nd cluster + step = 2 + for i in range(TestCompressed.image_len / TestCompressed.cluster_size / step + 1): + result = self.vm.qmp('human-monitor-command', + command_line= + 'qemu-io drive0 \"write -P %d %d %d\"' % + (step, step * i * TestCompressed.cluster_size, + 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._pattern(i, [1,4,2]), + 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