]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
test: Fix ceph-objectstore-tool test to run manually from src non-cmake
authorDavid Zafman <dzafman@redhat.com>
Tue, 19 Apr 2016 01:27:52 +0000 (18:27 -0700)
committerDavid Zafman <dzafman@redhat.com>
Tue, 19 Apr 2016 01:29:17 +0000 (18:29 -0700)
Fix init-ceph to handle it when CEPH_* values set

Signed-off-by: David Zafman <dzafman@redhat.com>
src/init-ceph.in
src/test/ceph_objectstore_tool.py

index 8b6d3148e3625df14d2340ce287bb868687627a7..bae87a1acd7e21aa7c9b224abe0720e3c21249d4 100755 (executable)
@@ -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
index 4182103b6c5421b8d2a92cf32676005e6ccdbd69..91804751465e6405562fbff3d0dda4090c53e4d4 100755 (executable)
@@ -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)