aboutsummaryrefslogtreecommitdiff
path: root/tests/qemu-iotests/common.rc
diff options
context:
space:
mode:
authorMORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>2011-01-18 02:01:17 +0900
committerKevin Wolf <kwolf@redhat.com>2012-02-23 10:29:46 +0100
commit9cdfa1b34e22bc09e80042b1ef3e4a5096f260d5 (patch)
tree5e35bba9d58160dc12df1bc3b88e2418f27d834e /tests/qemu-iotests/common.rc
parent62284d1776e4e9d1e39e393398becf7c778ca0ce (diff)
qemu-iotests: add support for rbd and sheepdog protocols
This patch introduces tests for protocols other than file, and initially supports rbd and sheepdog. Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp> Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'tests/qemu-iotests/common.rc')
-rw-r--r--tests/qemu-iotests/common.rc45
1 files changed, 41 insertions, 4 deletions
diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc
index f2db92e985..cdefafc62f 100644
--- a/tests/qemu-iotests/common.rc
+++ b/tests/qemu-iotests/common.rc
@@ -47,7 +47,11 @@ fi
# make sure we have a standard umask
umask 022
-TEST_IMG=$TEST_DIR/t.$IMGFMT
+if [ "$IMGPROTO" = "file" ]; then
+ TEST_IMG=$TEST_DIR/t.$IMGFMT
+else
+ TEST_IMG=$IMGPROTO:$TEST_DIR/t.$IMGFMT
+fi
_make_test_img()
{
@@ -61,6 +65,7 @@ _make_test_img()
# XXX(hch): have global image options?
$QEMU_IMG create -f $IMGFMT $TEST_IMG $extra_img_options | \
+ sed -e "s#$IMGPROTO:$TEST_DIR#TEST_DIR#g" | \
sed -e "s#$TEST_DIR#TEST_DIR#g" | \
sed -e "s#$IMGFMT#IMGFMT#g" | \
sed -e "s# encryption=off##g" | \
@@ -72,9 +77,23 @@ _make_test_img()
_cleanup_test_img()
{
- rm -f $TEST_DIR/t.$IMGFMT
- rm -f $TEST_DIR/t.$IMGFMT.orig
- rm -f $TEST_DIR/t.$IMGFMT.base
+ case "$IMGPROTO" in
+
+ file)
+ rm -f $TEST_DIR/t.$IMGFMT
+ rm -f $TEST_DIR/t.$IMGFMT.orig
+ rm -f $TEST_DIR/t.$IMGFMT.base
+ ;;
+
+ rbd)
+ rbd rm $TEST_DIR/t.$IMGFMT > /dev/null
+ ;;
+
+ sheepdog)
+ collie vdi delete $TEST_DIR/t.$IMGFMT
+ ;;
+
+ esac
}
_check_test_img()
@@ -207,6 +226,19 @@ _supported_fmt()
_notrun "not suitable for this image format: $IMGFMT"
}
+# tests whether $IMGPROTO is one of the supported image protocols for a test
+#
+_supported_proto()
+{
+ for f; do
+ if [ "$f" = "$IMGPROTO" -o "$f" = "generic" ]; then
+ return
+ fi
+ done
+
+ _notrun "not suitable for this image protocol: $IMGPROTO"
+}
+
# tests whether the host OS is one of the supported OSes for a test
#
_supported_os()
@@ -234,6 +266,11 @@ _full_imgfmt_details()
echo "$IMGFMT"
}
+_full_imgproto_details()
+{
+ echo "$IMGPROTO"
+}
+
_full_platform_details()
{
os=`uname -s`