numam-spdk/test/spdkcli/common.sh
Pawel Wodkowski 651d9158a0 test: consolidate tests for reading JSON config
This patch rework all JSON config file reading tests. This is needed as
current approach will require to modify each test to re-launch SPDK
applications for each test type. This is hard to do because tests are
not flexible and will require to be rewritten almost from scratch. Not
metioning time to relaunch each test separatly.

Instead, just replace all old tests with one test. Launch only one
target and only one initiator. Then configure it using RPC calls. Then
config is dumped and target and initiator application is relaunched to
reread the configuration from file. Then config is dumped again and
compared.

Change-Id: Id857089aed0e6f2197cbf3ae625a4e9f4b13e8bb
Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/432318
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Pawel Kaminski <pawelx.kaminski@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
2019-01-16 14:17:10 +00:00

57 lines
1.5 KiB
Bash

set -xe
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
function on_error_exit() {
set +e
if [ ! -z $spdk_tgt_pid ]; then
killprocess $spdk_tgt_pid
fi
if [ ! -z $nvmf_tgt_pid ]; then
killprocess $nvmf_tgt_pid
fi
if [ ! -z $iscsi_tgt_pid ]; then
killprocess $iscsi_tgt_pid
fi
if [ ! -z $vhost_tgt_pid ]; then
killprocess $vhost_tgt_pid
fi
rm -f $testdir/${MATCH_FILE} $testdir/match_files/spdkcli_details_vhost.test /tmp/sample_aio /tmp/sample_pmem
print_backtrace
exit 1
}
function run_spdk_tgt() {
$SPDKCLI_BUILD_DIR/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 &
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 &
iscsi_tgt_pid=$!
waitforlisten $iscsi_tgt_pid
}
function run_vhost_tgt() {
$SPDKCLI_BUILD_DIR/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
rm -f $testdir/match_files/${MATCH_FILE}
}