1# SPDX-License-Identifier: BSD-3-Clause 2# Copyright (C) 2018 Intel Corporation 3# All rights reserved. 4# 5 6spdkcli_job="$rootdir/test/spdkcli/spdkcli_job.py" 7spdk_clear_config_py="$rootdir/test/json_config/clear_config.py" 8 9function cleanup() { 10 if [ -n "$spdk_tgt_pid" ]; then 11 killprocess $spdk_tgt_pid 12 fi 13 if [ -n "$nvmf_tgt_pid" ]; then 14 killprocess $nvmf_tgt_pid 15 fi 16 if [ -n "$iscsi_tgt_pid" ]; then 17 killprocess $iscsi_tgt_pid 18 fi 19 if [ -n "$vhost_tgt_pid" ]; then 20 killprocess $vhost_tgt_pid 21 fi 22 rm -f $testdir/${MATCH_FILE} $testdir/match_files/spdkcli_details_vhost.test /tmp/sample_aio 23} 24 25function run_spdk_tgt() { 26 $SPDK_BIN_DIR/spdk_tgt -m 0x3 -p 0 & 27 spdk_tgt_pid=$! 28 waitforlisten $spdk_tgt_pid 29} 30 31function run_nvmf_tgt() { 32 $SPDK_BIN_DIR/nvmf_tgt -m 0x3 -p 0 & 33 nvmf_tgt_pid=$! 34 waitforlisten $nvmf_tgt_pid 35} 36 37function run_vhost_tgt() { 38 $SPDK_BIN_DIR/vhost -m 0x3 -p 0 & 39 vhost_tgt_pid=$! 40 waitforlisten $vhost_tgt_pid 41} 42 43function check_match() { 44 $rootdir/scripts/spdkcli.py ll $SPDKCLI_BRANCH > $testdir/match_files/${MATCH_FILE} 45 $rootdir/test/app/match/match $testdir/match_files/${MATCH_FILE}.match 46 rm -f $testdir/match_files/${MATCH_FILE} 47} 48 49function wait_for_all_nvme_ctrls_to_detach() { 50 while (($(rpc_cmd bdev_nvme_get_controllers | jq '.|length') != 0)); do :; done 51} 52