Commit 5b3c4b87 authored by Tomasz Kulasek's avatar Tomasz Kulasek Committed by Tomasz Zawadzki
Browse files

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: default avatarTomasz Kulasek <tomaszx.kulasek@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/533


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
parent 51451955
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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.

test/nvme/nvme_rpc.sh

0 → 100755
+37 −0
Original line number Diff line number Diff line
#!/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