mirror of
https://gitlab.com/qemu-project/qemu
synced 2024-11-05 20:35:44 +00:00
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>
This commit is contained in:
parent
3817ce03bf
commit
cce293a294
4 changed files with 50 additions and 49 deletions
|
@ -48,6 +48,14 @@ set_prog_path()
|
|||
fi
|
||||
}
|
||||
|
||||
if [ -z "$TEST_DIR" ]; then
|
||||
TEST_DIR=`pwd`/scratch
|
||||
fi
|
||||
|
||||
if [ ! -e "$TEST_DIR" ]; then
|
||||
mkdir "$TEST_DIR"
|
||||
fi
|
||||
|
||||
diff="diff -u"
|
||||
verbose=false
|
||||
debug=false
|
||||
|
@ -440,6 +448,13 @@ if [ "$IMGFMT" == "luks" ] && ! (echo "$IMGOPTS" | grep "iter-time=" > /dev/null
|
|||
IMGOPTS=$(_optstr_add "$IMGOPTS" "iter-time=10")
|
||||
fi
|
||||
|
||||
if [ -z "$SAMPLE_IMG_DIR" ]; then
|
||||
SAMPLE_IMG_DIR="$source_iotests/sample_images"
|
||||
fi
|
||||
|
||||
export TEST_DIR
|
||||
export SAMPLE_IMG_DIR
|
||||
|
||||
if [ -s $tmp.list ]
|
||||
then
|
||||
# found some valid test numbers ... this is good
|
||||
|
@ -524,3 +539,12 @@ if [ -x "$build_iotests/socket_scm_helper" ]
|
|||
then
|
||||
export SOCKET_SCM_HELPER="$build_iotests/socket_scm_helper"
|
||||
fi
|
||||
|
||||
default_machine=$($QEMU_PROG -machine help | sed -n '/(default)/ s/ .*//p')
|
||||
default_alias_machine=$($QEMU_PROG -machine help | \
|
||||
sed -n "/(alias of $default_machine)/ { s/ .*//p; q; }")
|
||||
if [[ "$default_alias_machine" ]]; then
|
||||
default_machine="$default_alias_machine"
|
||||
fi
|
||||
|
||||
export QEMU_DEFAULT_MACHINE="$default_machine"
|
||||
|
|
|
@ -26,8 +26,6 @@ arch=`uname -m`
|
|||
|
||||
export PWD=`pwd`
|
||||
|
||||
export _QEMU_HANDLE=0
|
||||
|
||||
# make sure we have a standard umask
|
||||
umask 022
|
||||
|
||||
|
@ -40,52 +38,5 @@ _optstr_add()
|
|||
fi
|
||||
}
|
||||
|
||||
QEMU_IMG_EXTRA_ARGS=
|
||||
if [ "$IMGOPTSSYNTAX" = "true" ]; then
|
||||
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
|
||||
fi
|
||||
export QEMU_IMG_EXTRA_ARGS
|
||||
|
||||
|
||||
default_machine=$($QEMU_PROG -machine help | sed -n '/(default)/ s/ .*//p')
|
||||
default_alias_machine=$($QEMU_PROG -machine help | \
|
||||
sed -n "/(alias of $default_machine)/ { s/ .*//p; q; }")
|
||||
if [[ "$default_alias_machine" ]]; then
|
||||
default_machine="$default_alias_machine"
|
||||
fi
|
||||
|
||||
export QEMU_DEFAULT_MACHINE="$default_machine"
|
||||
|
||||
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
|
||||
|
||||
export TEST_DIR
|
||||
|
||||
if [ -z "$SAMPLE_IMG_DIR" ]; then
|
||||
SAMPLE_IMG_DIR="$source_iotests/sample_images"
|
||||
fi
|
||||
|
||||
if [ ! -d "$SAMPLE_IMG_DIR" ]; then
|
||||
echo "common.config: Error: \$SAMPLE_IMG_DIR ($SAMPLE_IMG_DIR) is not a directory"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
export SAMPLE_IMG_DIR
|
||||
|
||||
# make sure this script returns success
|
||||
true
|
||||
|
|
|
@ -31,6 +31,7 @@ QEMU_FIFO_IN="${QEMU_TEST_DIR}/qmp-in-$$"
|
|||
QEMU_FIFO_OUT="${QEMU_TEST_DIR}/qmp-out-$$"
|
||||
|
||||
QEMU_HANDLE=0
|
||||
export _QEMU_HANDLE=0
|
||||
|
||||
# If bash version is >= 4.1, these will be overwritten and dynamic
|
||||
# file descriptor values assigned.
|
||||
|
|
|
@ -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}"
|
||||
|
|
Loading…
Reference in a new issue