From ee191fa807d79f53071c09c05d5229978b003a9c Mon Sep 17 00:00:00 2001 From: Michal Berger Date: Wed, 10 Feb 2021 11:58:10 +0100 Subject: [PATCH] test/vhost: Don't fetch .qcow2 image needed for tests Simply fail. It's expected to have this image already installed on the system. Signed-off-by: Michal Berger Change-Id: Ie7bbde84fe633c8b5a4d41bd6dcbee66d6f4a0c5 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6375 Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins Reviewed-by: Tomasz Zawadzki Reviewed-by: Jim Harris --- test/vhost/common.sh | 21 ++++++++------------- test/vhost/manual.sh | 8 +------- test/vhost/vhost.sh | 8 +------- 3 files changed, 10 insertions(+), 27 deletions(-) diff --git a/test/vhost/common.sh b/test/vhost/common.sh index 3e092b887..260ac23d4 100644 --- a/test/vhost/common.sh +++ b/test/vhost/common.sh @@ -8,7 +8,7 @@ VM_DIR=$VHOST_DIR/vms TARGET_DIR=$VHOST_DIR/vhost VM_PASSWORD="root" -VM_IMAGE=$HOME/spdk_test_image.qcow2 +VM_IMAGE=${VM_IMAGE:-"$HOME/spdk_test_image.qcow2"} if ! hash $QEMU_IMG_BIN $QEMU_BIN; then error 'QEMU is not installed on this system. Unable to run vhost tests.' @@ -27,22 +27,17 @@ source $rootdir/test/vhost/common/autotest.config function vhosttestinit() { if [ "$TEST_MODE" == "iso" ]; then $rootdir/scripts/setup.sh + fi - # Look for the VM image - if [[ ! -f $VM_IMAGE ]]; then - echo "VM image not found at $VM_IMAGE" - echo "Download to $HOME? [yn]" - read -r download - if [ "$download" = "y" ]; then - curl https://ci.spdk.io/download/test_resources/vhost_vm_image.tar.gz | tar xz -C $HOME - fi - fi + if [[ -e $VM_IMAGE.gz ]]; then + gzip -dc "$VM_IMAGE.gz" > "$VM_IMAGE" fi # Look for the VM image - if [[ "$1" != "--no_vm" ]] && [[ ! -f $VM_IMAGE ]]; then - error "VM image not found at $VM_IMAGE" - exit 1 + if [[ ! -f $VM_IMAGE ]]; then + [[ $1 != "--no_vm" ]] || return 0 + echo "$VM_IMAGE is missing" >&2 + return 1 fi } diff --git a/test/vhost/manual.sh b/test/vhost/manual.sh index 7f6792509..54c3d981c 100755 --- a/test/vhost/manual.sh +++ b/test/vhost/manual.sh @@ -36,13 +36,7 @@ if [[ $(uname -s) != Linux ]]; then fi : ${FIO_BIN="$DEFAULT_FIO_BIN"} - -if [[ ! -r "${VM_IMAGE}" ]]; then - echo "" - echo "ERROR: VM image '${VM_IMAGE}' does not exist." - echo "" - exit 1 -fi +vhosttestinit WORKDIR=$(readlink -f $(dirname $0)) diff --git a/test/vhost/vhost.sh b/test/vhost/vhost.sh index e53bb9887..3693ba323 100755 --- a/test/vhost/vhost.sh +++ b/test/vhost/vhost.sh @@ -15,13 +15,7 @@ fi DEFAULT_FIO_BIN="/home/sys_sgsw/fio_ubuntu" : ${FIO_BIN="$DEFAULT_FIO_BIN"} - -if [[ ! -r "${VM_IMAGE}" ]]; then - echo "" - echo "ERROR: VM image '${VM_IMAGE}' does not exist." - echo "" - exit 1 -fi +vhosttestinit WORKDIR=$(readlink -f $(dirname $0))