test/json_config: kill spdk target outside of "if" instruction

In case there is an error while killing the process we won't
be able to fail the test, because non-zero return codes
are not respected by set -e option if they originate from
inside "if" instruction".

Change-Id: I2da2a00df52ae3530152a514cf86036079d61430
Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/466412
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
Karol Latecki 2019-08-27 13:02:29 +02:00 committed by Jim Harris
parent 19baaa9a0e
commit 8bc67f2db3

View File

@ -385,11 +385,7 @@ function json_config_test_fini() {
local ret=0
if [[ -n "${app_pid[initiator]}" ]]; then
if ! json_config_test_shutdown_app initiator; then
kill -9 ${app_pid[initiator]}
app_pid[initiator]=
ret=1
fi
killprocess ${app_pid[initiator]}
fi
if [[ -n "${app_pid[target]}" ]]; then
@ -398,12 +394,7 @@ function json_config_test_fini() {
cleanup_bdev_subsystem_config
# SPDK_TEST_NVMF: Should we clear something?
if ! json_config_test_shutdown_app target; then
kill -9 ${app_pid[target]}
app_pid[target]=
ret=1
fi
killprocess ${app_pid[target]}
fi
rm -f "${configs_path[@]}"