summaryrefslogtreecommitdiffstats
path: root/src/spdk/test/spdkcli/common.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 18:45:59 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 18:45:59 +0000
commit19fcec84d8d7d21e796c7624e521b60d28ee21ed (patch)
tree42d26aa27d1e3f7c0b8bd3fd14e7d7082f5008dc /src/spdk/test/spdkcli/common.sh
parentInitial commit. (diff)
downloadceph-19fcec84d8d7d21e796c7624e521b60d28ee21ed.tar.xz
ceph-19fcec84d8d7d21e796c7624e521b60d28ee21ed.zip
Adding upstream version 16.2.11+ds.upstream/16.2.11+dsupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/spdk/test/spdkcli/common.sh')
-rw-r--r--src/spdk/test/spdkcli/common.sh45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/spdk/test/spdkcli/common.sh b/src/spdk/test/spdkcli/common.sh
new file mode 100644
index 000000000..fec6d0497
--- /dev/null
+++ b/src/spdk/test/spdkcli/common.sh
@@ -0,0 +1,45 @@
+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
+ if [ -n "$spdk_tgt_pid" ]; then
+ killprocess $spdk_tgt_pid
+ fi
+ if [ -n "$nvmf_tgt_pid" ]; then
+ killprocess $nvmf_tgt_pid
+ fi
+ if [ -n "$iscsi_tgt_pid" ]; then
+ killprocess $iscsi_tgt_pid
+ fi
+ if [ -n "$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() {
+ $SPDK_BIN_DIR/spdk_tgt -m 0x3 -p 0 -s 4096 &
+ spdk_tgt_pid=$!
+ waitforlisten $spdk_tgt_pid
+}
+
+function run_nvmf_tgt() {
+ $SPDK_BIN_DIR/nvmf_tgt -m 0x3 -p 0 -s 4096 &
+ nvmf_tgt_pid=$!
+ waitforlisten $nvmf_tgt_pid
+}
+
+function run_vhost_tgt() {
+ $SPDK_BIN_DIR/vhost -m 0x3 -p 0 -s 4096 &
+ vhost_tgt_pid=$!
+ waitforlisten $vhost_tgt_pid
+}
+
+function check_match() {
+ $rootdir/scripts/spdkcli.py ll $SPDKCLI_BRANCH > $testdir/match_files/${MATCH_FILE}
+ $rootdir/test/app/match/match $testdir/match_files/${MATCH_FILE}.match
+ rm -f $testdir/match_files/${MATCH_FILE}
+}