xref: /spdk/test/vhost/manual.sh (revision 06b537bfdb4393dea857e204b85d8df46a351d8a)
1#!/usr/bin/env bash
2
3testdir=$(readlink -f $(dirname $0))
4rootdir=$(readlink -f $testdir/../..)
5source $rootdir/test/common/autotest_common.sh
6source $rootdir/test/vhost/common.sh
7
8CENTOS_VM_IMAGE="/home/sys_sgsw/spdk_vhost_CentOS_vm_image.qcow2"
9DEFAULT_FIO_BIN="/home/sys_sgsw/fio_ubuntu"
10CENTOS_FIO_BIN="/home/sys_sgsw/fio_ubuntu_bak"
11
12case $1 in
13	-h | --help)
14		echo "usage: $(basename $0) TEST_TYPE"
15		echo "Test type can be:"
16		echo "  -p |--performance                    for running a performance test with vhost scsi"
17		echo "  -pb|--performance-blk                for running a performance test with vhost blk"
18		echo "  -hp|--hotplug                        for running hotplug tests"
19		echo "  -shr|--scsi-hot-remove               for running scsi hot remove tests"
20		echo "  -bhr|--blk-hot-remove                for running blk hot remove tests"
21		echo "  -h |--help                           prints this message"
22		echo ""
23		echo "Environment:"
24		echo "  VM_IMAGE        path to QCOW2 VM image used during test (default: $HOME/vhost_vm_image.qcow2)"
25		echo ""
26		echo "Tests are performed only on Linux machine. For other OS no action is performed."
27		echo ""
28		exit 0
29		;;
30esac
31
32echo "Running SPDK vhost fio autotest..."
33if [[ $(uname -s) != Linux ]]; then
34	echo ""
35	echo "INFO: Vhost tests are only for Linux machine."
36	echo ""
37	exit 0
38fi
39
40: ${FIO_BIN="$DEFAULT_FIO_BIN"}
41
42if [[ ! -r "${VM_IMAGE}" ]]; then
43	echo ""
44	echo "ERROR: VM image '${VM_IMAGE}' does not exist."
45	echo ""
46	exit 1
47fi
48
49DISKS_NUMBER=$(lspci -mm -n | grep 0108 | tr -d '"' | awk -F " " '{print "0000:"$1}' | wc -l)
50
51WORKDIR=$(readlink -f $(dirname $0))
52
53case $1 in
54	-hp | --hotplug)
55		echo 'Running hotplug tests suite...'
56		run_test "vhost_hotplug" $WORKDIR/hotplug/scsi_hotplug.sh --fio-bin=$FIO_BIN \
57			--vm=0,$VM_IMAGE,Nvme0n1p0:Nvme0n1p1 \
58			--vm=1,$VM_IMAGE,Nvme0n1p2:Nvme0n1p3 \
59			--vm=2,$VM_IMAGE,Nvme0n1p4:Nvme0n1p5 \
60			--vm=3,$VM_IMAGE,Nvme0n1p6:Nvme0n1p7 \
61			--test-type=spdk_vhost_scsi \
62			--fio-jobs=$WORKDIR/hotplug/fio_jobs/default_integrity.job -x
63		;;
64	-shr | --scsi-hot-remove)
65		echo 'Running scsi hotremove tests suite...'
66		run_test "vhost_scsi_hot_remove" $WORKDIR/hotplug/scsi_hotplug.sh --fio-bin=$FIO_BIN \
67			--vm=0,$VM_IMAGE,Nvme0n1p0:Nvme0n1p1 \
68			--vm=1,$VM_IMAGE,Nvme0n1p2:Nvme0n1p3 \
69			--test-type=spdk_vhost_scsi \
70			--scsi-hotremove-test \
71			--fio-jobs=$WORKDIR/hotplug/fio_jobs/default_integrity.job
72		;;
73	-bhr | --blk-hot-remove)
74		echo 'Running blk hotremove tests suite...'
75		run_test "vhost_blk_hot_remove" $WORKDIR/hotplug/scsi_hotplug.sh --fio-bin=$FIO_BIN \
76			--vm=0,$VM_IMAGE,Nvme0n1p0:Nvme0n1p1 \
77			--vm=1,$VM_IMAGE,Nvme0n1p2:Nvme0n1p3 \
78			--test-type=spdk_vhost_blk \
79			--blk-hotremove-test \
80			--fio-jobs=$WORKDIR/hotplug/fio_jobs/default_integrity.job
81		;;
82	*)
83		echo "unknown test type: $1"
84		exit 1
85		;;
86esac
87