From 00565ee6b5d444e4628f11b1e5a151f35cf1e54d Mon Sep 17 00:00:00 2001 From: Vitaliy Mysak Date: Mon, 18 Feb 2019 18:32:26 +0000 Subject: [PATCH] ocf/test: add management tests for multicore cases Add functional tests on creation and deletion of of OCF bdevs with many-to-one configuration. Change-Id: I6b740605a3341cb95e8d2a4173eeac04b0ae832b Signed-off-by: Vitaliy Mysak Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/445097 Tested-by: SPDK CI Jenkins Reviewed-by: Darek Stojaczyk Reviewed-by: Jim Harris Reviewed-by: Tomasz Zawadzki --- test/ocf/management/multicore.sh | 78 ++++++++++++++++++++++++++++++++ test/ocf/ocf.sh | 1 + 2 files changed, 79 insertions(+) create mode 100755 test/ocf/management/multicore.sh diff --git a/test/ocf/management/multicore.sh b/test/ocf/management/multicore.sh new file mode 100755 index 0000000000..f955745a5c --- /dev/null +++ b/test/ocf/management/multicore.sh @@ -0,0 +1,78 @@ +#!/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() +{ + kill -2 $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 | jq -e \ + 'any(select(.name == "C1" and .started))' + +$rpc_py construct_ocf_bdev C2 wt Cache Core1 + +$rpc_py get_ocf_bdevs | jq -e \ + 'any(select(.name == "C2" and .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 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 diff --git a/test/ocf/ocf.sh b/test/ocf/ocf.sh index 9328d19ef1..7e1ae809cc 100755 --- a/test/ocf/ocf.sh +++ b/test/ocf/ocf.sh @@ -17,5 +17,6 @@ timing_enter ocf suite "$testdir/integrity/fio-mallocs.sh" suite "$testdir/integrity/bdevperf-iotypes.sh" suite "$testdir/management/create-destruct.sh" +suite "$testdir/management/multicore.sh" timing_exit ocf