Commit b5bdc850 authored by Darek Stojaczyk's avatar Darek Stojaczyk
Browse files

test/spdkcli: cleanup common.sh



Functions in this file already expect some variables
to be set by the calling script, so do the same with
$testdir and functions from autotest_common. We'll start
using `set -u` soon, so that variable expansion failure
will produce a clear error message (and will trigger ERR).

Change-Id: I3795af498639ad73a99cd03c6b5e72717fe5fd75
Signed-off-by: default avatarDarek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/458177


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
parent d77b0a67
Loading
Loading
Loading
Loading
+8 −11
Original line number Diff line number Diff line
testdir=$(readlink -f $(dirname $0))
SPDKCLI_BUILD_DIR=$(readlink -f $testdir/../..)
spdkcli_job="$SPDKCLI_BUILD_DIR/test/spdkcli/spdkcli_job.py"
spdk_clear_config_py="$SPDKCLI_BUILD_DIR/test/json_config/clear_config.py"
. $SPDKCLI_BUILD_DIR/test/common/autotest_common.sh
spdkcli_job="$rootdir/test/spdkcli/spdkcli_job.py"
spdk_clear_config_py="$rootdir/test/json_config/clear_config.py"

function on_error_exit() {
	set +e
@@ -24,31 +21,31 @@ function on_error_exit() {
}

function run_spdk_tgt() {
	$SPDKCLI_BUILD_DIR/app/spdk_tgt/spdk_tgt -m 0x3 -p 0 -s 4096 &
	$rootdir/app/spdk_tgt/spdk_tgt -m 0x3 -p 0 -s 4096 &
	spdk_tgt_pid=$!
	waitforlisten $spdk_tgt_pid
}

function run_nvmf_tgt() {
	$SPDKCLI_BUILD_DIR/app/nvmf_tgt/nvmf_tgt -m 0x3 -p 0 -s 4096 &
	$rootdir/app/nvmf_tgt/nvmf_tgt -m 0x3 -p 0 -s 4096 &
	nvmf_tgt_pid=$!
	waitforlisten $nvmf_tgt_pid
}

function run_iscsi_tgt() {
	$SPDKCLI_BUILD_DIR/app/iscsi_tgt/iscsi_tgt -m 0x3 -p 0 -s 4096 &
	$rootdir/app/iscsi_tgt/iscsi_tgt -m 0x3 -p 0 -s 4096 &
	iscsi_tgt_pid=$!
	waitforlisten $iscsi_tgt_pid
}

function run_vhost_tgt() {
	$SPDKCLI_BUILD_DIR/app/vhost/vhost -m 0x3 -p 0 -s 4096 &
	$rootdir/app/vhost/vhost -m 0x3 -p 0 -s 4096 &
	vhost_tgt_pid=$!
	waitforlisten $vhost_tgt_pid
}

function check_match() {
	$SPDKCLI_BUILD_DIR/scripts/spdkcli.py ll $SPDKCLI_BRANCH > $testdir/match_files/${MATCH_FILE}
	$SPDKCLI_BUILD_DIR/test/app/match/match -v $testdir/match_files/${MATCH_FILE}.match
	$rootdir/scripts/spdkcli.py ll $SPDKCLI_BRANCH > $testdir/match_files/${MATCH_FILE}
	$rootdir/test/app/match/match -v $testdir/match_files/${MATCH_FILE}.match
	rm -f $testdir/match_files/${MATCH_FILE}
}