From c8f62d792a32beced54a1ba2870c4f067cf52c31 Mon Sep 17 00:00:00 2001 From: Michal Berger Date: Thu, 18 Aug 2022 18:11:35 +0200 Subject: [PATCH] test: Enable xnvme in autotest builds Signed-off-by: Michal Berger Change-Id: I32594d94eb397dfe1fcec867fd0caf67a07b208c Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14118 Community-CI: Mellanox Build Bot Reviewed-by: Ben Walker Reviewed-by: Tomasz Zawadzki Reviewed-by: Dong Yi Reviewed-by: Konrad Sztyber Tested-by: SPDK CI Jenkins --- autobuild.sh | 4 ++++ mk/spdk.lib_deps.mk | 1 + scripts/ar-xnvme-fixer | 30 ++++++++++++++++++++++++++++++ test/common/autotest_common.sh | 12 ++++++++++++ 4 files changed, 47 insertions(+) create mode 100755 scripts/ar-xnvme-fixer diff --git a/autobuild.sh b/autobuild.sh index 4a668916f..9c08e9e13 100755 --- a/autobuild.sh +++ b/autobuild.sh @@ -24,6 +24,10 @@ if [ -n "$SPDK_TEST_NATIVE_DPDK" ]; then else scanbuild_exclude="--exclude $rootdir/dpdk/" fi +# We exclude /tmp as it's used by xnvme's liburing subproject for storing +# temporary .c files which are picked up as buggy by the scanbuild. +scanbuild_exclude+=" --exclude $rootdir/xnvme --exclude /tmp" + scanbuild="scan-build -o $output_dir/scan-build-tmp $scanbuild_exclude --status-bugs" config_params=$(get_config_params) diff --git a/mk/spdk.lib_deps.mk b/mk/spdk.lib_deps.mk index aa2960b0a..705318e83 100644 --- a/mk/spdk.lib_deps.mk +++ b/mk/spdk.lib_deps.mk @@ -135,6 +135,7 @@ DEPDIRS-bdev_rbd := $(BDEV_DEPS_THREAD) DEPDIRS-bdev_uring := $(BDEV_DEPS_THREAD) DEPDIRS-bdev_virtio := $(BDEV_DEPS_THREAD) virtio DEPDIRS-bdev_zone_block := $(BDEV_DEPS_THREAD) +DEPDIRS-bdev_xnvme := $(BDEV_DEPS_THREAD) # module/event diff --git a/scripts/ar-xnvme-fixer b/scripts/ar-xnvme-fixer new file mode 100755 index 000000000..462e3d06d --- /dev/null +++ b/scripts/ar-xnvme-fixer @@ -0,0 +1,30 @@ +#!/usr/bin/env bash +# The xnvme build executes library_bundler.py which wraps itself around ar +# to create libxnvme.a. It builds a set of MRI commands which then is +# passed to ar via stdin. The set of members is declared via ADDLIB +# followed by an absolute path to the file. On the physical nodes this +# path may look as the following: +# +# /workspace/foo-job@tmp/... +# +# The '@' has a special meaning for ar when spotted on the cmdline. +# It ends up splitting the path into /workspace/foo-job treating it +# as a member path which doesn't exist. This causes the entire build +# to fail. To workaround this, we inject ourselves via AR_TOOL and +# modify the MRI commands such that the absolute paths to members are +# replaced with relative ones (relative to xnvme/builddir from where +# the library_bundler.py is executed). + +curdir=$(readlink -f "$(dirname "$0")") +rootdir=$(readlink -f "$curdir/../") + +[[ ! -t 0 ]] || exit 1 + +while read -r cmd arg; do + if [[ $cmd == ADDLIB && $arg == /* ]]; then + arg=${arg/"$rootdir/xnvme/"/"../"} + fi + mri+=("$cmd${arg:+ $arg}") +done + +ar "$@" < <(printf '%s\n' "${mri[@]}") diff --git a/test/common/autotest_common.sh b/test/common/autotest_common.sh index a2d5b6ba9..ed3f83ffa 100755 --- a/test/common/autotest_common.sh +++ b/test/common/autotest_common.sh @@ -165,6 +165,8 @@ export SPDK_TEST_NVMF_NICS export SPDK_TEST_SMA : ${SPDK_TEST_DAOS=0} export SPDK_TEST_DAOS +: ${SPDK_TEST_XNVME:=0} +export SPDK_TEST_XNVME # always test with SPDK shared objects. export SPDK_LIB_DIR="$rootdir/build/lib" @@ -211,6 +213,9 @@ leak:libtcmalloc_minimal.so # Suppress leaks in libiscsi leak:libiscsi.so + +# Supress leaks in xnvme +leak:xnvme_dev_alloc EOL # Suppress leaks in libfuse3 @@ -234,6 +239,8 @@ export SPDK_EXAMPLE_DIR="$rootdir/build/examples" export QEMU_BIN=${QEMU_BIN:-} export VFIO_QEMU_BIN=${VFIO_QEMU_BIN:-} +export AR_TOOL=$rootdir/scripts/ar-xnvme-fixer + # pass our valgrind desire on to unittest.sh if [ $SPDK_RUN_VALGRIND -eq 0 ]; then export valgrind='' @@ -494,6 +501,11 @@ function get_config_params() { config_params+=' --with-daos' fi + # Make the xnvme module available for the tests + if [[ $SPDK_TEST_XNVME -eq 1 ]]; then + config_params+=' --with-xnvme' + fi + echo "$config_params" xtrace_restore }