[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 37/38] qemu-iotests: Add -o and make v3 the default
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PATCH 37/38] qemu-iotests: Add -o and make v3 the default for qcow2 |
Date: |
Fri, 20 Apr 2012 19:01:43 +0200 |
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 <address@hidden>
---
tests/qemu-iotests/check | 6 +++---
tests/qemu-iotests/common | 17 +++++++++++++++++
tests/qemu-iotests/common.rc | 34 ++++++++++++++++++++++++++++++++--
3 files changed, 52 insertions(+), 5 deletions(-)
diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check
index aae1378..432732c 100755
--- a/tests/qemu-iotests/check
+++ b/tests/qemu-iotests/check
@@ -41,9 +41,6 @@ then
exit 1
fi
-# we need common
-. ./common
-
# we need common.rc
if ! . ./common.rc
then
@@ -51,6 +48,9 @@ then
exit 1
fi
+# we need common
+. ./common
+
#if [ `id -u` -ne 0 ]
#then
# echo "check: QA must be run as root"
diff --git a/tests/qemu-iotests/common b/tests/qemu-iotests/common
index c187f6c..eeb70cb 100644
--- a/tests/qemu-iotests/common
+++ b/tests/qemu-iotests/common
@@ -35,6 +35,7 @@ diff="diff -u"
verbose=false
group=false
xgroup=false
+imgopts=false
showme=false
sortme=false
expunge=true
@@ -44,6 +45,7 @@ rm -f $tmp.list $tmp.tmp $tmp.sed
export IMGFMT=raw
export IMGPROTO=file
+export IMGOPTS=""
export QEMU_IO_OPTIONS=""
for r
@@ -103,6 +105,13 @@ s/ .*//p
mv $tmp.tmp $tmp.list
xgroup=false
continue
+
+ elif $imgopts
+ then
+ IMGOPTS="$r"
+ imgopts=false
+ continue
+
fi
xpand=true
@@ -130,6 +139,7 @@ check options
-nocache use O_DIRECT on backing file
-misalign misalign memory allocations
-n show me, do not run tests
+ -o options -o options to pass to qemu-img create/convert
-T output timestamps
-r randomize test order
@@ -223,6 +233,10 @@ testlist options
showme=true
xpand=false
;;
+ -o)
+ imgopts=true
+ xpand=false
+ ;;
-r) # randomize test order
randomize=true
xpand=false
@@ -299,6 +313,9 @@ BEGIN { for (t='$start'; t<='$end'; t++) printf
"%03d\n",t }' \
done
+# Set default options for qemu-img create -o if they were not specified
+_set_default_imgopts
+
if [ -s $tmp.list ]
then
# found some valid test numbers ... this is good
diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc
index 00ee754..4bc7420 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()
--
1.7.6.5
- [Qemu-devel] [PATCH 31/38] qcow2: Version 3 images, (continued)
- [Qemu-devel] [PATCH 31/38] qcow2: Version 3 images, Kevin Wolf, 2012/04/20
- [Qemu-devel] [PATCH 24/38] qcow2: Ignore reserved bits in count_contiguous_clusters(), Kevin Wolf, 2012/04/20
- [Qemu-devel] [PATCH 28/38] qcow2: Simplify count_cow_clusters, Kevin Wolf, 2012/04/20
- [Qemu-devel] [PATCH 21/38] Specification for qcow2 version 3, Kevin Wolf, 2012/04/20
- [Qemu-devel] [PATCH 32/38] qcow2: Support reading zero clusters, Kevin Wolf, 2012/04/20
- [Qemu-devel] [PATCH 33/38] qcow2: Support for feature table header extension, Kevin Wolf, 2012/04/20
- [Qemu-devel] [PATCH 38/38] qemu-iotests: Fix test 031 for qcow2 v3 support, Kevin Wolf, 2012/04/20
- [Qemu-devel] [PATCH 29/38] qcow2: Ignore reserved bits in refcount table entries, Kevin Wolf, 2012/04/20
- [Qemu-devel] [PATCH 36/38] qcow2: Zero write support, Kevin Wolf, 2012/04/20
- [Qemu-devel] [PATCH 34/38] qemu-iotests: add a simple test for write_zeroes, Kevin Wolf, 2012/04/20
- [Qemu-devel] [PATCH 37/38] qemu-iotests: Add -o and make v3 the default for qcow2,
Kevin Wolf <=
- [Qemu-devel] [PATCH 30/38] qcow2: Ignore reserved bits in check_refcounts, Kevin Wolf, 2012/04/20
- [Qemu-devel] [PATCH 35/38] qemu-iotests: Test backing file COW with zero clusters, Kevin Wolf, 2012/04/20