[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 08/22] iotests: Let _make_test_img parse its parameters
From: |
Max Reitz |
Subject: |
[PATCH v3 08/22] iotests: Let _make_test_img parse its parameters |
Date: |
Thu, 7 Nov 2019 17:36:54 +0100 |
This will allow us to add more options than just -b.
Signed-off-by: Max Reitz <address@hidden>
Reviewed-by: Maxim Levitsky <address@hidden>
---
tests/qemu-iotests/common.rc | 28 ++++++++++++++++++++--------
1 file changed, 20 insertions(+), 8 deletions(-)
diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc
index fa7bae2422..e12216b5f2 100644
--- a/tests/qemu-iotests/common.rc
+++ b/tests/qemu-iotests/common.rc
@@ -302,12 +302,12 @@ _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=""
local img_name=""
local use_backing=0
local backing_file=""
local object_options=""
+ local misc_params=()
if [ -n "$TEST_IMG_FILE" ]; then
img_name=$TEST_IMG_FILE
@@ -323,11 +323,23 @@ _make_test_img()
optstr=$(_optstr_add "$optstr" "key-secret=keysec0")
fi
- if [ "$1" = "-b" ]; then
- use_backing=1
- backing_file=$2
- image_size=$3
- fi
+ for param; do
+ if [ "$use_backing" = "1" -a -z "$backing_file" ]; then
+ backing_file=$param
+ continue
+ fi
+
+ case "$param" in
+ -b)
+ use_backing=1
+ ;;
+
+ *)
+ misc_params=("${misc_params[@]}" "$param")
+ ;;
+ esac
+ done
+
if [ \( "$IMGFMT" = "qcow2" -o "$IMGFMT" = "qed" \) -a -n "$CLUSTER_SIZE"
]; then
optstr=$(_optstr_add "$optstr" "cluster_size=$CLUSTER_SIZE")
fi
@@ -343,9 +355,9 @@ _make_test_img()
# XXX(hch): have global image options?
(
if [ $use_backing = 1 ]; then
- $QEMU_IMG create $object_options -f $IMGFMT $extra_img_options -b
"$backing_file" "$img_name" $image_size 2>&1
+ $QEMU_IMG create $object_options -f $IMGFMT $extra_img_options -b
"$backing_file" "$img_name" "${misc_params[@]}" 2>&1
else
- $QEMU_IMG create $object_options -f $IMGFMT $extra_img_options
"$img_name" $image_size 2>&1
+ $QEMU_IMG create $object_options -f $IMGFMT $extra_img_options
"$img_name" "${misc_params[@]}" 2>&1
fi
) | _filter_img_create
--
2.23.0
- [PATCH v3 00/22] iotests: Allow ./check -o data_file, Max Reitz, 2019/11/07
- [PATCH v3 01/22] iotests: s/qocw2/qcow2/, Max Reitz, 2019/11/07
- [PATCH v3 02/22] iotests/qcow2.py: Add dump-header-exts, Max Reitz, 2019/11/07
- [PATCH v3 03/22] iotests/qcow2.py: Split feature fields into bits, Max Reitz, 2019/11/07
- [PATCH v3 04/22] iotests: Add _filter_json_filename, Max Reitz, 2019/11/07
- [PATCH v3 05/22] iotests: Filter refcount_order in 036, Max Reitz, 2019/11/07
- [PATCH v3 06/22] iotests: Replace IMGOPTS by _unsupported_imgopts, Max Reitz, 2019/11/07
- [PATCH v3 07/22] iotests: Drop compat=1.1 in 050, Max Reitz, 2019/11/07
- [PATCH v3 08/22] iotests: Let _make_test_img parse its parameters,
Max Reitz <=
- [PATCH v3 09/22] iotests: Add -o and --no-opts to _make_test_img, Max Reitz, 2019/11/07
- [PATCH v3 10/22] iotests: Inject space into -ocompat=0.10 in 051, Max Reitz, 2019/11/07
- [PATCH v3 12/22] iotests: Replace IMGOPTS='' by --no-opts, Max Reitz, 2019/11/07
- [PATCH v3 14/22] iotests: Avoid qemu-img create, Max Reitz, 2019/11/07
- [PATCH v3 13/22] iotests: Drop IMGOPTS use in 267, Max Reitz, 2019/11/07
- [PATCH v3 11/22] iotests: Replace IMGOPTS= by -o, Max Reitz, 2019/11/07
- [PATCH v3 16/22] iotests: Avoid cp/mv of test images, Max Reitz, 2019/11/07
- [PATCH v3 17/22] iotests: Make 091 work with data_file, Max Reitz, 2019/11/07
- [PATCH v3 15/22] iotests: Use _rm_test_img for deleting test images, Max Reitz, 2019/11/07
- [PATCH v3 18/22] iotests: Make 110 work with data_file, Max Reitz, 2019/11/07