From 5502294d76cd68a761a6bc0dd6d294e3a896c1fb Mon Sep 17 00:00:00 2001 From: Ben Walker Date: Tue, 4 Jun 2019 12:15:46 -0700 Subject: [PATCH] test/vhost: Use whichever qemu is installed on the system Don't use a fork of QEMU that's in a specific directory. On the test systems, we can install the forked QEMU as the default QEMU and put the binaries in PATH so that it works. Change-Id: I637d70452901c85606eb5eeb2bf6c67ae98cd92f Signed-off-by: Ben Walker Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/458597 Tested-by: SPDK CI Jenkins Reviewed-by: Darek Stojaczyk Reviewed-by: Changpeng Liu Reviewed-by: Shuhei Matsumoto --- test/vhost/common.sh | 11 ++++------- test/vhost/vhost_boot/vhost_boot.sh | 2 +- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/test/vhost/common.sh b/test/vhost/common.sh index 531eea4b8..96d5ba257 100644 --- a/test/vhost/common.sh +++ b/test/vhost/common.sh @@ -1,15 +1,12 @@ : ${SPDK_VHOST_VERBOSE=false} -: ${QEMU_PREFIX="/usr/local/qemu/spdk-3.0.0"} : ${VM_IMAGE="$HOME/vhost_vm_image.qcow2"} TEST_DIR=$(readlink -f $rootdir/..) -#Check if qemu exists -if [ ! -d $QEMU_PREFIX ]; then - error "Qemu not installed on this machine." +if ! hash qemu-img qemu-system-x86_64; then + error 'QEMU is not installed on this system. Unable to run vhost tests.' exit 1 fi -echo "Using qemu folder $QEMU_PREFIX" VM_BASE_DIR="$TEST_DIR/vms" @@ -617,7 +614,7 @@ function vm_setup() if [[ "$os_mode" == "backing" ]]; then notice "Creating backing file for OS image file: $os" - if ! $QEMU_PREFIX/bin/qemu-img create -f qcow2 -b $os $vm_dir/os.qcow2; then + if ! qemu-img create -f qcow2 -b $os $vm_dir/os.qcow2; then error "Failed to create OS backing file in '$vm_dir/os.qcow2' using '$os'" return 1 fi @@ -650,7 +647,7 @@ function vm_setup() local task_mask=${!qemu_mask_param} notice "TASK MASK: $task_mask" - local cmd="taskset -a -c $task_mask $QEMU_PREFIX/bin/qemu-system-x86_64 ${eol}" + local cmd="taskset -a -c $task_mask qemu-system-x86_64 ${eol}" local vm_socket_offset=$(( 10000 + 100 * vm_num )) local ssh_socket=$(( vm_socket_offset + 0 )) diff --git a/test/vhost/vhost_boot/vhost_boot.sh b/test/vhost/vhost_boot/vhost_boot.sh index 565e4815c..ac9aaa521 100755 --- a/test/vhost/vhost_boot/vhost_boot.sh +++ b/test/vhost/vhost_boot/vhost_boot.sh @@ -73,7 +73,7 @@ timing_enter convert_vm_image modprobe nbd trap 'nbd_stop_disks $(get_vhost_dir)/rpc.sock /dev/nbd0; err_clean "${FUNCNAME}" "${LINENO}"' ERR nbd_start_disks "$(get_vhost_dir)/rpc.sock" $lvb_u /dev/nbd0 -$QEMU_PREFIX/bin/qemu-img convert $os_image -O raw /dev/nbd0 +qemu-img convert $os_image -O raw /dev/nbd0 sync nbd_stop_disks $(get_vhost_dir)/rpc.sock /dev/nbd0 sleep 1