aboutsummaryrefslogtreecommitdiff
path: root/tests/qemu-iotests/common.rc
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2017-09-12 16:44:56 +0200
committerKevin Wolf <kwolf@redhat.com>2017-10-06 16:28:58 +0200
commitcce293a29459e1fd5f74e55d87dc9c25991da578 (patch)
tree678b0609f67a54094bea588e7358e0ad4c8e5980 /tests/qemu-iotests/common.rc
parent3817ce03bf3373065c25e389ecb7f23a511ebcdc (diff)
qemu-iotests: disintegrate more parts of common.config
Split "check" parts from tests part. For the directory setup, the actual computation of directories goes in "check", while the sanity checks go in the tests. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'tests/qemu-iotests/common.rc')
-rw-r--r--tests/qemu-iotests/common.rc25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc
index 20f6821a69..f4dc0104e6 100644
--- a/tests/qemu-iotests/common.rc
+++ b/tests/qemu-iotests/common.rc
@@ -114,6 +114,10 @@ export QEMU_VXHS=_qemu_vxhs_wrapper
if [ "$IMGOPTSSYNTAX" = "true" ]; then
DRIVER="driver=$IMGFMT"
+ QEMU_IMG_EXTRA_ARGS="--image-opts $QEMU_IMG_EXTRA_ARGS"
+ if [ -n "$IMGKEYSECRET" ]; then
+ QEMU_IMG_EXTRA_ARGS="--object secret,id=keysec0,data=$IMGKEYSECRET $QEMU_IMG_EXTRA_ARGS"
+ fi
if [ "$IMGFMT" = "luks" ]; then
DRIVER="$DRIVER,key-secret=keysec0"
fi
@@ -133,6 +137,7 @@ if [ "$IMGOPTSSYNTAX" = "true" ]; then
TEST_IMG="$DRIVER,file.driver=$IMGPROTO,file.filename=$TEST_DIR/t.$IMGFMT"
fi
else
+ QEMU_IMG_EXTRA_ARGS=
if [ "$IMGPROTO" = "file" ]; then
TEST_IMG=$TEST_DIR/t.$IMGFMT
elif [ "$IMGPROTO" = "nbd" ]; then
@@ -153,6 +158,26 @@ else
fi
ORIG_TEST_IMG="$TEST_IMG"
+if [ -z "$TEST_DIR" ]; then
+ TEST_DIR=`pwd`/scratch
+fi
+
+QEMU_TEST_DIR="${TEST_DIR}"
+
+if [ ! -e "$TEST_DIR" ]; then
+ mkdir "$TEST_DIR"
+fi
+
+if [ ! -d "$TEST_DIR" ]; then
+ echo "common.config: Error: \$TEST_DIR ($TEST_DIR) is not a directory"
+ exit 1
+fi
+
+if [ ! -d "$SAMPLE_IMG_DIR" ]; then
+ echo "common.config: Error: \$SAMPLE_IMG_DIR ($SAMPLE_IMG_DIR) is not a directory"
+ exit 1
+fi
+
_use_sample_img()
{
SAMPLE_IMG_FILE="${1%\.bz2}"