From 3d38fcc3120ae2c950df86784ebb7e57318aee7c Mon Sep 17 00:00:00 2001 From: cunyinch Date: Sat, 27 May 2017 08:13:55 +0800 Subject: [PATCH] test/nvmf: use stub application The stub application will ensure that each nvmf test does not need to reinitialized DPDK memory and NVMe devices. This drastically cuts down on the amount of time needed to run all of the nvmf tests. Change-Id: I6abad4e1298111884f18026e72e36f5d8b73c4b9 Signed-off-by: cunyinch Reviewed-on: https://review.gerrithub.io/362810 Reviewed-by: Jim Harris Tested-by: SPDK Automated Test System Reviewed-by: Ben Walker --- test/nvmf/common.sh | 8 ++++++++ test/nvmf/discovery/discovery.sh | 5 +++-- test/nvmf/filesystem/filesystem.sh | 5 +++-- test/nvmf/fio/fio.sh | 5 +++-- test/nvmf/host/aer.sh | 5 +++-- test/nvmf/host/fio.sh | 5 +++-- test/nvmf/host/identify.sh | 5 +++-- test/nvmf/host/perf.sh | 5 +++-- test/nvmf/multiconnection/multiconnection.sh | 5 +++-- test/nvmf/nvme_cli/nvme_cli.sh | 5 +++-- test/nvmf/nvmf.sh | 18 +++++++++++++++++- test/nvmf/rpc/rpc.sh | 3 ++- test/nvmf/shutdown/shutdown.sh | 5 +++-- 13 files changed, 57 insertions(+), 22 deletions(-) diff --git a/test/nvmf/common.sh b/test/nvmf/common.sh index e4b8d7755..8b379d481 100755 --- a/test/nvmf/common.sh +++ b/test/nvmf/common.sh @@ -6,6 +6,14 @@ NVMF_IP_LEAST_ADDR=8 NVMF_FIRST_TARGET_IP=$NVMF_IP_PREFIX.$NVMF_IP_LEAST_ADDR RPC_PORT=5260 +if [ -z "$NVMF_APP" ]; then + NVMF_APP=./app/nvmf_tgt/nvmf_tgt +fi + +if [ -z "$NVMF_TEST_CORE_MASK" ]; then + NVMF_TEST_CORE_MASK=0xFFFF +fi + function load_ib_rdma_modules() { if [ `uname` != Linux ]; then diff --git a/test/nvmf/discovery/discovery.sh b/test/nvmf/discovery/discovery.sh index bfda72177..8c9519d83 100755 --- a/test/nvmf/discovery/discovery.sh +++ b/test/nvmf/discovery/discovery.sh @@ -23,14 +23,15 @@ if ! rdma_nic_available; then fi timing_enter discovery - +timing_enter start_nvmf_tgt # Start up the NVMf target in another process -$rootdir/app/nvmf_tgt/nvmf_tgt -c $testdir/../nvmf.conf & +$NVMF_APP -c $testdir/../nvmf.conf & nvmfpid=$! trap "killprocess $nvmfpid; exit 1" SIGINT SIGTERM EXIT waitforlisten $nvmfpid ${RPC_PORT} +timing_exit start_nvmf_tgt bdevs="$bdevs $($rpc_py construct_null_bdev Null0 $NULL_BDEV_SIZE $NULL_BLOCK_SIZE)" bdevs="$bdevs $($rpc_py construct_null_bdev Null1 $NULL_BDEV_SIZE $NULL_BLOCK_SIZE)" diff --git a/test/nvmf/filesystem/filesystem.sh b/test/nvmf/filesystem/filesystem.sh index f1337b710..22af405db 100755 --- a/test/nvmf/filesystem/filesystem.sh +++ b/test/nvmf/filesystem/filesystem.sh @@ -18,14 +18,15 @@ if ! rdma_nic_available; then fi timing_enter fs_test - +timing_enter start_nvmf_tgt # Start up the NVMf target in another process -$rootdir/app/nvmf_tgt/nvmf_tgt -c $testdir/../nvmf.conf & +$NVMF_APP -c $testdir/../nvmf.conf & nvmfpid=$! trap "killprocess $nvmfpid; exit 1" SIGINT SIGTERM EXIT waitforlisten $nvmfpid ${RPC_PORT} +timing_exit start_nvmf_tgt bdevs="$bdevs $($rpc_py construct_malloc_bdev $MALLOC_BDEV_SIZE $MALLOC_BLOCK_SIZE)" bdevs="$bdevs $($rpc_py construct_malloc_bdev $MALLOC_BDEV_SIZE $MALLOC_BLOCK_SIZE)" diff --git a/test/nvmf/fio/fio.sh b/test/nvmf/fio/fio.sh index f8a92d02a..9b8ff0500 100755 --- a/test/nvmf/fio/fio.sh +++ b/test/nvmf/fio/fio.sh @@ -18,14 +18,15 @@ if ! rdma_nic_available; then fi timing_enter fio - +timing_enter start_nvmf_tgt # Start up the NVMf target in another process -$rootdir/app/nvmf_tgt/nvmf_tgt -c $testdir/../nvmf.conf & +$NVMF_APP -c $testdir/../nvmf.conf & nvmfpid=$! trap "killprocess $nvmfpid; exit 1" SIGINT SIGTERM EXIT waitforlisten $nvmfpid ${RPC_PORT} +timing_exit start_nvmf_tgt bdevs="$bdevs $($rpc_py construct_malloc_bdev $MALLOC_BDEV_SIZE $MALLOC_BLOCK_SIZE)" bdevs="$bdevs $($rpc_py construct_malloc_bdev $MALLOC_BDEV_SIZE $MALLOC_BLOCK_SIZE)" diff --git a/test/nvmf/host/aer.sh b/test/nvmf/host/aer.sh index 108830cb6..ab1ec6dd0 100755 --- a/test/nvmf/host/aer.sh +++ b/test/nvmf/host/aer.sh @@ -15,14 +15,15 @@ if ! rdma_nic_available; then fi timing_enter aer +timing_enter start_nvmf_tgt -# Start up the NVMf target in another process -$rootdir/app/nvmf_tgt/nvmf_tgt -c $testdir/../nvmf.conf -m 0x2 -p 1 -s 512 & +$NVMF_APP -c $testdir/../nvmf.conf & nvmfpid=$! trap "killprocess $nvmfpid; exit 1" SIGINT SIGTERM EXIT waitforlisten $nvmfpid ${RPC_PORT} +timing_exit start_nvmf_tgt $rpc_py construct_nvmf_subsystem Direct nqn.2016-06.io.spdk:cnode1 'transport:RDMA traddr:192.168.100.8 trsvcid:4420' '' -p "*" diff --git a/test/nvmf/host/fio.sh b/test/nvmf/host/fio.sh index 17732d160..7a092f9e6 100755 --- a/test/nvmf/host/fio.sh +++ b/test/nvmf/host/fio.sh @@ -20,14 +20,15 @@ if [ ! -d /usr/src/fio ]; then fi timing_enter fio +timing_enter start_nvmf_tgt -# Start up the NVMf target in another process -$rootdir/app/nvmf_tgt/nvmf_tgt -c $testdir/../nvmf.conf -m 0x2 -p 1 -s 512 & +$NVMF_APP -c $testdir/../nvmf.conf & nvmfpid=$! trap "killprocess $nvmfpid; exit 1" SIGINT SIGTERM EXIT waitforlisten $nvmfpid ${RPC_PORT} +timing_exit start_nvmf_tgt $rpc_py construct_nvmf_subsystem Direct nqn.2016-06.io.spdk:cnode1 'transport:RDMA traddr:192.168.100.8 trsvcid:4420' '' -p "*" diff --git a/test/nvmf/host/identify.sh b/test/nvmf/host/identify.sh index 13ebc091e..7d419a1bb 100755 --- a/test/nvmf/host/identify.sh +++ b/test/nvmf/host/identify.sh @@ -18,14 +18,15 @@ if ! rdma_nic_available; then fi timing_enter identify +timing_enter start_nvmf_tgt -# Start up the NVMf target in another process -$rootdir/app/nvmf_tgt/nvmf_tgt -c $testdir/../nvmf.conf -m 0x2 -p 1 -s 512 -t nvmf & +$NVMF_APP -c $testdir/../nvmf.conf & nvmfpid=$! trap "killprocess $nvmfpid; exit 1" SIGINT SIGTERM EXIT waitforlisten $nvmfpid ${RPC_PORT} +timing_exit start_nvmf_tgt bdevs="$bdevs $($rpc_py construct_malloc_bdev $MALLOC_BDEV_SIZE $MALLOC_BLOCK_SIZE)" diff --git a/test/nvmf/host/perf.sh b/test/nvmf/host/perf.sh index 091834115..4a669c825 100755 --- a/test/nvmf/host/perf.sh +++ b/test/nvmf/host/perf.sh @@ -18,14 +18,15 @@ if ! rdma_nic_available; then fi timing_enter perf +timing_enter start_nvmf_tgt -# Start up the NVMf target in another process -$rootdir/app/nvmf_tgt/nvmf_tgt -c $testdir/../nvmf.conf -m 0x2 -p 1 -s 512 & +$NVMF_APP -c $testdir/../nvmf.conf & nvmfpid=$! trap "killprocess $nvmfpid; exit 1" SIGINT SIGTERM EXIT waitforlisten $nvmfpid ${RPC_PORT} +timing_exit start_nvmf_tgt bdevs="$bdevs $($rpc_py construct_malloc_bdev $MALLOC_BDEV_SIZE $MALLOC_BLOCK_SIZE)" diff --git a/test/nvmf/multiconnection/multiconnection.sh b/test/nvmf/multiconnection/multiconnection.sh index eaf3e354c..018f69d6a 100755 --- a/test/nvmf/multiconnection/multiconnection.sh +++ b/test/nvmf/multiconnection/multiconnection.sh @@ -18,14 +18,15 @@ if ! rdma_nic_available; then fi timing_enter multiconnection - +timing_enter start_nvmf_tgt # Start up the NVMf target in another process -$rootdir/app/nvmf_tgt/nvmf_tgt -c $testdir/../nvmf.conf & +$NVMF_APP -c $testdir/../nvmf.conf & pid=$! trap "killprocess $pid; exit 1" SIGINT SIGTERM EXIT waitforlisten $pid ${RPC_PORT} +timing_exit start_nvmf_tgt modprobe -v nvme-rdma diff --git a/test/nvmf/nvme_cli/nvme_cli.sh b/test/nvmf/nvme_cli/nvme_cli.sh index 66f37db79..44f680ea9 100755 --- a/test/nvmf/nvme_cli/nvme_cli.sh +++ b/test/nvmf/nvme_cli/nvme_cli.sh @@ -18,13 +18,14 @@ if ! rdma_nic_available; then fi timing_enter nvme_cli - -$rootdir/app/nvmf_tgt/nvmf_tgt -c $testdir/../nvmf.conf & +timing_enter start_nvmf_tgt +$NVMF_APP -c $testdir/../nvmf.conf & nvmfpid=$! trap "killprocess $nvmfpid; exit 1" SIGINT SIGTERM EXIT waitforlisten $nvmfpid ${RPC_PORT} +timing_exit start_nvmf_tgt bdevs="$bdevs $($rpc_py construct_malloc_bdev $MALLOC_BDEV_SIZE $MALLOC_BLOCK_SIZE)" bdevs="$bdevs $($rpc_py construct_malloc_bdev $MALLOC_BDEV_SIZE $MALLOC_BLOCK_SIZE)" diff --git a/test/nvmf/nvmf.sh b/test/nvmf/nvmf.sh index 3dc050447..0f1006539 100755 --- a/test/nvmf/nvmf.sh +++ b/test/nvmf/nvmf.sh @@ -11,12 +11,23 @@ source $rootdir/test/nvmf/common.sh timing_enter nvmf_tgt +# NVMF_TEST_CORE_MASK is the biggest core mask specified by +# any of the nvmf_tgt tests. Using this mask for the stub +# ensures that if this mask spans CPU sockets, that we will +# allocate memory from both sockets. The stub will *not* +# run anything on the extra cores (and will sleep on master +# core 0) so there is no impact to the nvmf_tgt tests by +# specifying the bigger core mask. +start_stub "-s 2048 -i 0 -m $NVMF_TEST_CORE_MASK" +trap "kill_stub; exit 1" SIGINT SIGTERM EXIT + +export NVMF_APP="./app/nvmf_tgt/nvmf_tgt -i 0" + run_test test/nvmf/fio/fio.sh run_test test/nvmf/filesystem/filesystem.sh run_test test/nvmf/discovery/discovery.sh run_test test/nvmf/nvme_cli/nvme_cli.sh run_test test/nvmf/shutdown/shutdown.sh -run_test test/nvmf/rpc/rpc.sh if [ $RUN_NIGHTLY -eq 1 ]; then run_test test/nvmf/multiconnection/multiconnection.sh @@ -33,5 +44,10 @@ run_test test/nvmf/host/identify_kernel_nvmf.sh run_test test/nvmf/host/fio.sh timing_exit host +trap - SIGINT SIGTERM EXIT +kill_stub +# TODO: enable nvme device detachment for multi-process so that +# we can use the stub for this test +run_test test/nvmf/rpc/rpc.sh timing_exit nvmf_tgt diff --git a/test/nvmf/rpc/rpc.sh b/test/nvmf/rpc/rpc.sh index 0c267f1e3..19397a202 100755 --- a/test/nvmf/rpc/rpc.sh +++ b/test/nvmf/rpc/rpc.sh @@ -15,7 +15,7 @@ if ! rdma_nic_available; then fi timing_enter rpc - +timing_enter start_nvmf_tgt # Start up the NVMf target in another process $rootdir/app/nvmf_tgt/nvmf_tgt -c $testdir/../nvmf.conf & pid=$! @@ -23,6 +23,7 @@ pid=$! trap "killprocess $pid; exit 1" SIGINT SIGTERM EXIT waitforlisten $pid ${RPC_PORT} +timing_exit start_nvmf_tgt # set times for subsystem construct/delete if [ $RUN_NIGHTLY -eq 1 ]; then diff --git a/test/nvmf/shutdown/shutdown.sh b/test/nvmf/shutdown/shutdown.sh index e22d4aa76..60ccc5c27 100755 --- a/test/nvmf/shutdown/shutdown.sh +++ b/test/nvmf/shutdown/shutdown.sh @@ -18,14 +18,15 @@ if ! rdma_nic_available; then fi timing_enter shutdown - +timing_enter start_nvmf_tgt # Start up the NVMf target in another process -$rootdir/app/nvmf_tgt/nvmf_tgt -c $testdir/../nvmf.conf & +$NVMF_APP -c $testdir/../nvmf.conf & pid=$! trap "killprocess $pid; exit 1" SIGINT SIGTERM EXIT waitforlisten $pid ${RPC_PORT} +timing_exit start_nvmf_tgt # Create 10 subsystems for i in `seq 1 10`