All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
To: qemu-devel@nongnu.org
Cc: kwolf@redhat.com,
	Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>,
	famz@redhat.com, den@virtuozzo.com, armbru@redhat.com,
	jsnow@redhat.com
Subject: [Qemu-devel] [PATCH 3/6] iotests: test query-block-dirty-bitmap-ranges
Date: Sat, 30 Jan 2016 13:56:31 +0300	[thread overview]
Message-ID: <1454151394-52320-4-git-send-email-vsementsov@virtuozzo.com> (raw)
In-Reply-To: <1454151394-52320-1-git-send-email-vsementsov@virtuozzo.com>

Add test for QMP command query-block-dirty-bitmap-ranges.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
---
 tests/qemu-iotests/150     | 88 ++++++++++++++++++++++++++++++++++++++++++++++
 tests/qemu-iotests/150.out | 21 +++++++++++
 tests/qemu-iotests/group   |  1 +
 3 files changed, 110 insertions(+)
 create mode 100755 tests/qemu-iotests/150
 create mode 100644 tests/qemu-iotests/150.out

diff --git a/tests/qemu-iotests/150 b/tests/qemu-iotests/150
new file mode 100755
index 0000000..f208050
--- /dev/null
+++ b/tests/qemu-iotests/150
@@ -0,0 +1,88 @@
+#!/usr/bin/env python
+#
+# Test qmp command query-block-dirty-bitmap-ranges
+#
+# (C) Vladimir Sementsov-Ogievskiy 2015
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+
+import os
+import iotests
+import time
+from iotests import qemu_img
+
+disk = os.path.join(iotests.test_dir, 'disk')
+
+size   = 0x40000000 # 1G
+sector_size = 512
+granularity = 0x10000
+regions = [
+    { 'start': 0,          'count': 0x100000 },
+    { 'start': 0x10000000, 'count': 0x20000  },
+    { 'start': 0x39990000, 'count': 0x10000  }
+    ]
+
+class TestQueryDirtyBitmap(iotests.QMPTestCase):
+
+    def setUp(self):
+        qemu_img('create', '-f', iotests.imgfmt, disk, str(size))
+        self.vm = iotests.VM().add_drive(disk)
+        self.vm.launch()
+
+    def tearDown(self):
+        self.vm.shutdown()
+        os.remove(disk)
+
+    def printRange(self, begin, end):
+        print self.vm.qmp('query-block-dirty-bitmap-ranges', node='drive0',
+                name='bitmap', start=begin, count=(end - begin),
+                max_ranges=100);
+
+    def printWhole(self, max_ranges=100):
+        print self.vm.qmp('query-block-dirty-bitmap-ranges', node='drive0',
+                name='bitmap', max_ranges=max_ranges);
+
+    def test_query_bitmap(self):
+        result = self.vm.qmp('block-dirty-bitmap-add', node='drive0',
+                               name='bitmap', granularity=granularity)
+        self.assert_qmp(result, 'return', {});
+
+        for r in regions:
+          self.vm.hmp_qemu_io('drive0',
+                                'write %d %d' % (r['start'], r['count']))
+
+        self.printWhole()
+        self.printWhole(2)
+        self.printRange(100, 200)
+        self.printRange(0x100000 - 10, 0x10000000 + 10)
+        print
+
+        self.printRange(0x100000 - 10, 0x10000000 + 1)
+        self.printRange(0x100000 - 10, 0x10000000)
+        self.printRange(0x100000 - 10, 0x10000000 - 1)
+        print
+
+        self.printRange(0x100000 + 1, 0x10000000 - 1)
+        self.printRange(0x100000 + 1, 0x10000000)
+        self.printRange(0x100000 + 1, 0x10000000 + 1)
+        print
+
+        self.printRange(0x100000, 0x10000000 - 1)
+        self.printRange(0x100000, 0x10000000)
+        self.printRange(0x100000, 0x10000000 + 1)
+
+
+if __name__ == '__main__':
+    iotests.main()
diff --git a/tests/qemu-iotests/150.out b/tests/qemu-iotests/150.out
new file mode 100644
index 0000000..c137925
--- /dev/null
+++ b/tests/qemu-iotests/150.out
@@ -0,0 +1,21 @@
+.
+----------------------------------------------------------------------
+Ran 1 tests
+
+OK
+{u'return': [{u'count': 1048576, u'start': 0}, {u'count': 131072, u'start': 268435456}, {u'count': 65536, u'start': 966328320}]}
+{u'return': [{u'count': 1048576, u'start': 0}, {u'count': 131072, u'start': 268435456}]}
+{u'return': [{u'count': 100, u'start': 100}]}
+{u'return': [{u'count': 10, u'start': 1048566}, {u'count': 10, u'start': 268435456}]}
+
+{u'return': [{u'count': 10, u'start': 1048566}, {u'count': 1, u'start': 268435456}]}
+{u'return': [{u'count': 10, u'start': 1048566}]}
+{u'return': [{u'count': 10, u'start': 1048566}]}
+
+{u'return': []}
+{u'return': []}
+{u'return': [{u'count': 1, u'start': 268435456}]}
+
+{u'return': []}
+{u'return': []}
+{u'return': [{u'count': 1, u'start': 268435456}]}
diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group
index d6e9219..84db670 100644
--- a/tests/qemu-iotests/group
+++ b/tests/qemu-iotests/group
@@ -142,3 +142,4 @@
 138 rw auto quick
 139 rw auto quick
 142 auto
