1#!/usr/bin/env bash 2# SPDX-License-Identifier: BSD-3-Clause 3# Copyright (C) 2017 Intel Corporation 4# All rights reserved. 5# 6testdir=$(readlink -f $(dirname $0)) 7rootdir=$(readlink -f $testdir/../..) 8source $rootdir/test/common/autotest_common.sh 9source $rootdir/test/vhost/common.sh 10 11case $1 in 12 -h | --help) 13 echo "usage: $(basename $0) TEST_TYPE" 14 echo "Test type can be:" 15 echo " -p |--performance for running a performance test with vhost scsi" 16 echo " -pb|--performance-blk for running a performance test with vhost blk" 17 echo " -hp|--hotplug for running hotplug tests" 18 echo " -shr|--scsi-hot-remove for running scsi hot remove tests" 19 echo " -bhr|--blk-hot-remove for running blk hot remove tests" 20 echo " -h |--help prints this message" 21 echo "" 22 echo "Environment:" 23 echo " VM_IMAGE path to QCOW2 VM image used during test (default: $DEPENDENCY_DIR/vhost/spdk_test_image.qcow2)" 24 echo "" 25 echo "Tests are performed only on Linux machine. For other OS no action is performed." 26 echo "" 27 exit 0 28 ;; 29esac 30 31echo "Running SPDK vhost fio autotest..." 32if [[ $(uname -s) != Linux ]]; then 33 echo "" 34 echo "INFO: Vhost tests are only for Linux machine." 35 echo "" 36 exit 0 37fi 38 39vhosttestinit 40 41case $1 in 42 -hp | --hotplug) 43 echo 'Running hotplug tests suite...' 44 run_test "vhost_hotplug" $WORKDIR/hotplug/scsi_hotplug.sh --fio-bin=$FIO_BIN \ 45 --vm=0,$VM_IMAGE,Nvme0n1p0:Nvme0n1p1 \ 46 --vm=1,$VM_IMAGE,Nvme0n1p2:Nvme0n1p3 \ 47 --vm=2,$VM_IMAGE,Nvme0n1p4:Nvme0n1p5 \ 48 --vm=3,$VM_IMAGE,Nvme0n1p6:Nvme0n1p7 \ 49 --test-type=spdk_vhost_scsi \ 50 --fio-jobs=$WORKDIR/hotplug/fio_jobs/default_integrity.job -x 51 ;; 52 -shr | --scsi-hot-remove) 53 echo 'Running scsi hotremove tests suite...' 54 run_test "vhost_scsi_hot_remove" $WORKDIR/hotplug/scsi_hotplug.sh --fio-bin=$FIO_BIN \ 55 --vm=0,$VM_IMAGE,Nvme0n1p0:Nvme0n1p1 \ 56 --vm=1,$VM_IMAGE,Nvme0n1p2:Nvme0n1p3 \ 57 --test-type=spdk_vhost_scsi \ 58 --scsi-hotremove-test \ 59 --fio-jobs=$WORKDIR/hotplug/fio_jobs/default_integrity.job 60 ;; 61 -bhr | --blk-hot-remove) 62 echo 'Running blk hotremove tests suite...' 63 run_test "vhost_blk_hot_remove" $WORKDIR/hotplug/scsi_hotplug.sh --fio-bin=$FIO_BIN \ 64 --vm=0,$VM_IMAGE,Nvme0n1p0:Nvme0n1p1 \ 65 --vm=1,$VM_IMAGE,Nvme0n1p2:Nvme0n1p3 \ 66 --test-type=spdk_vhost_blk \ 67 --blk-hotremove-test \ 68 --fio-jobs=$WORKDIR/hotplug/fio_jobs/default_integrity.job 69 ;; 70 *) 71 echo "unknown test type: $1" 72 exit 1 73 ;; 74esac 75