[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 04/26] FVD: add fully automated test-vdi.sh
From: |
Chunqiang Tang |
Subject: |
[Qemu-devel] [PATCH 04/26] FVD: add fully automated test-vdi.sh |
Date: |
Fri, 25 Feb 2011 17:37:44 -0500 |
This patch is part of the Fast Virtual Disk (FVD) proposal.
See http://wiki.qemu.org/Features/FVD.
test-vdi.sh drives 'qemu-io --auto' to perform fully automated testing for VDI.
Signed-off-by: Chunqiang Tang <address@hidden>
---
test-vdi.sh | 83 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 83 insertions(+), 0 deletions(-)
create mode 100755 test-vdi.sh
diff --git a/test-vdi.sh b/test-vdi.sh
new file mode 100755
index 0000000..b0bfe65
--- /dev/null
+++ b/test-vdi.sh
@@ -0,0 +1,83 @@
+#!/bin/bash
+
+# Drive 'qemu-io --auto' to test the VDI image format.
+#
+# Copyright IBM, Corp. 2010
+#
+# Authors:
+# Chunqiang Tang <address@hidden>
+#
+# This work is licensed under the terms of the GNU GPL, version 2 or later.
+# See the COPYING.LIB file in the top-level directory.
+
+if [ $USER != "root" ]; then
+ echo "This command must be run by root in order to mount tmpfs."
+ exit 1
+fi
+
+QEMU_DIR=.
+QEMU_IMG=$QEMU_DIR/qemu-img
+QEMU_IO=$QEMU_DIR/qemu-io
+
+if [ ! -e $QEMU_IMG ]; then
+ echo "$QEMU_IMG does not exist."
+ exit 1;
+fi
+
+if [ ! -e $QEMU_IO ]; then
+ echo "$QEMU_IO does not exist."
+ exit 1;
+fi
+
+DATA_DIR=/var/ramdisk
+TRUTH_IMG=$DATA_DIR/truth.raw
+TEST_IMG=$DATA_DIR/test.vdi
+CMD_LOG=./test-vdi.log
+
+parallel=10
+round=1000
+fail_prob=0.1
+cancel_prob=0
+flush_prob=0
+aio_flush_prob=0
+instant_qemubh=true
+seed=$RANDOM$RANDOM
+count=0
+
+function invoke() {
+ echo "$*" >> $CMD_LOG
+ $*
+ ret=$?
+ if [ $? -ne 0 ]; then
+ echo "Exit with error code $?: $*"
+ exit $ret
+ fi
+}
+
+mount | grep $DATA_DIR > /dev/null
+if [ $? -ne 0 ]; then
+ echo "Create tmpfs at $DATA_DIR to store testing images."
+ if [ ! -e $DATA_DIR ]; then mkdir -p $DATA_DIR ; fi
+ invoke "mount -t tmpfs none $DATA_DIR -o size=400M"
+ if [ $? -ne 0 ]; then exit 1; fi
+fi
+
+/bin/rm -f $CMD_LOG
+touch $CMD_LOG
+
+while [ -t ]; do
+for io_size in 3145728; do
+ count=$[$count + 1]
+ echo "Round $count" >> $CMD_LOG
+
+ # VDI image is about 100M
+ img_size=$[(104857600 + ($RANDOM$RANDOM$RANDOM % 10485760)) / 512 * 512]
+
+ invoke "/bin/rm -rf $TRUTH_IMG $TEST_IMG"
+ invoke "dd if=/dev/zero of=$TRUTH_IMG count=0 bs=1 seek=$img_size"
+ invoke "$QEMU_IMG create -f vdi $TEST_IMG $img_size"
+
+ invoke "$QEMU_IO --auto --seed=$seed --truth=$TRUTH_IMG --format=vdi
--test="blksim:$TEST_IMG" --verify_write=true --compare_before=false
--compare_after=true --round=$round --parallel=$parallel --io_size=$io_size
--fail_prob=$fail_prob --cancel_prob=$cancel_prob
--aio_flush_prob=$aio_flush_prob --flush_prob=$flush_prob
--instant_qemubh=$instant_qemubh"
+
+ seed=$[$seed + 1]
+done; done
--
1.7.0.4
- [Qemu-devel] [PATCH 25/26] FVD: add impl of interface bdrv_probe(), (continued)
- [Qemu-devel] [PATCH 25/26] FVD: add impl of interface bdrv_probe(), Chunqiang Tang, 2011/02/25
- [Qemu-devel] [PATCH 15/26] FVD: add basic journal functionality, Chunqiang Tang, 2011/02/25
- [Qemu-devel] [PATCH 18/26] FVD: add support for base image prefetching, Chunqiang Tang, 2011/02/25
- [Qemu-devel] [PATCH 03/26] FVD: add fully automated test-qcow2.sh, Chunqiang Tang, 2011/02/25
- [Qemu-devel] [PATCH 02/26] FVD: extend qemu-io to do fully automated testing, Chunqiang Tang, 2011/02/25
- [Qemu-devel] [PATCH 07/26] FVD: extend FVD header fvd.h to be more complete, Chunqiang Tang, 2011/02/25
- [Qemu-devel] [PATCH 12/26] FVD: add impl of interface bdrv_aio_readv(), Chunqiang Tang, 2011/02/25
- [Qemu-devel] [PATCH 11/26] FVD: add impl of interface bdrv_aio_writev(), Chunqiang Tang, 2011/02/25
- [Qemu-devel] [PATCH 06/26] FVD: skeleton of Fast Virtual Disk, Chunqiang Tang, 2011/02/25
- [Qemu-devel] [PATCH 05/26] FVD: add the 'qemu-img update' command, Chunqiang Tang, 2011/02/25
- [Qemu-devel] [PATCH 04/26] FVD: add fully automated test-vdi.sh,
Chunqiang Tang <=
- [Qemu-devel] [PATCH 09/26] FVD: add impl of interface bdrv_create(), Chunqiang Tang, 2011/02/25