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 11# For the time being this script is just meant to confirm the basic functionality of the 12# multitarget RPCs as the in-tree applications don't support multi-target functionality. 13rpc_py="$rootdir/test/nvmf/target/multitarget_rpc.py" 14 15nvmftestinit 16nvmfappstart -m 0xF 17 18trap 'process_shm --id $NVMF_APP_SHM_ID; nvmftestfini $1; exit 1' SIGINT SIGTERM EXIT 19 20# Target application should start with a single target. 21if [ "$($rpc_py nvmf_get_targets | jq 'length')" != "1" ]; then 22 echo "SPDK application did not start with the proper number of targets." && false 23fi 24 25$rpc_py nvmf_create_target -n nvmf_tgt_1 -s 32 26$rpc_py nvmf_create_target -n nvmf_tgt_2 -s 32 27 28if [ "$($rpc_py nvmf_get_targets | jq 'length')" != "3" ]; then 29 echo "nvmf_create_target RPC didn't properly create targets." && false 30fi 31 32$rpc_py nvmf_delete_target -n nvmf_tgt_1 33$rpc_py nvmf_delete_target -n nvmf_tgt_2 34 35if [ "$($rpc_py nvmf_get_targets | jq 'length')" != "1" ]; then 36 echo "nvmf_delete_target RPC didn't properly destroy targets." && false 37fi 38 39trap - SIGINT SIGTERM EXIT 40 41nvmftestfini 42