1#!/usr/bin/env bash 2# SPDX-License-Identifier: BSD-3-Clause 3# Copyright (C) 2019 Intel Corporation 4# All rights reserved. 5# 6testdir=$(readlink -f $(dirname $0)) 7rootdir=$(readlink -f $testdir/../../..) 8source $rootdir/test/common/autotest_common.sh 9source $rootdir/test/nvmf/common.sh 10 11MALLOC_BDEV_SIZE=64 12MALLOC_BLOCK_SIZE=512 13 14# connect disconnect is geared towards ensuring that we are properly freeing resources after disconnecting qpairs. 15nvmftestinit 16nvmfappstart -m 0xF 17 18$rpc_py nvmf_create_transport $NVMF_TRANSPORT_OPTS -u 8192 -c 0 19 20bdev="$($rpc_py bdev_malloc_create $MALLOC_BDEV_SIZE $MALLOC_BLOCK_SIZE)" 21 22$rpc_py nvmf_create_subsystem nqn.2016-06.io.spdk:cnode1 -a -s $NVMF_SERIAL 23$rpc_py nvmf_subsystem_add_ns nqn.2016-06.io.spdk:cnode1 $bdev 24$rpc_py nvmf_subsystem_add_listener nqn.2016-06.io.spdk:cnode1 -t $TEST_TRANSPORT -a $NVMF_FIRST_TARGET_IP -s $NVMF_PORT 25 26if [ $RUN_NIGHTLY -eq 1 ]; then 27 num_iterations=100 28 # Reduce number of IO queues to shorten connection time 29 NVME_CONNECT="nvme connect -i 8" 30else 31 num_iterations=5 32fi 33 34set +x 35for i in $(seq 1 $num_iterations); do 36 $NVME_CONNECT "${NVME_HOST[@]}" -t $TEST_TRANSPORT -n "nqn.2016-06.io.spdk:cnode1" -a "$NVMF_FIRST_TARGET_IP" -s "$NVMF_PORT" 37 waitforserial "$NVMF_SERIAL" 38 nvme disconnect -n "nqn.2016-06.io.spdk:cnode1" 39 waitforserial_disconnect "$NVMF_SERIAL" 40done 41set -x 42 43trap - SIGINT SIGTERM EXIT 44 45nvmftestfini 46