From fdb03395dba607c4f08231f0d37c193f30d7f2b1 Mon Sep 17 00:00:00 2001 From: yidong0635 Date: Thu, 6 Jun 2019 10:25:52 -0400 Subject: [PATCH] nvmf_vhost: Check qemu before and in vhost/common.sh. Normal return for qemu checking , this should check before vhost/common.sh. For qemu not installed on this machine. It may be a VM. Skipping nvmf_vhost test. Otherwise, code will exit 1 before this normal return. And in vhost/common.sh should with qemu checking. Change-Id: I2285fffa6fc4384b4b172e5c443019e9ab391fa0 Signed-off-by: yidong0635 Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/456123 Tested-by: SPDK CI Jenkins Reviewed-by: Darek Stojaczyk Reviewed-by: Ben Walker --- test/nvmf/target/nvmf_vhost.sh | 11 ++++++----- test/vhost/common.sh | 7 +++++++ 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/test/nvmf/target/nvmf_vhost.sh b/test/nvmf/target/nvmf_vhost.sh index edbc64d0f..5ed416b74 100755 --- a/test/nvmf/target/nvmf_vhost.sh +++ b/test/nvmf/target/nvmf_vhost.sh @@ -5,6 +5,12 @@ testdir=$(readlink -f $(dirname $0)) rootdir=$testdir/../../.. source $rootdir/test/common/autotest_common.sh source $rootdir/test/nvmf/common.sh + +if [ ! -d "/usr/local/qemu/spdk-3.0.0" ]; then + echo "Qemu not installed on this machine. It may be a VM. Skipping nvmf_vhost test." + exit 0 +fi + source $rootdir/test/vhost/common.sh MALLOC_BDEV_SIZE=128 @@ -17,11 +23,6 @@ VHOST_APP="$rootdir/app/vhost/vhost -p 0 -r $VHOST_SOCK -u" VHOST_RPC="$rootdir/scripts/rpc.py -s $VHOST_SOCK" vm_image="/home/sys_sgsw/vhost_vm_image.qcow2" -if [ ! -d $QEMU_PREFIX ]; then - echo "qemu not installed on this machine. It may be a VM. Skipping nvmf_vhost test." - exit 0 -fi - timing_enter nvmf_vhost nvmftestinit diff --git a/test/vhost/common.sh b/test/vhost/common.sh index 2ac495f64..f35371fab 100644 --- a/test/vhost/common.sh +++ b/test/vhost/common.sh @@ -5,6 +5,13 @@ set -e TEST_DIR=$(readlink -f $rootdir/..) +#Check if qemu exists +if [ ! -d $QEMU_PREFIX ]; then + error "Qemu not installed on this machine." + exit 1 +fi +echo "Using qemu folder $QEMU_PREFIX" + # SSH key file : ${SPDK_VHOST_SSH_KEY_FILE="$(readlink -e $HOME/.ssh/spdk_vhost_id_rsa)"} if [[ ! -r "$SPDK_VHOST_SSH_KEY_FILE" ]]; then