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: Tomasz 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: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Tomasz Zawadzki 2020-06-24 06:29:10 -04:00 committed by Jim Harris
parent 0f6b0ed67c
commit f9122e9054
2 changed files with 30 additions and 21 deletions

View File

@ -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.

View File

@ -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