summaryrefslogtreecommitdiff
path: root/tests/qemu-iotests/common.rc
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2012-03-27 13:45:14 +0200
committerKevin Wolf <kwolf@redhat.com>2012-04-20 15:57:30 +0200
commit8900436891cd8955b0795945aa020c04eaa0e5d2 (patch)
treea99526c912164f53f68b6fee3e3910f035db8f55 /tests/qemu-iotests/common.rc
parent621f058940ea9f1ef3d8774ef3203544f1228df1 (diff)
downloadqemu-8900436891cd8955b0795945aa020c04eaa0e5d2.tar.gz
qemu-iotests: Add -o and make v3 the default for qcow2
This adds an -o option to qemu-iotests, which is an option string that is passed through to qemu-img create -o... This allows testing different subformat with a command like './check -qcow2 -o compat=0.10'. For qcow2, if no compat option is specified, compat=1.1 is the new default. Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'tests/qemu-iotests/common.rc')
-rw-r--r--tests/qemu-iotests/common.rc34
1 files changed, 32 insertions, 2 deletions
diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc
index 00ee754c8d..4bc7420ece 100644
--- a/tests/qemu-iotests/common.rc
+++ b/tests/qemu-iotests/common.rc
@@ -53,19 +53,44 @@ else
TEST_IMG=$IMGPROTO:$TEST_DIR/t.$IMGFMT
fi
+_optstr_add()
+{
+ if [ -n "$1" ]; then
+ echo "$1,$2"
+ else
+ echo "$2"
+ fi
+}
+
+_set_default_imgopts()
+{
+ if [ "$IMGFMT" == "qcow2" ] && ! (echo "$IMGOPTS" | grep "compat=" > /dev/null); then
+ IMGOPTS=$(_optstr_add "$IMGOPTS" "compat=1.1")
+ fi
+}
+
_make_test_img()
{
# extra qemu-img options can be added by tests
# at least one argument (the image size) needs to be added
local extra_img_options=""
local image_size=$*
+ local optstr=""
+
+ if [ -n "$IMGOPTS" ]; then
+ optstr=$(_optstr_add "$optstr" "$IMGOPTS")
+ fi
if [ "$1" = "-b" ]; then
extra_img_options="$1 $2"
image_size=$3
fi
if [ \( "$IMGFMT" = "qcow2" -o "$IMGFMT" = "qed" \) -a -n "$CLUSTER_SIZE" ]; then
- extra_img_options="-o cluster_size=$CLUSTER_SIZE $extra_img_options"
+ optstr=$(_optstr_add "$optstr" "cluster_size=$CLUSTER_SIZE")
+ fi
+
+ if [ -n "$optstr" ]; then
+ extra_img_options="-o $optstr $extra_img_options"
fi
# XXX(hch): have global image options?
@@ -76,6 +101,7 @@ _make_test_img()
sed -e "s# encryption=off##g" | \
sed -e "s# cluster_size=[0-9]\\+##g" | \
sed -e "s# table_size=0##g" | \
+ sed -e "s# compat='[^']*'##g" | \
sed -e "s# compat6=off##g" | \
sed -e "s# static=off##g"
}
@@ -268,7 +294,11 @@ _require_command()
_full_imgfmt_details()
{
- echo "$IMGFMT"
+ if [ -n "$IMGOPTS" ]; then
+ echo "$IMGFMT ($IMGOPTS)"
+ else
+ echo "$IMGFMT"
+ fi
}
_full_imgproto_details()