diff --git a/test/common/autotest_common.sh b/test/common/autotest_common.sh index dc44249af..9c33b7669 100755 --- a/test/common/autotest_common.sh +++ b/test/common/autotest_common.sh @@ -226,6 +226,10 @@ fi export SPDK_BIN_DIR="$rootdir/build/bin" export SPDK_EXAMPLE_DIR="$rootdir/build/examples" +# for vhost, vfio-user tests +export QEMU_BIN=${QEMU_BIN:-} +export VFIO_QEMU_BIN=${VFIO_QEMU_BIN:-} + # pass our valgrind desire on to unittest.sh if [ $SPDK_RUN_VALGRIND -eq 0 ]; then export valgrind='' diff --git a/test/vfio_user/common.sh b/test/vfio_user/common.sh index 4176c3d9d..73ab3bf4b 100644 --- a/test/vfio_user/common.sh +++ b/test/vfio_user/common.sh @@ -1,8 +1,17 @@ : ${MALLOC_BDEV_SIZE=256} : ${MALLOC_BLOCK_SIZE=512} +source "$rootdir/test/vhost/common.sh" + # Verify vfio-user support of qemu. -QEMU_BIN="/usr/local/qemu/vfio-user-dbfix/bin/qemu-system-x86_64" +VFIO_QEMU_BIN=${VFIO_QEMU_BIN:-/usr/local/qemu/vfio-user-dbfix/bin/qemu-system-x86_64} + +if [[ ! -e $VFIO_QEMU_BIN ]]; then + error "$VFIO_QEMU_BIN QEMU not found, cannot run the vfio-user tests" + return 1 +fi + +QEMU_BIN=$VFIO_QEMU_BIN function clean_vfio_user() { trap - ERR diff --git a/test/vfio_user/vfio_user.sh b/test/vfio_user/vfio_user.sh index dd19603d7..479d54669 100755 --- a/test/vfio_user/vfio_user.sh +++ b/test/vfio_user/vfio_user.sh @@ -2,7 +2,6 @@ testdir=$(readlink -f $(dirname $0)) rootdir=$(readlink -f $testdir/../..) source $rootdir/test/common/autotest_common.sh -source $rootdir/test/vhost/common.sh source $rootdir/test/vfio_user/common.sh echo "Running SPDK vfio-user fio autotest..." diff --git a/test/vfio_user/vfio_user_fio/vfio_user_fio.sh b/test/vfio_user/vfio_user_fio/vfio_user_fio.sh index 77c9dbf92..c0c78df5d 100755 --- a/test/vfio_user/vfio_user_fio/vfio_user_fio.sh +++ b/test/vfio_user/vfio_user_fio/vfio_user_fio.sh @@ -3,7 +3,6 @@ testdir=$(readlink -f $(dirname $0)) rootdir=$(readlink -f $testdir/../../..) source $rootdir/test/common/autotest_common.sh -source $rootdir/test/vhost/common.sh source $rootdir/test/vfio_user/common.sh rpc_py="$rootdir/scripts/rpc.py -s $(get_vhost_dir 0)/rpc.sock" diff --git a/test/vfio_user/vfio_user_restart_vm/vfio_user_restart_vm.sh b/test/vfio_user/vfio_user_restart_vm/vfio_user_restart_vm.sh index 33d7dcb3e..9d9619e92 100755 --- a/test/vfio_user/vfio_user_restart_vm/vfio_user_restart_vm.sh +++ b/test/vfio_user/vfio_user_restart_vm/vfio_user_restart_vm.sh @@ -2,7 +2,6 @@ testdir=$(readlink -f $(dirname $0)) rootdir=$(readlink -f $testdir/../../..) source $rootdir/test/common/autotest_common.sh -source $rootdir/test/vhost/common.sh source $rootdir/test/vfio_user/common.sh bdfs=($(get_nvme_bdfs)) diff --git a/test/vhost/common.sh b/test/vhost/common.sh index c989772b8..59f629c81 100644 --- a/test/vhost/common.sh +++ b/test/vhost/common.sh @@ -1,6 +1,6 @@ : ${SPDK_VHOST_VERBOSE=false} : ${VHOST_DIR="$HOME/vhost_test"} -: ${QEMU_BIN="qemu-system-x86_64"} +: ${QEMU_BIN:="qemu-system-x86_64"} : ${QEMU_IMG_BIN="qemu-img"} TEST_DIR=$(readlink -f $rootdir/..)