From: Ishani Chugh <chugh.ishani@research.iiit.ac.in>
To: qemu-devel@nongnu.org
Cc: stefanha@redhat.com, jsnow@redhat.com,
Ishani Chugh <chugh.ishani@research.iiit.ac.in>
Subject: [Qemu-devel] [PATCH 3/3] Backup Tool: Test for Incremental Backup
Date: Thu, 31 Aug 2017 00:45:38 +0530 [thread overview]
Message-ID: <1504120538-9309-4-git-send-email-chugh.ishani@research.iiit.ac.in> (raw)
In-Reply-To: <1504120538-9309-1-git-send-email-chugh.ishani@research.iiit.ac.in>
This patch is the test for incremental backup implementation in Backup tool.
The test employs two basic subtests:
1) Backing up an empty guest and comparing it with base image.
2) Writing a pattern to the guest, creating backup, writing
a pattern again, creating backup and comparing with base image.
Signed-off-by: Ishani Chugh <chugh.ishani@research.iiit.ac.in>
---
tests/qemu-iotests/193 | 86 ++++++++++++++++++++++++++++++++++++++++++++++
tests/qemu-iotests/193.out | 34 ++++++++++++++++++
tests/qemu-iotests/group | 1 +
3 files changed, 121 insertions(+)
create mode 100755 tests/qemu-iotests/193
create mode 100644 tests/qemu-iotests/193.out
diff --git a/tests/qemu-iotests/193 b/tests/qemu-iotests/193
new file mode 100755
index 0000000..500e5df
--- /dev/null
+++ b/tests/qemu-iotests/193
@@ -0,0 +1,86 @@
+#!/bin/bash
+#
+# Test Incremental backup functionality of qemu-backup tool
+#
+# Copyright (C) 2009 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=chugh.ishani@research.iiit.ac.in
+
+seq=`basename $0`
+echo "QA output created by $seq"
+
+here=`pwd`
+status=1 # failure is the default!
+
+
+# get standard environment, filters and checks
+. ./common.rc
+. ./common.filter
+. ./common.qemu
+
+_supported_fmt generic
+_supported_proto generic
+_supported_os Linux
+
+
+CONFIG_FILE=$TEST_DIR/backup-config
+SOCKET=unix:$TEST_DIR/backup_socket
+size=128M
+
+_make_test_img $size
+export QEMU_BACKUP_CONFIG=$CONFIG_FILE
+qemu_comm_method="monitor"
+echo
+_launch_qemu -drive if=virtio,file=$TEST_IMG -qmp $SOCKET,server,nowait
+$PYTHON ../../contrib/backup/qemu-backup.py guest add --guest adad --qmp $SOCKET
+$PYTHON ../../contrib/backup/qemu-backup.py drive add --id virtio0 --guest adad --target $TEST_DIR/virtio0
+echo
+echo "== Creating backup =="
+$PYTHON ../../contrib/backup/qemu-backup.py backup --inc --guest adad
+_send_qemu_cmd $QEMU_HANDLE 'quit' ''
+wait=1 _cleanup_qemu
+echo
+echo "== Comparing images =="
+$QEMU_IMG compare $TEST_DIR/virtio0_inc_0 $TEST_IMG
+
+rm $TEST_DIR/virtio0_inc_0
+
+_launch_qemu -drive if=virtio,id=virtio0,file=$TEST_IMG -qmp $SOCKET,server,nowait
+echo
+echo "== Writing Pattern =="
+_send_qemu_cmd $QEMU_HANDLE 'qemu-io virtio0 "write -P 0x22 0 1M"' "(qemu)" | _filter_qemu_io
+echo
+
+echo "== Creating backup =="
+$PYTHON ../../contrib/backup/qemu-backup.py backup --inc --guest adad
+
+echo "== Writing Pattern =="
+_send_qemu_cmd $QEMU_HANDLE 'qemu-io virtio0 "write -P 0x22 0 1M"' "(qemu)" | _filter_qemu_io
+echo
+$PYTHON ../../contrib/backup/qemu-backup.py backup --inc --guest adad
+_send_qemu_cmd $QEMU_HANDLE 'quit' ''
+wait=1 _cleanup_qemu
+echo
+echo "== Comparing images =="
+$QEMU_IMG compare $TEST_DIR/virtio0_inc_1 $TEST_IMG
+rm $TEST_DIR/virtio0_inc_0
+rm $TEST_DIR/virtio0_inc_1
+rm $CONFIG_FILE
+
+echo "*** done"
+status=0
\ No newline at end of file
diff --git a/tests/qemu-iotests/193.out b/tests/qemu-iotests/193.out
new file mode 100644
index 0000000..3a836c2
--- /dev/null
+++ b/tests/qemu-iotests/193.out
@@ -0,0 +1,34 @@
+QA output created by 193
+Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728
+
+Successfully Added Guest
+Successfully Added Drive
+
+== Creating backup ==
+QEMU X.Y.Z monitor - type 'help' for more information
+(qemu) Formatting 'TEST_DIR/virtio0_inc_0', fmt=qcow2 size=134217728 cluster_size=65536 lazy_refcounts=off refcount_bits=16
+quit
+
+== Comparing images ==
+Images are identical.
+
+== Writing Pattern ==
+QEMU X.Y.Z monitor - type 'help' for more information
+(qemu) qemu-io virtio0 "write -P 0x22 0 1M"
+
+== Creating backup ==
+Initial Backup does not exist
+== Writing Pattern ==
+wrote 1048576/1048576 bytes at offset 0
+1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+(qemu) Formatting 'TEST_DIR/virtio0_inc_0', fmt=qcow2 size=134217728 cluster_size=65536 lazy_refcounts=off refcount_bits=16
+
+Formatting '/home/ishani/Desktop/opw/qemu/tests/qemu-iotests/scratch/virtio0_inc_1', fmt=qcow2 size=134217728 backing_file=/home/ishani/Desktop/opw/qemu/tests/qemu-iotests/scratch/virtio0_inc_0 backing_fmt=qcow2 encryption=off cluster_size=65536 lazy_refcounts=off refcount_bits=16
+qemu-io virtio0 "write -P 0x22 0 1M"
+wrote 1048576/1048576 bytes at offset 0
+1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+(qemu) quit
+
+== Comparing images ==
+Images are identical.
+*** done
diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group
index 33c945b..6b9e034 100644
--- a/tests/qemu-iotests/group
+++ b/tests/qemu-iotests/group
@@ -189,3 +189,4 @@
191 rw auto
192 rw auto quick
194 rw auto migration quick
+193 rw auto
--
2.7.4
next prev parent reply other threads:[~2017-08-30 19:16 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-30 19:15 [Qemu-devel] [PATCH 0/3] Backup Tool: Incremental backup Ishani Chugh
2017-08-30 19:15 ` [Qemu-devel] [PATCH 1/3] Backup Tool: Manpage for Incremental Backup Ishani Chugh
2017-08-31 1:57 ` Fam Zheng
2017-08-30 19:15 ` [Qemu-devel] [PATCH 2/3] Backup Tool: Support " Ishani Chugh
2017-08-31 1:56 ` Fam Zheng
2017-08-30 19:15 ` Ishani Chugh [this message]
2017-08-31 2:02 ` [Qemu-devel] [PATCH 3/3] Backup Tool: Test " Fam Zheng
2017-09-01 22:53 ` John Snow
2017-09-07 4:03 ` Ishani
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=1504120538-9309-4-git-send-email-chugh.ishani@research.iiit.ac.in \
--to=chugh.ishani@research.iiit.ac.in \
--cc=jsnow@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.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).