numam-spdk/test/nvme/spdk_nvme_cli.sh
Darek Stojaczyk 20f4a21d84 test/nvmf/nvme-cli: don't run nvme-cli as secondary process
nvme-cli in NVMf tests currently fails to initialize
the NVMe driver and exits straight away [1]. It expects
the primary process to initialize the driver first, but
since the primary process doesn't operate on any NVMe
devices, it doesn't initialize the driver at all.

Fix this by running nvme-cli without multi-process mode.
In NVMf tests, nvme-cli is only used to discover, connect
and disconnect from an SPDK NVMf target. It does not need
to access any shared memory resources.

This wasn't an issue before, because we used an outdated
DPDK version for nvme-cli which didn't detect any other
shared memory processes of SPDK.

[1] nvme.c: 337:nvme_driver_init: *ERROR*: primary process
is not started yet

Change-Id: Id56f94c6655049e87ab9d93ee38853faf40a11e5
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/c/442552
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Seth Howell <seth.howell5141@gmail.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2019-01-29 20:54:13 +00:00

59 lines
1.3 KiB
Bash
Executable File

#!/usr/bin/env bash
set -ex
testdir=$(readlink -f $(dirname $0))
rootdir=$(readlink -f $testdir/../..)
source $rootdir/scripts/common.sh
source $rootdir/test/common/autotest_common.sh
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 0
fi
timing_enter nvme_cli
if [ `uname` = Linux ]; then
start_stub "-s 2048 -i 0 -m 0xF"
trap "kill_stub; exit 1" SIGINT SIGTERM EXIT
fi
# Build against the version of SPDK under test
rm -f "$spdk_nvme_cli/spdk"
ln -sf "$rootdir" "$spdk_nvme_cli/spdk"
bdfs=$(iter_pci_class_code 01 08 02)
bdf=$(echo $bdfs|awk '{ print $1 }')
cd $spdk_nvme_cli
make clean && make -j$(nproc) LDFLAGS="$(make -s -C $spdk_nvme_cli/spdk ldflags)"
sed -i 's/spdk=0/spdk=1/g' spdk.conf
sed -i 's/shm_id=.*/shm_id=0/g' spdk.conf
./nvme list
./nvme id-ctrl $bdf
./nvme list-ctrl $bdf
./nvme get-ns-id $bdf
./nvme id-ns $bdf
./nvme fw-log $bdf
./nvme smart-log $bdf
./nvme error-log $bdf
./nvme list-ns $bdf -n 1
./nvme get-feature $bdf -n 1 -f 1 -s 1 -l 100
./nvme get-log $bdf -n 1 -i 1 -l 100
./nvme reset $bdf
if [ `uname` = Linux ]; then
trap - SIGINT SIGTERM EXIT
kill_stub
fi
report_test_completion spdk_nvme_cli
timing_exit nvme_cli