Loading autotest.sh +5 −0 Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ rootdir=$(readlink -f $(dirname $0)) source "$rootdir/scripts/autotest_common.sh" source "$rootdir/test/nvmf/common.sh" set -xe Loading Loading @@ -43,6 +44,10 @@ timing_enter afterboot ./scripts/setup.sh timing_exit afterboot timing_enter nvmf_setup rdma_device_init timing_exit nvmf_setup ##################### # Unit Tests ##################### Loading test/nvmf/common.sh +13 −11 Original line number Diff line number Diff line Loading @@ -8,7 +8,7 @@ NVMF_FIRST_TARGET_IP=$NVMF_IP_PREFIX.$NVMF_IP_LEAST_ADDR function load_ib_rdma_modules() { if [ `uname` != Linux ]; then exit 0 return 0 fi modprobe ib_cm Loading @@ -23,13 +23,17 @@ function load_ib_rdma_modules() function detect_mellanox_nics() { if ! hash lspci; then return 0 fi nvmf_nic_bdfs=`lspci | grep Ethernet | grep Mellanox | awk -F ' ' '{print "0000:"$1}'` mlx_core_driver="mlx4_core" mlx_ib_driver="mlx4_ib" mlx_en_driver="mlx4_en" if [ -z "$nvmf_nic_bdfs" ]; then exit 0 return 0 fi # for nvmf target loopback test, suppose we only have one type of card. Loading Loading @@ -68,8 +72,6 @@ function detect_mellanox_nics() # The mlx4 driver takes an extra few seconds to load after modprobe returns, # otherwise ifconfig operations will do nothing. sleep 5 trap - SIGINT SIGTERM EXIT } function detect_rdma_nics() Loading @@ -84,16 +86,12 @@ function allocate_nic_ips() for nic_type in `ls /sys/class/infiniband`; do for nic_name in `ls /sys/class/infiniband/${nic_type}/device/net`; do ifconfig $nic_name $NVMF_IP_PREFIX.$count netmask 255.255.255.0 up # dump configuration for debug log ifconfig $nic_name let count=$count+1 done done # check whether the IP is configured result=`ifconfig | grep $NVMF_IP_PREFIX` if [ -z "$result" ]; then echo "no NIC for nvmf test" exit 0 fi } function nvmfcleanup() Loading @@ -109,3 +107,7 @@ function rdma_device_init() allocate_nic_ips } function rdma_nic_available() { ifconfig | grep -q $NVMF_IP_PREFIX } test/nvmf/discovery/discovery.sh +6 −3 Original line number Diff line number Diff line Loading @@ -5,14 +5,17 @@ rootdir=$(readlink -f $testdir/../../..) source $rootdir/scripts/autotest_common.sh source $rootdir/test/nvmf/common.sh set -e if ! hash nvme; then echo "nvme command not found; skipping discovery test" exit 0 fi rdma_device_init set -e if ! rdma_nic_available; then echo "no NIC for nvmf test" exit 0 fi timing_enter discovery Loading test/nvmf/filesystem/filesystem.sh +5 −2 Original line number Diff line number Diff line Loading @@ -31,10 +31,13 @@ function filesystem_test() done } rdma_device_init set -e if ! rdma_nic_available; then echo "no NIC for nvmf test" exit 0 fi timing_enter fs_test # Start up the NVMf target in another process Loading test/nvmf/fio/fio.sh +5 −2 Original line number Diff line number Diff line Loading @@ -5,10 +5,13 @@ rootdir=$(readlink -f $testdir/../../..) source $rootdir/scripts/autotest_common.sh source $rootdir/test/nvmf/common.sh rdma_device_init set -e if ! rdma_nic_available; then echo "no NIC for nvmf test" exit 0 fi timing_enter fio # Start up the NVMf target in another process Loading Loading
autotest.sh +5 −0 Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ rootdir=$(readlink -f $(dirname $0)) source "$rootdir/scripts/autotest_common.sh" source "$rootdir/test/nvmf/common.sh" set -xe Loading Loading @@ -43,6 +44,10 @@ timing_enter afterboot ./scripts/setup.sh timing_exit afterboot timing_enter nvmf_setup rdma_device_init timing_exit nvmf_setup ##################### # Unit Tests ##################### Loading
test/nvmf/common.sh +13 −11 Original line number Diff line number Diff line Loading @@ -8,7 +8,7 @@ NVMF_FIRST_TARGET_IP=$NVMF_IP_PREFIX.$NVMF_IP_LEAST_ADDR function load_ib_rdma_modules() { if [ `uname` != Linux ]; then exit 0 return 0 fi modprobe ib_cm Loading @@ -23,13 +23,17 @@ function load_ib_rdma_modules() function detect_mellanox_nics() { if ! hash lspci; then return 0 fi nvmf_nic_bdfs=`lspci | grep Ethernet | grep Mellanox | awk -F ' ' '{print "0000:"$1}'` mlx_core_driver="mlx4_core" mlx_ib_driver="mlx4_ib" mlx_en_driver="mlx4_en" if [ -z "$nvmf_nic_bdfs" ]; then exit 0 return 0 fi # for nvmf target loopback test, suppose we only have one type of card. Loading Loading @@ -68,8 +72,6 @@ function detect_mellanox_nics() # The mlx4 driver takes an extra few seconds to load after modprobe returns, # otherwise ifconfig operations will do nothing. sleep 5 trap - SIGINT SIGTERM EXIT } function detect_rdma_nics() Loading @@ -84,16 +86,12 @@ function allocate_nic_ips() for nic_type in `ls /sys/class/infiniband`; do for nic_name in `ls /sys/class/infiniband/${nic_type}/device/net`; do ifconfig $nic_name $NVMF_IP_PREFIX.$count netmask 255.255.255.0 up # dump configuration for debug log ifconfig $nic_name let count=$count+1 done done # check whether the IP is configured result=`ifconfig | grep $NVMF_IP_PREFIX` if [ -z "$result" ]; then echo "no NIC for nvmf test" exit 0 fi } function nvmfcleanup() Loading @@ -109,3 +107,7 @@ function rdma_device_init() allocate_nic_ips } function rdma_nic_available() { ifconfig | grep -q $NVMF_IP_PREFIX }
test/nvmf/discovery/discovery.sh +6 −3 Original line number Diff line number Diff line Loading @@ -5,14 +5,17 @@ rootdir=$(readlink -f $testdir/../../..) source $rootdir/scripts/autotest_common.sh source $rootdir/test/nvmf/common.sh set -e if ! hash nvme; then echo "nvme command not found; skipping discovery test" exit 0 fi rdma_device_init set -e if ! rdma_nic_available; then echo "no NIC for nvmf test" exit 0 fi timing_enter discovery Loading
test/nvmf/filesystem/filesystem.sh +5 −2 Original line number Diff line number Diff line Loading @@ -31,10 +31,13 @@ function filesystem_test() done } rdma_device_init set -e if ! rdma_nic_available; then echo "no NIC for nvmf test" exit 0 fi timing_enter fs_test # Start up the NVMf target in another process Loading
test/nvmf/fio/fio.sh +5 −2 Original line number Diff line number Diff line Loading @@ -5,10 +5,13 @@ rootdir=$(readlink -f $testdir/../../..) source $rootdir/scripts/autotest_common.sh source $rootdir/test/nvmf/common.sh rdma_device_init set -e if ! rdma_nic_available; then echo "no NIC for nvmf test" exit 0 fi timing_enter fio # Start up the NVMf target in another process Loading