Commit f9122e90 authored by Tomasz Zawadzki's avatar Tomasz Zawadzki Committed by Jim Harris
Browse files

test/common: move nvme-cli compilation to common script



NVMe tests compiled the nvme-cli, but turns out that
NVMe-oF did not. This patch moves compilation to
common script. Meanwhile next one will use it in other tests.

Additionally return to the original directories with
pushd & popd.

Signed-off-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: Ica60775a9b8e4347bed28d4c9dfae1acab2cae9f
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/2969


Community-CI: Mellanox Build Bot
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarPaul Luse <paul.e.luse@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
parent 0f6b0ed6
Loading
Loading
Loading
Loading
+25 −0
Original line number Diff line number Diff line
@@ -818,6 +818,31 @@ function rbd_cleanup() {
	fi
}

function nvme_cli_build() {
	if [[ -z "${DEPENDENCY_DIR}" ]]; then
		echo DEPENDENCY_DIR not defined!
		exit 1
	fi

	spdk_nvme_cli="${DEPENDENCY_DIR}/nvme-cli"

	if [[ ! -d $spdk_nvme_cli ]]; then
		echo "nvme-cli repository not found at $spdk_nvme_cli; skipping tests."
		exit 1
	fi

	# Build against the version of SPDK under test
	pushd $spdk_nvme_cli

	git clean -dfx

	rm -f "$spdk_nvme_cli/spdk"
	ln -sf "$rootdir" "$spdk_nvme_cli/spdk"

	make -j$(nproc) LDFLAGS="$(make -s -C $spdk_nvme_cli/spdk ldflags)"
	popd
}

function _start_stub() {
	# Disable ASLR for multi-process testing.  SPDK does support using DPDK multi-process,
	# but ASLR can still be unreliable in some cases.
+5 −21
Original line number Diff line number Diff line
@@ -10,31 +10,13 @@ if [[ $(uname) != "Linux" ]]; then
	exit 1
fi

if [ -z "${DEPENDENCY_DIR}" ]; then
	echo DEPENDENCY_DIR not defined!
	exit 1
fi

spdk_nvme_cli="${DEPENDENCY_DIR}/nvme-cli"

if [ ! -d $spdk_nvme_cli ]; then
	echo "nvme-cli repository not found at $spdk_nvme_cli; skipping tests."
	exit 1
fi

# Build against the version of SPDK under test
cd $spdk_nvme_cli

git clean -dfx

rm -f "$spdk_nvme_cli/spdk"
ln -sf "$rootdir" "$spdk_nvme_cli/spdk"

make -j$(nproc) LDFLAGS="$(make -s -C $spdk_nvme_cli/spdk ldflags)"
nvme_cli_build

trap "kill_stub; exit 1" SIGINT SIGTERM EXIT
start_stub "-s 2048 -i 0 -m 0xF"

pushd ${DEPENDENCY_DIR}/nvme-cli

sed -i 's/spdk=0/spdk=1/g' spdk.conf
sed -i 's/shm_id=.*/shm_id=0/g' spdk.conf
for bdf in $(get_nvme_bdfs); do
@@ -52,5 +34,7 @@ for bdf in $(get_nvme_bdfs); do
	./nvme reset $bdf
done

popd

trap - SIGINT SIGTERM EXIT
kill_stub