[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 66/69] block: add support for --image-opts in block I
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PULL 66/69] block: add support for --image-opts in block I/O tests |
Date: |
Thu, 12 May 2016 16:35:46 +0200 |
From: "Daniel P. Berrange" <address@hidden>
Currently all block tests use the traditional syntax for images
just specifying a filename. To support the LUKS driver without
resorting to JSON, the tests need to be able to use the new
--image-opts argument to qemu-img and qemu-io.
This introduces a new env variable IMGOPTSSYNTAX. If this is
set to 'true', then qemu-img/qemu-io should use --image-opts.
Signed-off-by: Daniel P. Berrange <address@hidden>
Message-id: address@hidden
Signed-off-by: Max Reitz <address@hidden>
---
tests/qemu-iotests/039.out | 20 +++++++-------
tests/qemu-iotests/061.out | 8 +++---
tests/qemu-iotests/137.out | 4 +--
tests/qemu-iotests/common | 7 ++++-
tests/qemu-iotests/common.config | 15 +++++++++--
tests/qemu-iotests/common.rc | 57 +++++++++++++++++++++++++++++-----------
6 files changed, 77 insertions(+), 34 deletions(-)
diff --git a/tests/qemu-iotests/039.out b/tests/qemu-iotests/039.out
index 32c8846..c6e0ac2 100644
--- a/tests/qemu-iotests/039.out
+++ b/tests/qemu-iotests/039.out
@@ -12,9 +12,9 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728
wrote 512/512 bytes at offset 0
512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
./common.config: Killed ( if [ "${VALGRIND_QEMU}" == "y" ];
then
- exec valgrind --log-file="${VALGRIND_LOGFILE}" --error-exitcode=99
"$QEMU_IO_PROG" $QEMU_IO_OPTIONS "$@";
+ exec valgrind --log-file="${VALGRIND_LOGFILE}" --error-exitcode=99
"$QEMU_IO_PROG" $QEMU_IO_ARGS "$@";
else
- exec "$QEMU_IO_PROG" $QEMU_IO_OPTIONS "$@";
+ exec "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@";
fi )
incompatible_features 0x1
ERROR cluster 5 refcount=0 reference=1
@@ -51,9 +51,9 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728
wrote 512/512 bytes at offset 0
512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
./common.config: Killed ( if [ "${VALGRIND_QEMU}" == "y" ];
then
- exec valgrind --log-file="${VALGRIND_LOGFILE}" --error-exitcode=99
"$QEMU_IO_PROG" $QEMU_IO_OPTIONS "$@";
+ exec valgrind --log-file="${VALGRIND_LOGFILE}" --error-exitcode=99
"$QEMU_IO_PROG" $QEMU_IO_ARGS "$@";
else
- exec "$QEMU_IO_PROG" $QEMU_IO_OPTIONS "$@";
+ exec "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@";
fi )
incompatible_features 0x1
ERROR cluster 5 refcount=0 reference=1
@@ -69,9 +69,9 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728
wrote 512/512 bytes at offset 0
512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
./common.config: Killed ( if [ "${VALGRIND_QEMU}" == "y" ];
then
- exec valgrind --log-file="${VALGRIND_LOGFILE}" --error-exitcode=99
"$QEMU_IO_PROG" $QEMU_IO_OPTIONS "$@";
+ exec valgrind --log-file="${VALGRIND_LOGFILE}" --error-exitcode=99
"$QEMU_IO_PROG" $QEMU_IO_ARGS "$@";
else
- exec "$QEMU_IO_PROG" $QEMU_IO_OPTIONS "$@";
+ exec "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@";
fi )
incompatible_features 0x0
No errors were found on the image.
@@ -92,9 +92,9 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728
wrote 512/512 bytes at offset 0
512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
./common.config: Killed ( if [ "${VALGRIND_QEMU}" == "y" ];
then
- exec valgrind --log-file="${VALGRIND_LOGFILE}" --error-exitcode=99
"$QEMU_IO_PROG" $QEMU_IO_OPTIONS "$@";
+ exec valgrind --log-file="${VALGRIND_LOGFILE}" --error-exitcode=99
"$QEMU_IO_PROG" $QEMU_IO_ARGS "$@";
else
- exec "$QEMU_IO_PROG" $QEMU_IO_OPTIONS "$@";
+ exec "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@";
fi )
incompatible_features 0x1
ERROR cluster 5 refcount=0 reference=1
@@ -106,9 +106,9 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728
wrote 512/512 bytes at offset 0
512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
./common.config: Killed ( if [ "${VALGRIND_QEMU}" == "y" ];
then
- exec valgrind --log-file="${VALGRIND_LOGFILE}" --error-exitcode=99
"$QEMU_IO_PROG" $QEMU_IO_OPTIONS "$@";
+ exec valgrind --log-file="${VALGRIND_LOGFILE}" --error-exitcode=99
"$QEMU_IO_PROG" $QEMU_IO_ARGS "$@";
else
- exec "$QEMU_IO_PROG" $QEMU_IO_OPTIONS "$@";
+ exec "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@";
fi )
incompatible_features 0x0
No errors were found on the image.
diff --git a/tests/qemu-iotests/061.out b/tests/qemu-iotests/061.out
index a03732e..a431b7f 100644
--- a/tests/qemu-iotests/061.out
+++ b/tests/qemu-iotests/061.out
@@ -58,9 +58,9 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
wrote 131072/131072 bytes at offset 0
128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
./common.config: Killed ( if [ "${VALGRIND_QEMU}" == "y" ];
then
- exec valgrind --log-file="${VALGRIND_LOGFILE}" --error-exitcode=99
"$QEMU_IO_PROG" $QEMU_IO_OPTIONS "$@";
+ exec valgrind --log-file="${VALGRIND_LOGFILE}" --error-exitcode=99
"$QEMU_IO_PROG" $QEMU_IO_ARGS "$@";
else
- exec "$QEMU_IO_PROG" $QEMU_IO_OPTIONS "$@";
+ exec "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@";
fi )
magic 0x514649fb
version 3
@@ -220,9 +220,9 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
wrote 131072/131072 bytes at offset 0
128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
./common.config: Killed ( if [ "${VALGRIND_QEMU}" == "y" ];
then
- exec valgrind --log-file="${VALGRIND_LOGFILE}" --error-exitcode=99
"$QEMU_IO_PROG" $QEMU_IO_OPTIONS "$@";
+ exec valgrind --log-file="${VALGRIND_LOGFILE}" --error-exitcode=99
"$QEMU_IO_PROG" $QEMU_IO_ARGS "$@";
else
- exec "$QEMU_IO_PROG" $QEMU_IO_OPTIONS "$@";
+ exec "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@";
fi )
magic 0x514649fb
version 3
diff --git a/tests/qemu-iotests/137.out b/tests/qemu-iotests/137.out
index 88c702c..c0e7534 100644
--- a/tests/qemu-iotests/137.out
+++ b/tests/qemu-iotests/137.out
@@ -32,9 +32,9 @@ Unsupported value 'blubb' for qcow2 option 'overlap-check'.
Allowed are any of t
wrote 512/512 bytes at offset 0
512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
./common.config: Killed ( if [ "${VALGRIND_QEMU}" == "y" ];
then
- exec valgrind --log-file="${VALGRIND_LOGFILE}" --error-exitcode=99
"$QEMU_IO_PROG" $QEMU_IO_OPTIONS "$@";
+ exec valgrind --log-file="${VALGRIND_LOGFILE}" --error-exitcode=99
"$QEMU_IO_PROG" $QEMU_IO_ARGS "$@";
else
- exec "$QEMU_IO_PROG" $QEMU_IO_OPTIONS "$@";
+ exec "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@";
fi )
incompatible_features 0x0
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
diff --git a/tests/qemu-iotests/common b/tests/qemu-iotests/common
index 49e1931..fe3b1a0 100644
--- a/tests/qemu-iotests/common
+++ b/tests/qemu-iotests/common
@@ -53,6 +53,7 @@ export QEMU_IO_OPTIONS=""
export CACHEMODE_IS_DEFAULT=true
export QEMU_OPTIONS="-nodefaults"
export VALGRIND_QEMU=
+export IMGOPTSSYNTAX=false
for r
do
@@ -399,7 +400,11 @@ BEGIN { for (t='$start'; t<='$end'; t++) printf
"%03d\n",t }' \
done
# Set qemu-io cache mode with $CACHEMODE we have
-QEMU_IO_OPTIONS="$QEMU_IO_OPTIONS -f $IMGFMT --cache $CACHEMODE"
+if [ "$IMGOPTSSYNTAX" = "true" ]; then
+ QEMU_IO_OPTIONS="$QEMU_IO_OPTIONS --cache $CACHEMODE"
+else
+ QEMU_IO_OPTIONS="$QEMU_IO_OPTIONS -f $IMGFMT --cache $CACHEMODE"
+fi
# Set default options for qemu-img create -o if they were not specified
_set_default_imgopts
diff --git a/tests/qemu-iotests/common.config b/tests/qemu-iotests/common.config
index f824651..ea698da 100644
--- a/tests/qemu-iotests/common.config
+++ b/tests/qemu-iotests/common.config
@@ -123,12 +123,16 @@ _qemu_img_wrapper()
_qemu_io_wrapper()
{
local VALGRIND_LOGFILE="${TEST_DIR}"/$$.valgrind
+ local QEMU_IO_ARGS="$QEMU_IO_OPTIONS"
+ if [ "$IMGOPTSSYNTAX" = "true" ]; then
+ QEMU_IO_ARGS="--image-opts $QEMU_IO_ARGS"
+ fi
local RETVAL
(
if [ "${VALGRIND_QEMU}" == "y" ]; then
- exec valgrind --log-file="${VALGRIND_LOGFILE}" --error-exitcode=99
"$QEMU_IO_PROG" $QEMU_IO_OPTIONS "$@"
+ exec valgrind --log-file="${VALGRIND_LOGFILE}" --error-exitcode=99
"$QEMU_IO_PROG" $QEMU_IO_ARGS "$@"
else
- exec "$QEMU_IO_PROG" $QEMU_IO_OPTIONS "$@"
+ exec "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@"
fi
)
RETVAL=$?
@@ -154,6 +158,13 @@ export QEMU_IMG=_qemu_img_wrapper
export QEMU_IO=_qemu_io_wrapper
export QEMU_NBD=_qemu_nbd_wrapper
+QEMU_IMG_EXTRA_ARGS=
+if [ "$IMGOPTSSYNTAX" = "true" ]; then
+ QEMU_IMG_EXTRA_ARGS="--image-opts $QEMU_IMG_EXTRA_ARGS"
+fi
+export QEMU_IMG_EXTRA_ARGS
+
+
default_machine=$($QEMU -machine help | sed -n '/(default)/ s/ .*//p')
default_alias_machine=$($QEMU -machine help | \
sed -n "/(alias of $default_machine)/ { s/ .*//p; q; }")
diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc
index 5249ec5..080f1bc 100644
--- a/tests/qemu-iotests/common.rc
+++ b/tests/qemu-iotests/common.rc
@@ -53,21 +53,42 @@ fi
# make sure we have a standard umask
umask 022
-if [ "$IMGPROTO" = "file" ]; then
- TEST_IMG=$TEST_DIR/t.$IMGFMT
-elif [ "$IMGPROTO" = "nbd" ]; then
- TEST_IMG_FILE=$TEST_DIR/t.$IMGFMT
- TEST_IMG="nbd:127.0.0.1:10810"
-elif [ "$IMGPROTO" = "ssh" ]; then
- TEST_IMG_FILE=$TEST_DIR/t.$IMGFMT
- TEST_IMG="ssh://127.0.0.1$TEST_IMG_FILE"
-elif [ "$IMGPROTO" = "nfs" ]; then
- TEST_DIR="nfs://127.0.0.1/$TEST_DIR"
- TEST_IMG=$TEST_DIR/t.$IMGFMT
-elif [ "$IMGPROTO" = "archipelago" ]; then
- TEST_IMG="archipelago:at.$IMGFMT"
+if [ "$IMGOPTSSYNTAX" = "true" ]; then
+ DRIVER="driver=$IMGFMT"
+ if [ "$IMGPROTO" = "file" ]; then
+ TEST_IMG_FILE=$TEST_DIR/t.$IMGFMT
+ TEST_IMG="$DRIVER,file.filename=$TEST_DIR/t.$IMGFMT"
+ elif [ "$IMGPROTO" = "nbd" ]; then
+ TEST_IMG_FILE=$TEST_DIR/t.$IMGFMT
+ TEST_IMG="$DRIVER,file.driver=nbd,file.host=127.0.0.1,file.port=10810"
+ elif [ "$IMGPROTO" = "ssh" ]; then
+ TEST_IMG_FILE=$TEST_DIR/t.$IMGFMT
+
TEST_IMG="$DRIVER,file.driver=ssh,file.host=127.0.0.1,file.path=$TEST_IMG_FILE"
+ elif [ "$IMGPROTO" = "nfs" ]; then
+
TEST_DIR="$DRIVER,file.driver=nfs,file.filename=nfs://127.0.0.1/$TEST_DIR"
+ TEST_IMG=$TEST_DIR_OPTS/t.$IMGFMT
+ elif [ "$IMGPROTO" = "archipelago" ]; then
+ TEST_IMG="$DRIVER,file.driver=archipelago,file.volume=:at.$IMGFMT"
+ else
+
TEST_IMG="$DRIVER,file.driver=$IMGPROTO,file.filename=$TEST_DIR/t.$IMGFMT"
+ fi
else
- TEST_IMG=$IMGPROTO:$TEST_DIR/t.$IMGFMT
+ if [ "$IMGPROTO" = "file" ]; then
+ TEST_IMG=$TEST_DIR/t.$IMGFMT
+ elif [ "$IMGPROTO" = "nbd" ]; then
+ TEST_IMG_FILE=$TEST_DIR/t.$IMGFMT
+ TEST_IMG="nbd:127.0.0.1:10810"
+ elif [ "$IMGPROTO" = "ssh" ]; then
+ TEST_IMG_FILE=$TEST_DIR/t.$IMGFMT
+ TEST_IMG="ssh://127.0.0.1$TEST_IMG_FILE"
+ elif [ "$IMGPROTO" = "nfs" ]; then
+ TEST_DIR="nfs://127.0.0.1/$TEST_DIR"
+ TEST_IMG=$TEST_DIR/t.$IMGFMT
+ elif [ "$IMGPROTO" = "archipelago" ]; then
+ TEST_IMG="archipelago:at.$IMGFMT"
+ else
+ TEST_IMG=$IMGPROTO:$TEST_DIR/t.$IMGFMT
+ fi
fi
_optstr_add()
@@ -199,7 +220,13 @@ _cleanup_test_img()
_check_test_img()
{
- $QEMU_IMG check "$@" -f $IMGFMT "$TEST_IMG" 2>&1 | _filter_testdir | \
+ (
+ if [ "$IMGOPTSSYNTAX" = "true" ]; then
+ $QEMU_IMG check $QEMU_IMG_EXTRA_ARGS "$@" "$TEST_IMG" 2>&1
+ else
+ $QEMU_IMG check "$@" -f $IMGFMT "$TEST_IMG" 2>&1
+ fi
+ ) | _filter_testdir | \
sed -e '/allocated.*fragmented.*compressed clusters/d' \
-e 's/qemu-img: This image format does not support checks/No
errors were found on the image./' \
-e '/Image end offset: [0-9]\+/d'
--
1.8.3.1
- [Qemu-devel] [PULL 59/69] qmp: add monitor command to add/remove a child, (continued)
- [Qemu-devel] [PULL 59/69] qmp: add monitor command to add/remove a child, Kevin Wolf, 2016/05/12
- [Qemu-devel] [PULL 36/69] xen_disk: Switch to byte-based aio block access, Kevin Wolf, 2016/05/12
- [Qemu-devel] [PULL 42/69] m25p80: Switch to byte-based block access, Kevin Wolf, 2016/05/12
- [Qemu-devel] [PULL 69/69] qemu-iotests: iotests: fail hard if not run via "check", Kevin Wolf, 2016/05/12
- [Qemu-devel] [PULL 43/69] atapi: Switch to byte-based block access, Kevin Wolf, 2016/05/12
- [Qemu-devel] [PULL 45/69] qemu-img: Switch to byte-based block access, Kevin Wolf, 2016/05/12
- [Qemu-devel] [PULL 52/69] block: Invalidate all children, Kevin Wolf, 2016/05/12
- [Qemu-devel] [PULL 55/69] iotests: fix the redirection order in 083, Kevin Wolf, 2016/05/12
- [Qemu-devel] [PULL 64/69] qemu-io: Add 'write -f' to test FUA flag, Kevin Wolf, 2016/05/12
- [Qemu-devel] [PULL 66/69] block: add support for --image-opts in block I/O tests,
Kevin Wolf <=
- [Qemu-devel] [PULL 67/69] block: add support for encryption secrets in block I/O tests, Kevin Wolf, 2016/05/12
- [Qemu-devel] [PULL 41/69] sd: Switch to byte-based block access, Kevin Wolf, 2016/05/12
- [Qemu-devel] [PULL 56/69] qemu-img: check block status of backing file when converting., Kevin Wolf, 2016/05/12
- [Qemu-devel] [PULL 53/69] block: Drop superfluous invalidating bs->file from drivers, Kevin Wolf, 2016/05/12
- [Qemu-devel] [PULL 57/69] Add new block driver interface to add/delete a BDS's child, Kevin Wolf, 2016/05/12
- [Qemu-devel] [PULL 54/69] block: Inactivate all children, Kevin Wolf, 2016/05/12
- [Qemu-devel] [PULL 65/69] qemu-io: Add 'write -z -u' to test MAY_UNMAP flag, Kevin Wolf, 2016/05/12
- [Qemu-devel] [PULL 62/69] qemu-io: Use bool for command line flags, Kevin Wolf, 2016/05/12
- [Qemu-devel] [PULL 58/69] quorum: implement bdrv_add_child() and bdrv_del_child(), Kevin Wolf, 2016/05/12
- [Qemu-devel] [PULL 61/69] qemu-io: Make 'open' subcommand more like command line, Kevin Wolf, 2016/05/12