From 1ee119ea8bcd7d4fbcab4fb52e13411fbb3acc4c Mon Sep 17 00:00:00 2001 From: Marcin Dziegielewski Date: Fri, 4 Oct 2019 17:43:58 +0200 Subject: [PATCH] test/ocf: new test remove.sh This patch adds test that checks correctnes of delete_ocf_bdev rpc command. After delete_ocf_bdev command, all settings related to the removed ocf instance should be cleared and this particular ocf instance should not be loaded on next application start. Signed-off-by: Marcin Dziegielewski Change-Id: Ifc61399d9f1ab7407f62b4a25e9bb1468f401880 Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/465674 Tested-by: SPDK CI Jenkins Reviewed-by: Jim Harris Reviewed-by: Darek Stojaczyk --- test/ocf/management/remove.sh | 59 +++++++++++++++++++++++++++++++++++ test/ocf/ocf.sh | 1 + 2 files changed, 60 insertions(+) create mode 100755 test/ocf/management/remove.sh diff --git a/test/ocf/management/remove.sh b/test/ocf/management/remove.sh new file mode 100755 index 0000000000..87d1cac2b1 --- /dev/null +++ b/test/ocf/management/remove.sh @@ -0,0 +1,59 @@ +#!/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 + +rm -f aio* +truncate -s 128M aio0 +truncate -s 128M aio1 + +echo " +[AIO] + AIO ./aio0 aio0 512 + AIO ./aio1 aio1 512 +" > $curdir/config + +$rootdir/app/iscsi_tgt/iscsi_tgt -c $curdir/config & +spdk_pid=$! + +waitforlisten $spdk_pid + +# Create ocf on persistent storage + +$rpc_py bdev_ocf_create ocfWT wt aio0 aio1 + +# Check that ocfWT was created properly + +$rpc_py bdev_ocf_get_bdevs | jq -r '.[] .name' | grep -qw ocfWT + +# Remove ocfWT, after delete via rpc ocf bdev should not load on next app start + +$rpc_py bdev_ocf_delete ocfWT + +# Check that ocfWT was deleted properly + +! $rpc_py bdev_ocf_get_bdevs | jq -r '.[] .name' | grep -qw ocfWT + +trap - SIGINT SIGTERM EXIT + +killprocess $spdk_pid + +# Check for ocfWT was deleted permanently +$rootdir/app/iscsi_tgt/iscsi_tgt -c $curdir/config & +spdk_pid=$! + +trap 'killprocess $spdk_pid; rm -f aio* $curdir/config ocf_bdevs ocf_bdevs_verify; exit 1' SIGINT SIGTERM EXIT + +waitforlisten $spdk_pid + +# Check that ocfWT was not loaded on app start + +! $rpc_py bdev_ocf_get_bdevs | jq -r '.[] .name' | grep -qw ocfWT + +trap - SIGINT SIGTERM EXIT + +killprocess $spdk_pid +rm -f aio* $curdir/config ocf_bdevs ocf_bdevs_verify diff --git a/test/ocf/ocf.sh b/test/ocf/ocf.sh index 6498d1c26a..b257cc4eaa 100755 --- a/test/ocf/ocf.sh +++ b/test/ocf/ocf.sh @@ -19,6 +19,7 @@ suite "$testdir/integrity/bdevperf-iotypes.sh" suite "$testdir/management/create-destruct.sh" suite "$testdir/management/multicore.sh" suite "$testdir/management/persistent-metadata.sh" +suite "$testdir/management/remove.sh" timing_exit ocf report_test_completion "ocf"