test/cuse: move cuse specific tests outside of nvme-cli

Couple of nvme_cuse RPC operations were done as part of
nvme-cli test cases. This patch moves those out to separate
script.

Next patches in series will expand those.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: Ia3123939901368af3570b127230f828437f39ef6
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1920
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: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Tomasz Zawadzki 2020-04-17 07:46:36 -04:00
parent 533fa01fab
commit 63db535f14
3 changed files with 50 additions and 19 deletions

View File

@ -177,6 +177,7 @@ if [ $SPDK_RUN_FUNCTIONAL_TEST -eq 1 ]; then
run_test "nvme_cli" test/nvme/spdk_nvme_cli.sh
fi
if [[ $SPDK_TEST_NVME_CUSE -eq 1 ]]; then
run_test "nvme_cuse" test/nvme/cuse/nvme_cuse.sh
run_test "nvme_cli_cuse" test/nvme/spdk_nvme_cli_cuse.sh
run_test "nvme_smartctl_cuse" test/nvme/spdk_smartctl_cuse.sh
fi

49
test/nvme/cuse/nvme_cuse.sh Executable file
View File

@ -0,0 +1,49 @@
#!/usr/bin/env bash
testdir=$(readlink -f $(dirname $0))
rootdir=$(readlink -f $testdir/../../..)
source $rootdir/scripts/common.sh
source $rootdir/test/common/autotest_common.sh
rpc_py=$rootdir/scripts/rpc.py
bdf=$(get_first_nvme_bdf)
ctrlr="/dev/spdk/nvme0"
$rootdir/scripts/setup.sh
$rootdir/app/spdk_tgt/spdk_tgt -m 0x3 &
spdk_tgt_pid=$!
trap 'kill -9 ${spdk_tgt_pid}; exit 1' SIGINT SIGTERM EXIT
waitforlisten $spdk_tgt_pid
$rpc_py bdev_nvme_attach_controller -b Nvme0 -t PCIe -a ${bdf}
$rpc_py bdev_nvme_cuse_register -n Nvme0
sleep 5
if [ ! -c "$ctrlr" ]; then
exit 1
fi
$rpc_py bdev_get_bdevs
$rpc_py bdev_nvme_get_controllers
$rpc_py bdev_nvme_cuse_unregister -n Nvme0
sleep 1
if [ -c "$ctrlr" ]; then
exit 1
fi
$rpc_py bdev_nvme_cuse_register -n Nvme0
sleep 1
if [ ! -c "$ctrlr" ]; then
exit 1
fi
$rpc_py bdev_nvme_detach_controller Nvme0
trap - SIGINT SIGTERM EXIT
killprocess $spdk_tgt_pid

View File

@ -104,24 +104,5 @@ if [ ! -c "$ctrlr" ]; then
return 1
fi
$rpc_py bdev_nvme_cuse_unregister -n Nvme0
sleep 1
if [ -c "$ctrlr" ]; then
return 1
fi
$rpc_py bdev_nvme_cuse_register -n Nvme0
sleep 1
if [ ! -c "$ctrlr" ]; then
return 1
fi
$rpc_py bdev_nvme_detach_controller Nvme0
sleep 1
if [ -c "$ctrlr" ]; then
return 1
fi
trap - SIGINT SIGTERM EXIT
killprocess $spdk_tgt_pid