diff mbox

[8/8] iotests: test internal persistent dirty bitmap

Message ID 1421168546-6232-9-git-send-email-vsementsov@parallels.com
State New
Headers show

Commit Message

Vladimir Sementsov-Ogievskiy Jan. 13, 2015, 5:02 p.m. UTC
The test performs several vm reloads with checking and updating dirty
bitmap.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@parallels.com>
---
 tests/qemu-iotests/115     | 96 ++++++++++++++++++++++++++++++++++++++++++++++
 tests/qemu-iotests/115.out | 64 +++++++++++++++++++++++++++++++
 tests/qemu-iotests/group   |  1 +
 3 files changed, 161 insertions(+)
 create mode 100755 tests/qemu-iotests/115
 create mode 100644 tests/qemu-iotests/115.out
diff mbox

Patch

diff --git a/tests/qemu-iotests/115 b/tests/qemu-iotests/115
new file mode 100755
index 0000000..ef853b1
--- /dev/null
+++ b/tests/qemu-iotests/115
@@ -0,0 +1,96 @@ 
+#!/bin/bash
+#
+# Persistent dirty bitmap test
+#
+# Performs several vm reloads with checking and updating dirty bitmap.
+#
+# Copyright (C) 2014 Red Hat, Inc.
+#
+# 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/>.
+#
+
+# creator
+owner=vsementsov@parallels.com
+
+seq=`basename $0`
+echo "QA output created by $seq"
+
+here=`pwd`
+status=1    # failure is the default!
+
+_cleanup()
+{
+    _cleanup_qemu
+    _cleanup_test_img
+}
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+# get standard environment, filters and checks
+. ./common.rc
+. ./common.filter
+. ./common.qemu
+
+_supported_fmt qcow2
+_supported_os Linux
+
+size=1G
+_make_test_img $size
+
+qemu_comm_method="monitor"
+
+launch() {
+    _launch_qemu -drive file="${TEST_IMG}",id=disk\
+        -dirty-bitmap name=bitmap,drive=disk
+    echo
+    echo START VM
+}
+
+print_bitmap() {
+    _send_qemu_cmd $QEMU_HANDLE 'print_dirty_bitmap disk bitmap'\
+        "dirty regions end" | sed 's/^/    /'
+}
+
+write() {
+    _send_qemu_cmd $QEMU_HANDLE 'qemu-io disk "write ' $@ '"' "(qemu)"
+    echo
+    echo write $@
+}
+
+quit() {
+    _send_qemu_cmd $QEMU_HANDLE 'qemu-io disk flush' "(qemu)"
+    _send_qemu_cmd $QEMU_HANDLE 'quit' ""
+    echo QUIT
+    wait ${QEMU_PID[$QEMU_HANDLE]} 2>/dev/null
+}
+
+{
+    launch
+    print_bitmap
+    write 50m 1m
+    print_bitmap
+    quit
+
+    launch
+    print_bitmap
+    write 0m 10m
+    write 700m 200m
+    print_bitmap
+    quit
+
+    launch
+    print_bitmap
+    quit
+} | sed '/(qemu)/d'
+
+status=0
diff --git a/tests/qemu-iotests/115.out b/tests/qemu-iotests/115.out
new file mode 100644
index 0000000..d570c9f
--- /dev/null
+++ b/tests/qemu-iotests/115.out
@@ -0,0 +1,64 @@ 
+QA output created by 115
+Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
+
+START VM
+QEMU X.Y.Z monitor - type 'help' for more information
+    bitmap 'bitmap'
+    enabled: true
+    size: 2097152
+    granularity: 65536
+    dirty regions begin:
+    dirty regions end
+
+write 50m 1m
+wrote 1048576/1048576 bytes at offset 52428800
+1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+    bitmap 'bitmap'
+    enabled: true
+    size: 2097152
+    granularity: 65536
+    dirty regions begin:
+    102400 -> 104447
+    dirty regions end
+QUIT
+
+START VM
+QEMU X.Y.Z monitor - type 'help' for more information
+    bitmap 'bitmap'
+    enabled: true
+    size: 2097152
+    granularity: 65536
+    dirty regions begin:
+    102400 -> 104447
+    dirty regions end
+
+write 0m 10m
+wrote 10485760/10485760 bytes at offset 0
+10 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+
+write 700m 200m
+wrote 209715200/209715200 bytes at offset 734003200
+200 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+    bitmap 'bitmap'
+    enabled: true
+    size: 2097152
+    granularity: 65536
+    dirty regions begin:
+    0 -> 20479
+    102400 -> 104447
+    1433600 -> 1843199
+    dirty regions end
+QUIT
+
+START VM
+QEMU X.Y.Z monitor - type 'help' for more information
+    bitmap 'bitmap'
+    enabled: true
+    size: 2097152
+    granularity: 65536
+    dirty regions begin:
+    0 -> 20479
+    102400 -> 104447
+    1433600 -> 1843199
+    dirty regions end
+QUIT
diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group
index a4742c6..77377b3 100644
--- a/tests/qemu-iotests/group
+++ b/tests/qemu-iotests/group
@@ -115,3 +115,4 @@ 
 111 rw auto quick
 113 rw auto quick
 114 rw auto quick
+115 rw auto quick