]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
qa/run-standalone.sh: pass PYTHONPATH env var to test
authorKefu Chai <kchai@redhat.com>
Mon, 26 Feb 2018 06:38:49 +0000 (14:38 +0800)
committerKefu Chai <kchai@redhat.com>
Mon, 26 Feb 2018 06:38:52 +0000 (14:38 +0800)
otherwise ceph-mgr will refuse to start if the required python binding,
a.k.a mgr_module is not available in default sys.path.

Signed-off-by: Kefu Chai <kchai@redhat.com>
qa/run-standalone.sh

index aef60b6e05842ad8634c14b170f4c245cfdcfa5e..9091308915224634f869c9f893983d384e3ed428 100755 (executable)
@@ -12,6 +12,25 @@ if [ ! -d $TEMP_DIR/ceph-disk-virtualenv -o ! -d $TEMP_DIR/ceph-detect-init-virt
     exit 1
 fi
 
+function get_cmake_variable() {
+    local variable=$1
+    grep "$variable" CMakeCache.txt | cut -d "=" -f 2
+}
+
+function cython_module_path() {
+    local ceph_lib=$1
+    shift
+    local py_ver=$(get_cmake_variable MGR_PYTHON_VERSION | cut -d '.' -f1)
+    if [ -z "${py_ver}" ]; then
+        if [ $(get_cmake_variable WITH_PYTHON2) = ON ]; then
+            py_ver=2
+        else
+            py_ver=3
+        fi
+    fi
+    echo $ceph_lib/cython_modules/lib.$py_ver
+}
+
 if [ `uname` = FreeBSD ]; then
     # otherwise module prettytable will not be found
     export PYTHONPATH=/usr/local/lib/python2.7/site-packages
@@ -104,6 +123,7 @@ do
         if ! PATH=$PATH:bin \
            CEPH_ROOT=.. \
            CEPH_LIB=lib \
+           PYTHONPATH=$(realpath ../src/pybind):$(cython_module_path lib) \
            LOCALRUN=yes \
            $cmd ; then
           echo "$f .............. FAILED"