aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Reitz <mreitz@redhat.com>2019-11-07 17:36:55 +0100
committerMax Reitz <mreitz@redhat.com>2020-01-06 13:43:07 +0100
commit8b6d7be6a6f8b8e71ab19d63021aad72a0fe1c6b (patch)
tree375497c1c17b1deb308118eaa29b3e6774ff2573
parenteea871d047701b563cfd66c1566b9ff6d163882b (diff)
downloadqemu-8b6d7be6a6f8b8e71ab19d63021aad72a0fe1c6b.zip
qemu-8b6d7be6a6f8b8e71ab19d63021aad72a0fe1c6b.tar.gz
qemu-8b6d7be6a6f8b8e71ab19d63021aad72a0fe1c6b.tar.bz2
iotests: Add -o and --no-opts to _make_test_img
Blindly overriding IMGOPTS is suboptimal as this discards user-specified options. Whatever options the test needs should simply be appended. Some tests do this (with IMGOPTS=$(_optstr_add "$IMGOPTS" "...")), but that is cumbersome. It’s simpler to just give _make_test_img an -o parameter with which tests can add options. Some tests actually must override the user-specified options, though, for example when creating an image in a different format than the test $IMGFMT. For such cases, --no-opts allows clearing the current option list. Signed-off-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com> Message-id: 20191107163708.833192-10-mreitz@redhat.com Signed-off-by: Max Reitz <mreitz@redhat.com>
-rw-r--r--tests/qemu-iotests/common.rc13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc
index f01165a..7d704f9 100644
--- a/tests/qemu-iotests/common.rc
+++ b/tests/qemu-iotests/common.rc
@@ -308,6 +308,7 @@ _make_test_img()
local use_backing=0
local backing_file=""
local object_options=""
+ local opts_param=false
local misc_params=()
if [ -n "$TEST_IMG_FILE" ]; then
@@ -328,6 +329,10 @@ _make_test_img()
if [ "$use_backing" = "1" -a -z "$backing_file" ]; then
backing_file=$param
continue
+ elif $opts_param; then
+ optstr=$(_optstr_add "$optstr" "$param")
+ opts_param=false
+ continue
fi
case "$param" in
@@ -335,6 +340,14 @@ _make_test_img()
use_backing=1
;;
+ -o)
+ opts_param=true
+ ;;
+
+ --no-opts)
+ optstr=""
+ ;;
+
*)
misc_params=("${misc_params[@]}" "$param")
;;