test/nvme: nvme_rpc add test for bdev_nvme_apply_firmware

This patch introduces tests for basic RPC commands not used in
other tests:

	bdev_nvme_apply_firmware

Change-Id: I3a7aff1720108548b03d581fa7664d1ff5498be5
Signed-off-by: Tomasz Kulasek <tomaszx.kulasek@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/533
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
Tomasz Kulasek 2020-01-28 15:39:52 +01:00 committed by Tomasz Zawadzki
parent 5145195533
commit 5b3c4b8783
2 changed files with 38 additions and 0 deletions

View File

@ -182,6 +182,7 @@ if [ $SPDK_RUN_FUNCTIONAL_TEST -eq 1 ]; then
run_test "nvme_cli_cuse" test/nvme/spdk_nvme_cli_cuse.sh
run_test "nvme_smartctl_cuse" test/nvme/spdk_smartctl_cuse.sh
fi
run_test "nvme_rpc" test/nvme/nvme_rpc.sh
# Only test hotplug without ASAN enabled. Since if it is
# enabled, it catches SEGV earlier than our handler which
# breaks the hotplug logic.

37
test/nvme/nvme_rpc.sh Executable file
View File

@ -0,0 +1,37 @@
#!/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=$(iter_pci_class_code 01 08 02 | head -1)
$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}
# 1) Test bdev_nvme_apply_firmware RPC
# NOTE: We don't want to do real firmware update on CI
# Make sure that used firmware file doesn't exist
if [ -f non_existing_file ]; then
exit 1
fi
# a) Try to apply firmware from non existing file
$rpc_py bdev_nvme_apply_firmware non_existing_file Nvme0n1 || rv=$?
if [ -z "$rv" ]; then
exit 1
fi
$rpc_py bdev_nvme_detach_controller Nvme0
trap - SIGINT SIGTERM EXIT
killprocess $spdk_tgt_pid