From 19d56fead70a93e5cdd443c67a60ce7918a40b5d Mon Sep 17 00:00:00 2001 From: Daniel Verkamp Date: Wed, 16 Nov 2016 11:18:40 -0700 Subject: [PATCH] test: move RBD test pool setup to autotest.sh Leave the RBD pool configured and running throughout the tests so that it can be used in multiple test scripts. Change-Id: I056ef29bd8d97fa63f1ca78ee728f9c51f4bdf41 Signed-off-by: Daniel Verkamp --- autotest.sh | 5 +++++ scripts/autotest_common.sh | 17 +++++++++++++++++ test/iscsi_tgt/rbd/rbd.sh | 10 ---------- 3 files changed, 22 insertions(+), 10 deletions(-) diff --git a/autotest.sh b/autotest.sh index 034cdde0b..550e9f4c6 100755 --- a/autotest.sh +++ b/autotest.sh @@ -65,6 +65,10 @@ timing_enter nvmf_setup rdma_device_init timing_exit nvmf_setup +timing_enter rbd_setup +rbd_setup +timing_exit rbd_setup + ##################### # Unit Tests ##################### @@ -113,6 +117,7 @@ run_test test/nvmf/nvme_cli/nvme_cli.sh timing_exit nvmf timing_enter cleanup +rbd_cleanup ./scripts/setup.sh reset ./scripts/build_kmod.sh clean timing_exit cleanup diff --git a/scripts/autotest_common.sh b/scripts/autotest_common.sh index 5571d3320..3d4c29336 100755 --- a/scripts/autotest_common.sh +++ b/scripts/autotest_common.sh @@ -159,6 +159,23 @@ function start_iscsi_service() { fi } +function rbd_setup() { + export CEPH_DIR=/home/sys_sgsw/ceph/build + + if [ -d $CEPH_DIR ]; then + export RBD_POOL=rbd + export RBD_NAME=foo + (cd $CEPH_DIR && ../src/vstart.sh -d -n -x -l) + /usr/local/bin/rbd create $RBD_NAME --size 1000 + fi +} + +function rbd_cleanup() { + if [ -d $CEPH_DIR ]; then + (cd $CEPH_DIR && ../src/stop.sh || true) + fi +} + function run_test() { echo "************************************" echo "START TEST $1" diff --git a/test/iscsi_tgt/rbd/rbd.sh b/test/iscsi_tgt/rbd/rbd.sh index f9d5c1f36..4cb4f3d27 100755 --- a/test/iscsi_tgt/rbd/rbd.sh +++ b/test/iscsi_tgt/rbd/rbd.sh @@ -4,20 +4,11 @@ testdir=$(readlink -f $(dirname $0)) rootdir=$testdir/../../.. source $rootdir/scripts/autotest_common.sh -CEPH_DIR=/home/sys_sgsw/ceph/build - -# RBD pool name and RBD name -RBD_POOL=rbd -RBD_NAME=foo - if [ ! -d $CEPH_DIR ]; then echo "Ceph directory not detected on this system; skipping RBD tests" exit 0 fi -(cd $CEPH_DIR && ../src/vstart.sh -d -n -x -l) -/usr/local/bin/rbd create $RBD_NAME --size 1000 - if [ -z "$TARGET_IP" ]; then echo "TARGET_IP not defined in environment" exit 1 @@ -73,6 +64,5 @@ trap - SIGINT SIGTERM EXIT iscsicleanup killprocess $pid -(cd $CEPH_DIR && sh -x ../src/stop.sh || true) timing_exit rbd