From 7acbefadace28412f395bb98aec5651d5ec70666 Mon Sep 17 00:00:00 2001 From: David Zafman Date: Mon, 18 Apr 2016 18:27:52 -0700 Subject: [PATCH] test: Fix ceph-objectstore-tool test to run manually from src non-cmake Fix init-ceph to handle it when CEPH_* values set Signed-off-by: David Zafman (cherry picked from commit 5e8e03b4d030db57c93047551d5b92db0b604063) --- src/init-ceph.in | 3 +-- src/test/ceph_objectstore_tool.py | 21 ++++++++++++++++----- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/init-ceph.in b/src/init-ceph.in index 8b6d3148e362..bae87a1acd7e 100755 --- a/src/init-ceph.in +++ b/src/init-ceph.in @@ -39,10 +39,9 @@ else fi if [ -n $CEPH_BIN ] && [ -n $CEPH_ROOT ] && [ -n $CEPH_BUILD_DIR ]; then - #need second look at all variables, especially ETCDIR BINDIR=$CEPH_BIN SBINDIR=$CEPH_ROOT/src - ETCDIR=$CEPH_BUILD_DIR + ETCDIR=$CEPH_BIN LIBEXECDIR=$CEPH_ROOT/src SYSTEMD_RUN="" ASSUME_DEV=1 diff --git a/src/test/ceph_objectstore_tool.py b/src/test/ceph_objectstore_tool.py index 4182103b6c54..91804751465e 100755 --- a/src/test/ceph_objectstore_tool.py +++ b/src/test/ceph_objectstore_tool.py @@ -43,7 +43,7 @@ logging.basicConfig(format='%(levelname)s:%(message)s', level=logging.WARNING) def wait_for_health(): print "Wait for health_ok...", tries = 0 - while call("./ceph health 2> /dev/null | grep -v 'HEALTH_OK\|HEALTH_WARN' > /dev/null", shell=True) == 0: + while call("{path}/ceph health 2> /dev/null | grep -v 'HEALTH_OK\|HEALTH_WARN' > /dev/null".format(path=CEPH_BIN), shell=True) == 0: tries += 1 if tries == 150: raise Exception("Time exceeded to go to health") @@ -367,11 +367,22 @@ def test_dump_journal(CFSD_PREFIX, osds): return ERRORS - -CEPH_DIR = os.environ['CEPH_BUILD_DIR'] + "/ceph_objectstore_tool_dir" +CEPH_BUILD_DIR = os.environ.get('CEPH_BUILD_DIR') +CEPH_BIN = os.environ.get('CEPH_BIN') +CEPH_ROOT = os.environ.get('CEPH_ROOT') + +if not CEPH_BUILD_DIR: + CEPH_BUILD_DIR=os.getcwd() + os.putenv('CEPH_BUILD_DIR', CEPH_BUILD_DIR) + CEPH_BIN=CEPH_BUILD_DIR + os.putenv('CEPH_BIN', CEPH_BIN) + CEPH_ROOT=os.path.dirname(CEPH_BUILD_DIR) + os.putenv('CEPH_ROOT', CEPH_ROOT) + CEPH_LIB=os.path.join(CEPH_BIN, '.libs') + os.putenv('CEPH_LIB', CEPH_LIB) + +CEPH_DIR = CEPH_BUILD_DIR + "/ceph_objectstore_tool_dir" CEPH_CONF = os.path.join(CEPH_DIR, 'ceph.conf') -CEPH_BIN = os.environ['CEPH_BIN'] -CEPH_ROOT = os.environ['CEPH_ROOT'] def kill_daemons(): call("{path}/init-ceph -c {conf} stop osd mon > /dev/null 2>&1".format(conf=CEPH_CONF, path=CEPH_BIN), shell=True) -- 2.47.3