nvmf/vfio_user: disable vfio_user by default

Users can use "--with-vfio-user" to enable it when testing it.
For CI configuration, we add a new test flag SPDK_TEST_VFIOUSER
to enable CI tests.

Change-Id: Id284df721171d01cc52491ebf4088bcc17eee147
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6139
Community-CI: Broadcom CI
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Changpeng Liu 2021-01-28 18:27:57 +08:00 committed by Tomasz Zawadzki
parent f58b29784a
commit 3b673b8431
6 changed files with 24 additions and 30 deletions

2
CONFIG
View File

@ -121,7 +121,7 @@ CONFIG_VHOST=y
CONFIG_VIRTIO=y
# Build custom vfio-user transport for NVMf target and NVMe initiator.
CONFIG_VFIO_USER=y
CONFIG_VFIO_USER=n
# Build with PMDK backends
CONFIG_PMDK=n

42
configure vendored
View File

@ -454,36 +454,22 @@ else
fi
BUILD_CMD+=(-I/usr/local/include -L/usr/local/lib)
function set_os_id_version() {
if [[ -f /etc/os-release ]]; then
source /etc/os-release
fi
OSID=$ID
OSVERSION=$VERSION_ID
echo "OS-ID: $OSID | OS-Version: $OSVERSION"
}
if [[ "${CONFIG[VFIO_USER]}" = "y" ]]; then
set_os_id_version
if [[ $arch != x86_64* ]] || [[ $sys_name == "FreeBSD" ]]; then
echo "Non x86_64 and Linux platform, disable CONFIG_VFIO_USER"
CONFIG[VFIO_USER]="n"
# disable tests on ubuntu16 due to lack of macro definition in pci_regs.h
elif [[ $OSID == "ubuntu" ]] && [[ $OSVERSION == "16.04" ]]; then
echo "ubuntu16 OS, disable CONFIG_VFIO_USER"
CONFIG[VFIO_USER]="n"
elif ! hash cmake; then
echo "cmake not installed, disable CONFIG_VFIO_USER"
CONFIG[VFIO_USER]="n"
elif [[ ! -d /usr/include/json-c ]] && [[ ! -d /usr/local/include/json-c ]]; then
echo "json-c-devel not installed, disable CONFIG_VFIO_USER"
CONFIG[VFIO_USER]="n"
elif [[ ! -e /usr/include/cmocka.h ]] && [[ ! -e /usr/local/include/cmocka.h ]]; then
echo "libcmocka-devel not installed, disable CONFIG_VFIO_USER"
CONFIG[VFIO_USER]="n"
if ! hash cmake; then
echo "ERROR: --with-vfio-user requires cmake"
echo "Please install then re-run this script"
exit 1
fi
if [[ ! -d /usr/include/json-c ]] && [[ ! -d /usr/local/include/json-c ]]; then
echo "ERROR: --with-vfio-user requires json-c-devel"
echo "Please install then re-run this script"
exit 1
fi
if [[ ! -e /usr/include/cmocka.h ]] && [[ ! -e /usr/local/include/cmocka.h ]]; then
echo "ERROR: --with-vfio-user requires libcmocka-devel"
echo "Please install then re-run this script"
exit 1
fi
fi

View File

@ -9,6 +9,7 @@ SPDK_TEST_ISCSI_INITIATOR=0
SPDK_TEST_NVME=0
SPDK_TEST_NVME_CLI=0
SPDK_TEST_NVMF=1
SPDK_TEST_VFIOUSER=1
SPDK_TEST_RBD=0
SPDK_TEST_CRYPTO=0
SPDK_TEST_OCF=0

View File

@ -81,6 +81,8 @@ export SPDK_TEST_NVME_CLI
export SPDK_TEST_NVME_CUSE
: ${SPDK_TEST_NVMF=0}
export SPDK_TEST_NVMF
: ${SPDK_TEST_VFIOUSER=0}
export SPDK_TEST_VFIOUSER
: ${SPDK_TEST_NVMF_TRANSPORT="rdma"}
export SPDK_TEST_NVMF_TRANSPORT
: ${SPDK_TEST_RBD=0}
@ -422,6 +424,10 @@ function get_config_params() {
config_params+=' --with-raid5'
fi
if [ $SPDK_TEST_VFIOUSER -eq 1 ]; then
config_params+=' --with-vfio-user'
fi
# Check whether liburing library header exists
if [ -f /usr/include/liburing/io_uring.h ] && [ $SPDK_TEST_URING -eq 1 ]; then
config_params+=' --with-uring'

View File

@ -185,6 +185,7 @@ SPDK_TEST_ISCSI_INITIATOR=1
SPDK_TEST_NVME=1
SPDK_TEST_NVME_CLI=1
SPDK_TEST_NVMF=1
SPDK_TEST_VFIOUSER=1
SPDK_TEST_RBD=1
SPDK_TEST_BLOCKDEV=1
SPDK_TEST_BLOBFS=1

View File

@ -41,7 +41,7 @@ run_test "nvmf_invalid" test/nvmf/target/invalid.sh "${TEST_ARGS[@]}"
run_test "nvmf_abort" test/nvmf/target/abort.sh "${TEST_ARGS[@]}"
run_test "nvmf_ns_hotplug_stress" test/nvmf/target/ns_hotplug_stress.sh "${TEST_ARGS[@]}"
if grep -q '#define SPDK_CONFIG_VFIO_USER 1' $rootdir/include/spdk/config.h; then
if [ $SPDK_TEST_VFIOUSER -eq 1 ]; then
run_test "nvmf_vfio_user" test/nvmf/target/nvmf_vfio_user.sh "${TEST_ARGS[@]}"
fi