From: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
To: qemu-devel@nongnu.org, qemu-block@nongnu.org
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
Subject: [PATCH v2 6/6] tests/qemu-iotests: add case for block-stream compress
Date: Wed, 2 Oct 2019 17:22:46 +0300 [thread overview]
Message-ID: <1570026166-748566-7-git-send-email-andrey.shinkevich@virtuozzo.com> (raw)
In-Reply-To: <1570026166-748566-1-git-send-email-andrey.shinkevich@virtuozzo.com>
Add a test case to the iotest #030 that checks 'compress' option for a
block-stream job.
Signed-off-by: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
---
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
backing_img = os.path.join(iotests.test_dir, 'backing.img')
mid_img = os.path.join(iotests.test_dir, 'mid.img')
@@ -956,6 +957,52 @@ class TestSetSpeed(iotests.QMPTestCase):
self.cancel_and_wait(resume=True)
+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=%s' % backing_img, mid_img)
+ qemu_img('create', '-f', iotests.imgfmt, '-o',
+ 'backing_file=%s' % mid_img, test_img)
+ qemu_io('-c', 'write -P 0x1 0 512k', backing_img)
+ self.vm = iotests.VM().add_drive(test_img, "backing.node-name=mid," +
+ "backing.backing.node-name=base")
+ 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 = self.vm.qmp('block-stream', device='mid', job_id='stream-mid')
+ self.assert_qmp(result, 'return', {})
+
+ self.wait_until_completed(drive='stream-mid')
+ for event in self.vm.get_qmp_events(wait=True):
+ if event['event'] == 'BLOCK_JOB_COMPLETED':
+ self.dictpath(event, 'data/device')
+ self.assert_qmp_absent(event, 'data/error')
+
+ result = self.vm.qmp('block-stream', device='drive0', base=mid_img,
+ job_id='stream-top', compress=True)
+ self.assert_qmp(result, 'return', {})
+
+ self.wait_until_completed(drive='stream-top')
+ self.assert_no_active_block_jobs()
+ self.vm.shutdown()
+
+ top = json.loads(qemu_img_pipe('info', '--output=json', test_img))
+ mid = json.loads(qemu_img_pipe('info', '--output=json', mid_img))
+ base = json.loads(qemu_img_pipe('info', '--output=json', backing_img))
+
+ self.assertEqual(mid['actual-size'], base['actual-size'])
+ self.assertLess(top['actual-size'], mid['actual-size'])
+
if __name__ == '__main__':
iotests.main(supported_fmts=['qcow2', 'qed'],
supported_protocols=['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
OK
--
1.8.3.1
next prev parent reply other threads:[~2019-10-02 14:30 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-02 14:22 [PATCH v2 0/6] qcow2: advanced compression options Andrey Shinkevich
2019-10-02 14:22 ` [PATCH v2 1/6] qcow2: Allow writing compressed data to multiple clusters Andrey Shinkevich
2019-10-03 14:16 ` Vladimir Sementsov-Ogievskiy
2019-10-02 14:22 ` [PATCH v2 2/6] tests/qemu-iotests: add case of " Andrey Shinkevich
2019-10-03 14:21 ` Vladimir Sementsov-Ogievskiy
2019-10-02 14:22 ` [PATCH v2 3/6] qemu-nbd: add compression flag support Andrey Shinkevich
2019-10-03 14:32 ` Vladimir Sementsov-Ogievskiy
2019-10-04 10:19 ` Roman Kagan
2019-10-07 11:52 ` Vladimir Sementsov-Ogievskiy
2019-10-02 14:22 ` [PATCH v2 4/6] block: support compressed write for copy-on-read Andrey Shinkevich
2019-10-03 14:37 ` Vladimir Sementsov-Ogievskiy
2019-10-02 14:22 ` [PATCH v2 5/6] block-stream: add compress option Andrey Shinkevich
2019-10-03 14:48 ` Vladimir Sementsov-Ogievskiy
2019-10-02 14:22 ` Andrey Shinkevich [this message]
2019-10-03 14:58 ` [PATCH v2 6/6] tests/qemu-iotests: add case for block-stream compress Vladimir Sementsov-Ogievskiy
2019-10-15 17:57 ` Andrey Shinkevich
2019-10-02 15:07 ` [PATCH v2 0/6] qcow2: advanced compression options no-reply
2019-10-02 15:35 ` Vladimir Sementsov-Ogievskiy
2019-10-02 15:58 ` Max Reitz
2019-10-02 19:04 ` Markus Armbruster
2019-10-02 15:07 ` no-reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1570026166-748566-7-git-send-email-andrey.shinkevich@virtuozzo.com \
--to=andrey.shinkevich@virtuozzo.com \
--cc=armbru@redhat.com \
--cc=den@openvz.org \
--cc=dgilbert@redhat.com \
--cc=fam@euphon.net \
--cc=jsnow@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
--cc=vsementsov@virtuozzo.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).