From nobody Mon Feb 9 17:08:11 2026 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=1569959354; cv=none; d=zoho.com; s=zohoarc; b=izgIovxZfX9AvY0ZGWNnHRkEkFcppkFU533fSitGIgGG2K0Gq5jHrE+PuiF0vww79tM6uCMWpvQMbaA8Snyayvga0Hu8x6DC/VFj9rD61DZ9RphO9J3a1GdaucFjwDUCv4BrH0GLMkQPeqBYnoI+D+49XToY/hRIgTNgEb90chw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1569959354; 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:ARC-Authentication-Results; bh=WuoAkT3biPPM+T/Rekmb2WzoWUhIZRku4smtIhDwUTk=; b=VkMmEwnO4oXQaUSSKhKXzywssAeS4brV0UTi6m43/MM/8R2xD94OBgOPMra22i0pAH6BMtwlls9+JVJnK2Z1/8m+7FO2VZrRDOWhnQigxABLKm0ydKC0gnBtf3uyu++QKxT/zlbRkYBmWWUrCYQor8Mk+zr8ncDmQiS48mVeYOc= 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 1569959354835969.7012024964644; Tue, 1 Oct 2019 12:49:14 -0700 (PDT) Received: from localhost ([::1]:47330 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iFO8y-0004nj-Jb for importer@patchew.org; Tue, 01 Oct 2019 15:49:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48327) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iFNo8-0004il-Rq for qemu-devel@nongnu.org; Tue, 01 Oct 2019 15:27:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iFNo7-0001Sk-CF for qemu-devel@nongnu.org; Tue, 01 Oct 2019 15:27:36 -0400 Received: from relay.sw.ru ([185.231.240.75]:45314) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iFNo7-0001RR-2P; Tue, 01 Oct 2019 15:27:35 -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 1iFNo4-00060a-7j; Tue, 01 Oct 2019 22:27:32 +0300 From: Andrey Shinkevich To: qemu-devel@nongnu.org, qemu-block@nongnu.org Subject: [PATCH 6/6] tests/qemu-iotests: add case for block-stream compress Date: Tue, 1 Oct 2019 22:27:20 +0300 Message-Id: <1569958040-697220-7-git-send-email-andrey.shinkevich@virtuozzo.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1569958040-697220-1-git-send-email-andrey.shinkevich@virtuozzo.com> References: <1569958040-697220-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, jsnow@redhat.com, armbru@redhat.com, dgilbert@redhat.com, stefanha@redhat.com, andrey.shinkevich@virtuozzo.com, den@openvz.org, mreitz@redhat.com 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 test case to the iotest #030 that checks 'compress' option for a block-stream job. Signed-off-by: Andrey Shinkevich --- tests/qemu-iotests/030 | 49 ++++++++++++++++++++++++++++++++++++++++++= +++- tests/qemu-iotests/030.out | 4 ++-- 2 files changed, 50 insertions(+), 3 deletions(-) diff --git a/tests/qemu-iotests/030 b/tests/qemu-iotests/030 index f3766f2..13fe5a2 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,52 @@ class TestSetSpeed(iotests.QMPTestCase): =20 self.cancel_and_wait(resume=3DTrue) =20 +class TestCompressed(iotests.QMPTestCase): + + def setUp(self): + qemu_img('create', '-f', iotests.imgfmt, backing_img, '1M') + qemu_img('create', '-f', iotests.imgfmt, '-o', + 'backing_file=3D%s' % backing_img, mid_img) + qemu_img('create', '-f', iotests.imgfmt, '-o', + 'backing_file=3D%s' % mid_img, test_img) + qemu_io('-c', 'write -P 0x1 0 512k', backing_img) + self.vm =3D iotests.VM().add_drive(test_img, "backing.node-name=3D= mid," + + "backing.backing.node-name=3Dbase= ") + self.vm.launch() + + def tearDown(self): + self.vm.shutdown() + os.remove(test_img) + os.remove(mid_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'mid', job_id=3D's= tream-mid') + self.assert_qmp(result, 'return', {}) + + self.wait_until_completed(drive=3D'stream-mid') + for event in self.vm.get_qmp_events(wait=3DTrue): + if event['event'] =3D=3D 'BLOCK_JOB_COMPLETED': + self.dictpath(event, 'data/device') + self.assert_qmp_absent(event, 'data/error') + + result =3D self.vm.qmp('block-stream', device=3D'drive0', base=3Dm= id_img, + job_id=3D'stream-top', compress=3DTrue) + self.assert_qmp(result, 'return', {}) + + self.wait_until_completed(drive=3D'stream-top') + self.assert_no_active_block_jobs() + self.vm.shutdown() + + top =3D json.loads(qemu_img_pipe('info', '--output=3Djson', test_i= mg)) + mid =3D json.loads(qemu_img_pipe('info', '--output=3Djson', mid_im= g)) + base =3D json.loads(qemu_img_pipe('info', '--output=3Djson', backi= ng_img)) + + self.assertEqual(mid['actual-size'], base['actual-size']) + self.assertLess(top['actual-size'], mid['actual-size']) + 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