From nobody Wed Nov 12 16:47:59 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1571603943; cv=none; d=zoho.com; s=zohoarc; b=FGR1EkXEPE4OoMoRr51r+E4BWkJKGvKR3VdrIdZxbaiQpVwKK2E4rDKnj6aiWp81GybIyvIp0nAlMMB+vTDr2e0IDQOs6QL4Q3iM5mUj3QFCHmNjEGkIzZeGqXwKtFPDZ/H/XZOTqneBJ0BljDTqHYmAzyuw2lE1GJOeQD10F30= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571603943; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=+y/NT7jCMcCJ5hHIkmj8f17h3fNoAyHczdUoyMlhL0w=; b=WrDU9HgrfeGH+EDLy0lh78Dqf1w28JvnFFLcmzipQRETRTfQXVrIJmgALiLYiczlHyrvCqiCDuLADB96WBQd0sNTtWR3U/6Z7pBoHoZUzKjdVWwseFliQNFgWhFnwItQ2UuOKhoIN+RHBsAUoQqcugaS8KGErzsPD7qT5D6Lfck= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1571603943643779.3725598086174; Sun, 20 Oct 2019 13:39:03 -0700 (PDT) Received: from localhost ([::1]:47090 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iMHyg-0007DH-AA for importer@patchew.org; Sun, 20 Oct 2019 16:39:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51654) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iMHx7-0005vO-5N for qemu-devel@nongnu.org; Sun, 20 Oct 2019 16:37:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iMHx5-0006Xf-J6 for qemu-devel@nongnu.org; Sun, 20 Oct 2019 16:37:24 -0400 Received: from relay.sw.ru ([185.231.240.75]:58844) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iMHx5-0006Wu-Bn; Sun, 20 Oct 2019 16:37:23 -0400 Received: from [172.16.25.136] (helo=dhcp-172-16-25-136.sw.ru) by relay.sw.ru with esmtp (Exim 4.92.2) (envelope-from ) id 1iMHx1-00089m-Py; Sun, 20 Oct 2019 23:37:19 +0300 From: Andrey Shinkevich To: qemu-devel@nongnu.org, qemu-block@nongnu.org Subject: [PATCH v5 4/4] tests/qemu-iotests: add case for block-stream compress Date: Sun, 20 Oct 2019 23:37:08 +0300 Message-Id: <1571603828-185910-5-git-send-email-andrey.shinkevich@virtuozzo.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1571603828-185910-1-git-send-email-andrey.shinkevich@virtuozzo.com> References: <1571603828-185910-1-git-send-email-andrey.shinkevich@virtuozzo.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 185.231.240.75 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: kwolf@redhat.com, fam@euphon.net, vsementsov@virtuozzo.com, armbru@redhat.com, mreitz@redhat.com, stefanha@redhat.com, andrey.shinkevich@virtuozzo.com, den@openvz.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Add a case to the iotest #030 that tests the 'compress' option for a block-stream job. Signed-off-by: Andrey Shinkevich --- tests/qemu-iotests/030 | 34 +++++++++++++++++++++++++++++++++- tests/qemu-iotests/030.out | 4 ++-- 2 files changed, 35 insertions(+), 3 deletions(-) diff --git a/tests/qemu-iotests/030 b/tests/qemu-iotests/030 index f3766f2..f33fd21 100755 --- a/tests/qemu-iotests/030 +++ b/tests/qemu-iotests/030 @@ -21,7 +21,8 @@ import time import os import iotests -from iotests import qemu_img, qemu_io +from iotests import qemu_img, qemu_io, qemu_img_pipe +import json =20 backing_img =3D os.path.join(iotests.test_dir, 'backing.img') mid_img =3D os.path.join(iotests.test_dir, 'mid.img') @@ -956,6 +957,37 @@ class TestSetSpeed(iotests.QMPTestCase): =20 self.cancel_and_wait(resume=3DTrue) =20 +class TestCompressed(iotests.QMPTestCase): + allocated_clusters =3D 8 + + def setUp(self): + qemu_img('create', '-f', iotests.imgfmt, backing_img, '1M') + qemu_img('create', '-f', iotests.imgfmt, '-o', + 'backing_file=3D{}'.format(backing_img), test_img) + cluster_size =3D 0x10000 + data_size =3D self.allocated_clusters * cluster_size + qemu_io('-c', 'write -P 0x1 0 {}'.format(data_size), backing_img) + self.vm =3D iotests.VM().add_drive(test_img, "compress=3Don") + self.vm.launch() + + def tearDown(self): + self.vm.shutdown() + os.remove(test_img) + os.remove(backing_img) + + def test_stream_compress(self): + self.assert_no_active_block_jobs() + + result =3D self.vm.qmp('block-stream', device=3D'drive0') + self.assert_qmp(result, 'return', {}) + + match =3D {'data': {'type': 'stream', 'device': 'drive0'}} + self.vm.event_wait(name=3D'BLOCK_JOB_COMPLETED', match=3Dmatch) + self.vm.shutdown() + + top =3D json.loads(qemu_img_pipe('check', '--output=3Djson', test_= img)) + self.assertEqual(top['compressed-clusters'], self.allocated_cluste= rs) + if __name__ =3D=3D '__main__': iotests.main(supported_fmts=3D['qcow2', 'qed'], supported_protocols=3D['file']) diff --git a/tests/qemu-iotests/030.out b/tests/qemu-iotests/030.out index 6d9bee1..af8dac1 100644 --- a/tests/qemu-iotests/030.out +++ b/tests/qemu-iotests/030.out @@ -1,5 +1,5 @@ -........................... +............................ ---------------------------------------------------------------------- -Ran 27 tests +Ran 28 tests =20 OK --=20 1.8.3.1