test/nvmf: Add test for nvmf_get_stats RPC method

Signed-off-by: Evgeniy Kochetov <evgeniik@mellanox.com>
Change-Id: I1f9d2f75831a93dded21d06de63d9f6f40b1a013
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/463390
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:
Evgeniy Kochetov 2019-07-28 11:43:47 +00:00 committed by Ben Walker
parent c9c80e6932
commit 3cbb9690d4

View File

@ -7,12 +7,42 @@ source $rootdir/test/nvmf/common.sh
rpc_py="$rootdir/scripts/rpc.py"
function jcount()
{
local filter=$1
jq "$filter" | wc -l
}
function jsum()
{
local filter=$1
jq "$filter" | awk '{s+=$1}END{print s}'
}
timing_enter rpc
nvmftestinit
nvmfappstart "-m 0xF"
stats=$($rpc_py nvmf_get_stats)
# Expect 4 poll groups (from CPU mask) and no transports yet
[ "4" -eq $(jcount .poll_groups[].name <<< "$stats") ]
[ "null" == $(jq .poll_groups[0].transports[0] <<< "$stats") ]
$rpc_py nvmf_create_transport $NVMF_TRANSPORT_OPTS -u 8192
stats=$($rpc_py nvmf_get_stats)
# Expect no QPs
[ "0" -eq $(jsum .poll_groups[].admin_qpairs <<< "$stats") ]
[ "0" -eq $(jsum .poll_groups[].io_qpairs <<< "$stats") ]
# Transport statistics is currently implemented for RDMA only
if [ 'rdma' == $TEST_TRANSPORT ]; then
# Expect RDMA transport and some devices
[ "1" -eq $(jcount .poll_groups[0].transports[].trtype <<< "$stats") ]
transport_type=$(jq -r .poll_groups[0].transports[0].trtype <<< "$stats")
[ "${transport_type,,}" == "${TEST_TRANSPORT,,}" ]
[ "0" -lt $(jcount .poll_groups[0].transports[0].devices[].name <<< "$stats") ]
fi
# set times for subsystem construct/delete
if [ $RUN_NIGHTLY -eq 1 ]; then
times=50
@ -83,6 +113,17 @@ do
$rpc_py delete_nvmf_subsystem nqn.2016-06.io.spdk:cnode1
done
stats=$($rpc_py nvmf_get_stats)
# Expect some admin and IO qpairs
[ "0" -lt $(jsum .poll_groups[].admin_qpairs <<< "$stats") ]
[ "0" -lt $(jsum .poll_groups[].io_qpairs <<< "$stats") ]
# Transport statistics is currently implemented for RDMA only
if [ 'rdma' == $TEST_TRANSPORT ]; then
# Expect non-zero completions and request latencies accumulated
[ "0" -lt $(jsum .poll_groups[].transports[].devices[].completions <<< "$stats") ]
[ "0" -lt $(jsum .poll_groups[].transports[].devices[].request_latency <<< "$stats") ]
fi
trap - SIGINT SIGTERM EXIT
nvmftestfini