Spdk/test/ocf/management/multicore.sh
Darek Stojaczyk d011196380 test/ocf: wait for spdk app to finish at the end
A termination signal was being sent, but we didn't
wait for the spdk app to actually exit. This was
actually causing an intermittent failure on our CI,
as the application could exit during our setup.sh
cleanup call, giving the following error:

```
Removing:    /dev/shm/iscsi_trace.pid284533
rm: cannot remove '/dev/shm/iscsi_trace.pid284533': No
such file or directory
```

Change-Id: Ic6ff0130b6264fa506c367d589853e5f3132c1d2
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/450032
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Vitaliy Mysak <vitaliy.mysak@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2019-04-11 18:23:08 +00:00

82 lines
1.6 KiB
Bash
Executable File

#!/usr/bin/env bash
curdir=$(dirname $(readlink -f "$BASH_SOURCE"))
rootdir=$(readlink -f $curdir/../../..)
source $rootdir/test/common/autotest_common.sh
rpc_py=$rootdir/scripts/rpc.py
spdk_pid='?'
function start_spdk()
{
$rootdir/app/iscsi_tgt/iscsi_tgt &
spdk_pid=$!
trap "killprocess $spdk_pid; exit 1" SIGINT SIGTERM EXIT
waitforlisten $spdk_pid
}
function stop_spdk()
{
killprocess $spdk_pid
trap - SIGINT SIGTERM EXIT
}
start_spdk
# Hotplug case
$rpc_py construct_malloc_bdev 1 512 -b Core0
$rpc_py construct_malloc_bdev 1 512 -b Core1
$rpc_py construct_ocf_bdev C1 wt Cache Core0
$rpc_py construct_ocf_bdev C2 wt Cache Core1
$rpc_py get_ocf_bdevs | jq -e \
'any(select(.started)) == false'
$rpc_py construct_malloc_bdev 101 512 -b Cache
$rpc_py get_ocf_bdevs | jq -e \
'all(select(.started)) == true'
# Detaching cores
$rpc_py delete_ocf_bdev C2
$rpc_py get_ocf_bdevs C1 | jq -e \
'.[0] | .started'
$rpc_py construct_ocf_bdev C2 wt Cache Core1
$rpc_py get_ocf_bdevs C2 | jq -e \
'.[0] | .started'
# Normal shutdown
stop_spdk
# Hotremove case
start_spdk
$rpc_py construct_malloc_bdev 101 512 -b Cache
$rpc_py construct_malloc_bdev 101 512 -b Malloc
$rpc_py construct_malloc_bdev 1 512 -b Core
$rpc_py construct_ocf_bdev C1 wt Cache Malloc
$rpc_py construct_ocf_bdev C2 wt Cache Core
$rpc_py get_ocf_bdevs Cache | jq \
'length == 2'
$rpc_py delete_malloc_bdev Cache
$rpc_py get_ocf_bdevs | jq -e \
'. == []'
# Not fully initialized shutdown
$rpc_py construct_ocf_bdev C1 wt Malloc NonExisting
$rpc_py construct_ocf_bdev C2 wt Malloc NonExisting
$rpc_py construct_ocf_bdev C3 wt Malloc Core
stop_spdk