autotest: Add spdk/nvme-cli main commands test
Cover spdk/nvme-cli main commands(Porting from DTS) Change-Id: I3afa71c5180a0143bc6c55f70b18c45bc098ec6e Signed-off-by: wenzhong wu <wenzhongx.wu@intel.com> Reviewed-on: https://review.gerrithub.io/392607 Tested-by: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
parent
5d9d13a95c
commit
370bc8ea53
@ -106,6 +106,7 @@ fi
|
||||
|
||||
if [ $SPDK_TEST_NVME -eq 1 ]; then
|
||||
run_test test/lib/nvme/nvme.sh
|
||||
run_test test/lib/nvme/spdk_nvme_cli.sh
|
||||
# Only test hotplug without ASAN enabled. Since if it is
|
||||
# enabled, it catches SEGV earlier than our handler which
|
||||
# breaks the hotplug logic
|
||||
|
44
test/lib/nvme/spdk_nvme_cli.sh
Executable file
44
test/lib/nvme/spdk_nvme_cli.sh
Executable file
@ -0,0 +1,44 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
testdir=$(readlink -f $(dirname $0))
|
||||
rootdir=$(readlink -f $testdir/../../..)
|
||||
source $rootdir/scripts/common.sh
|
||||
source $rootdir/test/common/autotest_common.sh
|
||||
spdk_nvme_cli="/home/sys_sgsw/nvme-cli"
|
||||
|
||||
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
|
||||
|
||||
if [ -d $spdk_nvme_cli ]; then
|
||||
bdfs=$(iter_pci_class_code 01 08 02)
|
||||
bdf=$(echo $bdfs|awk '{ print $1 }')
|
||||
cd $spdk_nvme_cli
|
||||
make clean && make
|
||||
sed -i 's/spdk=0/spdk=1/g' spdk.conf
|
||||
sed -i 's/shm_id=1/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
|
||||
fi
|
||||
|
||||
if [ `uname` = Linux ]; then
|
||||
trap - SIGINT SIGTERM EXIT
|
||||
kill_stub
|
||||
fi
|
||||
|
||||
timing_exit nvme_cli
|
@ -4,6 +4,7 @@ testdir=$(readlink -f $(dirname $0))
|
||||
rootdir=$(readlink -f $testdir/../../..)
|
||||
source $rootdir/test/common/autotest_common.sh
|
||||
source $rootdir/test/nvmf/common.sh
|
||||
spdk_nvme_cli="/home/sys_sgsw/nvme-cli"
|
||||
|
||||
MALLOC_BDEV_SIZE=64
|
||||
MALLOC_BLOCK_SIZE=512
|
||||
@ -53,8 +54,23 @@ done
|
||||
nvme disconnect -n "nqn.2016-06.io.spdk:cnode1" || true
|
||||
nvme disconnect -n "nqn.2016-06.io.spdk:cnode2" || true
|
||||
|
||||
$rpc_py delete_nvmf_subsystem nqn.2016-06.io.spdk:cnode1
|
||||
if [ -d $spdk_nvme_cli ]; then
|
||||
# Test spdk/nvme-cli NVMe-oF commands: discover, connect and disconnet
|
||||
cd $spdk_nvme_cli
|
||||
./nvme discover -t rdma -a $NVMF_FIRST_TARGET_IP -s 4420
|
||||
nvme_num_before_connection=$(nvme list |grep "/dev/nvme*"|awk '{print $1}'|wc -l)
|
||||
./nvme connect -t rdma -n "nqn.2016-06.io.spdk:cnode1" -a "$NVMF_FIRST_TARGET_IP" -s "$NVMF_PORT"
|
||||
nvme_num=$(nvme list |grep "/dev/nvme*"|awk '{print $1}'|wc -l)
|
||||
./nvme disconnect -n "nqn.2016-06.io.spdk:cnode1"
|
||||
sed -i 's/spdk=1/spdk=0/g' spdk.conf
|
||||
sed -i 's/shm_id=0/shm_id=1/g' spdk.conf
|
||||
if [ $nvme_num -le $nvme_num_before_connection ]; then
|
||||
echo "spdk/nvme-cli connect target devices failed"
|
||||
kill SIGINT
|
||||
fi
|
||||
fi
|
||||
|
||||
$rpc_py delete_nvmf_subsystem nqn.2016-06.io.spdk:cnode1
|
||||
trap - SIGINT SIGTERM EXIT
|
||||
|
||||
nvmfcleanup
|
||||
|
Loading…
x
Reference in New Issue
Block a user