numam-spdk/test/vfio_user/common.sh
Mao Jiang a0d255ac02 test/vfio_user: Build vfio-user test directory
Add test script for launching VMs with vfio-user transport,
this test script not active until vfio-user capable qemu available,
new flag SPDK_TEST_VFIOUSER_QEMU will decide case whether to run.

Change-Id: I9b885cec797fe3bb28860f1ec436c31a6fa2f131
Signed-off-by: Mao Jiang <maox.jiang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/10096
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Michal Berger <michalx.berger@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2021-12-31 10:10:24 +00:00

39 lines
877 B
Bash

: ${MALLOC_BDEV_SIZE=256}
: ${MALLOC_BLOCK_SIZE=512}
# Verify vfio-user support of qemu.
QEMU_BIN="/usr/local/qemu/vfio-user-v0.93/bin/qemu-system-x86_64"
function clean_vfio_user() {
trap - ERR
print_backtrace
set +e
error "Error on $1 $2"
vm_kill_all
vhost_kill 0
exit 1
}
function vfio_user_run() {
local vhost_name=$1
local vfio_user_dir nvmf_pid_file rpc_py
vfio_user_dir=$(get_vhost_dir $vhost_name)
nvmf_pid_file="$vfio_user_dir/vhost.pid"
rpc_py="$rootdir/scripts/rpc.py -s $vfio_user_dir/rpc.sock"
mkdir -p $vfio_user_dir
timing_enter vfio_user_start
$rootdir/build/bin/nvmf_tgt -r $vfio_user_dir/rpc.sock -m 0x1 &
nvmfpid=$!
echo $nvmfpid > $nvmf_pid_file
echo "Process pid: $nvmfpid"
echo "waiting for app to run..."
waitforlisten $nvmfpid $vfio_user_dir/rpc.sock
$rpc_py nvmf_create_transport -t VFIOUSER
timing_exit vfio_user_start
}