From b5bdc850cc612225c97152b91221e9142118c3bf Mon Sep 17 00:00:00 2001 From: Darek Stojaczyk Date: Sun, 16 Jun 2019 07:52:43 +0200 Subject: [PATCH] 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: Darek Stojaczyk Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/458177 Tested-by: SPDK CI Jenkins Reviewed-by: Ben Walker Reviewed-by: Shuhei Matsumoto --- test/spdkcli/common.sh | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/test/spdkcli/common.sh b/test/spdkcli/common.sh index c89d50eb2..b81f259f5 100644 --- a/test/spdkcli/common.sh +++ b/test/spdkcli/common.sh @@ -1,8 +1,5 @@ -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} }