test/vhost: restore possibility to use custom Qemu binaries

Use env variables to select custom qemu-img and qemu-system-x86_64
binaries. This is needed to test versus latest Qemu versions from
Github.
If env variable QEMU_BIN is not present then the defaults for test
are system-wide installed packages.

This partly reverts changes done in patch:
5502294d76
which removed possibility to run with custom Qemu binaries.

Change-Id: I8138a079ba7013dcd97aad95ae2eed6417f5b18c
Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/477776
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Maciej Wawryk <maciejx.wawryk@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Karol Latecki 2019-12-12 11:36:39 +01:00 committed by Tomasz Zawadzki
parent 94507133eb
commit b9395621ae

View File

@ -1,5 +1,7 @@
: ${SPDK_VHOST_VERBOSE=false}
: ${VHOST_DIR="$HOME/vhost_test"}
: ${QEMU_BIN="qemu-system-x86_64"}
: ${QEMU_IMG_BIN="qemu-img"}
TEST_DIR=$(readlink -f $rootdir/..)
VM_DIR=$VHOST_DIR/vms
@ -9,7 +11,7 @@ VM_PASSWORD="root"
#TODO: Move vhost_vm_image.qcow2 into VHOST_DIR on test systems.
VM_IMAGE=$HOME/vhost_vm_image.qcow2
if ! hash qemu-img qemu-system-x86_64; then
if ! hash $QEMU_IMG_BIN $QEMU_BIN; then
error 'QEMU is not installed on this system. Unable to run vhost tests.'
exit 1
fi
@ -615,7 +617,7 @@ function vm_setup()
if [[ "$os_mode" == "backing" ]]; then
notice "Creating backing file for OS image file: $os"
if ! qemu-img create -f qcow2 -b $os $vm_dir/os.qcow2; then
if ! $QEMU_IMG_BIN 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
@ -648,7 +650,7 @@ function vm_setup()
local task_mask=${!qemu_mask_param}
notice "TASK MASK: $task_mask"
local cmd="taskset -a -c $task_mask qemu-system-x86_64 ${eol}"
local cmd="taskset -a -c $task_mask $QEMU_BIN ${eol}"
local vm_socket_offset=$(( 10000 + 100 * vm_num ))
local ssh_socket=$(( vm_socket_offset + 0 ))