+150 auto
-- 
1.8.3.1

  parent reply	other threads:[~2016-01-30 10:57 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-30 10:56 [Qemu-devel] [PATCH v2 0/6] external backup api Vladimir Sementsov-Ogievskiy
2016-01-30 10:56 ` [Qemu-devel] [PATCH 1/6] block dirty bitmap: add next_zero function Vladimir Sementsov-Ogievskiy
2016-01-30 10:56 ` [Qemu-devel] [PATCH 2/6] qmp: add query-block-dirty-bitmap-ranges Vladimir Sementsov-Ogievskiy
2016-02-10 10:08   ` Stefan Hajnoczi
2016-02-10 13:57     ` Denis V. Lunev
2016-02-10 15:26       ` John Snow
2016-02-10 15:36         ` Denis V. Lunev
2016-02-10 15:37           ` John Snow
2016-02-10 15:40             ` Denis V. Lunev
2016-02-14  5:05       ` Fam Zheng
2016-01-30 10:56 ` Vladimir Sementsov-Ogievskiy [this message]
2016-01-30 10:56 ` [Qemu-devel] [PATCH 4/6] qapi: add qmp commands for some dirty bitmap functions Vladimir Sementsov-Ogievskiy
2016-01-30 10:56 ` [Qemu-devel] [PATCH 5/6] qapi: make block-dirty-bitmap-create-successor transaction-able Vladimir Sementsov-Ogievskiy
2016-01-30 10:56 ` [Qemu-devel] [PATCH 6/6] iotests: test external backup api Vladimir Sementsov-Ogievskiy
2016-02-03  8:14 ` [Qemu-devel] [PATCH v2 0/6] " Fam Zheng
2016-02-03 10:57   ` Vladimir Sementsov-Ogievskiy
2016-02-03 11:02     ` Fam Zheng
2016-02-03 11:24       ` Vladimir Sementsov-Ogievskiy
2016-02-05  8:28   ` Denis V. Lunev
2016-02-05  8:44     ` Fam Zheng
2016-02-09 14:21     ` Stefan Hajnoczi
2016-02-09 14:37       ` Denis V. Lunev
2016-02-09 16:49         ` John Snow
2016-02-09 16:58           ` Denis V. Lunev
2016-02-09 18:12             ` John Snow
2016-02-09 19:25               ` Denis V. Lunev
2016-02-10  8:04                 ` Denis V. Lunev
2016-02-09 14:28     ` Stefan Hajnoczi
2016-02-09 14:41       ` Denis V. Lunev
2016-02-10 10:10         ` Stefan Hajnoczi
2016-02-16 17:09           ` Stefan Hajnoczi
2016-02-16 17:17             ` Vladimir Sementsov-Ogievskiy
2016-02-16 17:20             ` Denis V. Lunev
2016-02-18 16:39               ` Stefan Hajnoczi
2016-02-18 17:07                 ` Markus Armbruster
2016-02-17 17:47             ` Vladimir Sementsov-Ogievskiy
2016-02-18  0:59               ` Fam Zheng
2016-02-18 12:11               ` Daniel P. Berrange
2016-02-18 16:41                 ` Stefan Hajnoczi
2016-02-19  2:08                   ` Fam Zheng
2016-02-19  8:51                     ` Markus Armbruster
2016-02-24 23:34                       ` John Snow
2016-02-26 19:55                       ` Paolo Bonzini
2016-02-26 20:03                         ` Paolo Bonzini
2016-02-26 20:29                           ` Denis V. Lunev
2016-02-26 21:37                           ` John Snow
2016-02-26 20:40                         ` Denis V. Lunev
2016-02-27  4:26                           ` Fam Zheng
2016-02-29  8:14                         ` Markus Armbruster
2016-02-29  8:54                           ` Paolo Bonzini
2016-02-29  9:42                             ` Paolo Bonzini
2016-02-29 10:05                               ` Fam Zheng
2016-03-10 17:37                               ` Stefan Hajnoczi
2016-03-10 17:40                                 ` Paolo Bonzini
2016-03-14 16:27                                   ` Denis V. Lunev
2016-02-29 10:22                           ` Markus Armbruster

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=1454151394-52320-4-git-send-email-vsementsov@virtuozzo.com \
    --to=vsementsov@virtuozzo.com \
    --cc=armbru@redhat.com \
    --cc=den@virtuozzo.com \
    --cc=famz@redhat.com \
    --cc=jsnow@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.