From 084011d8fae0916d3ec3d270c418a907fdf0d18f Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Mon, 26 Feb 2018 14:38:49 +0800 Subject: [PATCH] qa/run-standalone.sh: pass PYTHONPATH env var to test 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 --- qa/run-standalone.sh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/qa/run-standalone.sh b/qa/run-standalone.sh index aef60b6e0584..909130891522 100755 --- a/qa/run-standalone.sh +++ b/qa/run-standalone.sh @@ -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" -- 2.47.3