numam-spdk/test/ftl/json.sh
Darek Stojaczyk 887aff4d09 test: remove duplicated set -ex from tests
It's always set in autotest_common.sh, there's no need
to set it again in each test script.

Change-Id: Ib14c4189c553dad54a3065c1a1d413a5fc5a5347
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/457466
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2019-06-19 03:54:58 +00:00

44 lines
1.1 KiB
Bash
Executable File

#!/usr/bin/env bash
testdir=$(readlink -f $(dirname $0))
rootdir=$(readlink -f $testdir/../..)
source $rootdir/test/common/autotest_common.sh
rpc_py=$rootdir/scripts/rpc.py
device=$1
FTL_BDEV_CONF=$testdir/config/ftl.json
json_kill() {
killprocess $svcpid
}
trap "json_kill; exit 1" SIGINT SIGTERM EXIT
$rootdir/test/app/bdev_svc/bdev_svc & svcpid=$!
waitforlisten $svcpid
# Create new bdev from json configuration
$rootdir/scripts/gen_ftl.sh -j -a $device -n nvme0 -l 0-3 | $rpc_py load_subsystem_config
uuid=$($rpc_py get_bdevs | jq -r '.[0].uuid')
$rpc_py delete_ftl_bdev -b nvme0
# Restore bdev from json configuration
$rootdir/scripts/gen_ftl.sh -j -a $device -n nvme0 -l 0-3 -u $uuid | $rpc_py load_subsystem_config
# Create new bdev from json configuration
$rootdir/scripts/gen_ftl.sh -j -a $device -n nvme1 -l 4-5 | $rpc_py load_subsystem_config
# Create new bdev from RPC
$rpc_py construct_ftl_bdev -b nvme2 -a $device -l 7-7
$rpc_py delete_ftl_bdev -b nvme2
$rpc_py delete_ftl_bdev -b nvme0
$rpc_py delete_ftl_bdev -b nvme1
# TODO: add negative test cases
trap - SIGINT SIGTERM EXIT
json_kill