]> git.proxmox.com Git - ceph.git/blobdiff - ceph/qa/run-standalone.sh
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / qa / run-standalone.sh
index acb486e1a723383af105ddd01ccbb76067abcdc3..4a7a00546c5971426d182623db6e41d5c99e15c7 100755 (executable)
@@ -6,29 +6,44 @@ if [ ! -e Makefile -o ! -d bin ]; then
     exit 1
 fi
 
-TEMP_DIR=${TMPDIR:-/tmp}
-if [ ! -d $TEMP_DIR/ceph-disk-virtualenv -o ! -d $TEMP_DIR/ceph-detect-init-virtualenv ]; then
-    echo '/tmp/*-virtualenv directories not built. Please run "make check" first.'
-    exit 1
-fi
+function get_cmake_variable() {
+    local variable=$1
+    grep "$variable" CMakeCache.txt | cut -d "=" -f 2
+}
+
+function get_python_path() {
+    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 $(realpath ../src/pybind):$(pwd)/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
+    export PYTHONPATH=$(get_python_path):/usr/local/lib/python2.7/site-packages
     exec_mode=+111
     KERNCORE="kern.corefile"
     COREPATTERN="core.%N.%P"
 else
-    export PYTHONPATH=/usr/lib/python2.7/dist-packages
+    export PYTHONPATH=$(get_python_path)
     exec_mode=/111
     KERNCORE="kernel.core_pattern"
     COREPATTERN="core.%e.%p.%t"
 fi
 
-function finish() {
+function cleanup() {
     if [ -n "$precore" ]; then
-        sudo sysctl -w ${KERNCORE}=${precore}
+        sudo sysctl -w "${KERNCORE}=${precore}"
     fi
+}
+
+function finish() {
+    cleanup
     exit 0
 }
 
@@ -36,6 +51,10 @@ trap finish TERM HUP INT
 
 PATH=$(pwd)/bin:$PATH
 
+# add /sbin and /usr/sbin to PATH to find sysctl in those cases where the
+# user's PATH does not get these directories by default (e.g., tumbleweed)
+PATH=$PATH:/sbin:/usr/sbin
+
 export LD_LIBRARY_PATH="$(pwd)/lib"
 
 # TODO: Use getops
@@ -62,7 +81,7 @@ precore="$(sysctl -n $KERNCORE)"
 if [ "$precore" = "$COREPATTERN" ]; then
     precore=""
 else
-    sudo sysctl -w ${KERNCORE}=${COREPATTERN}
+    sudo sysctl -w "${KERNCORE}=${COREPATTERN}"
 fi
 # Clean out any cores in core target directory (currently .)
 if ls $(dirname $(sysctl -n $KERNCORE)) | grep -q '^core\|core$' ; then
@@ -85,12 +104,12 @@ do
         found=false
         for c in "${!select[@]}"
         do
-            # Get command and any arguments of subset of tests ro tun
+            # Get command and any arguments of subset of tests to run
             allargs="${select[$c]}"
             arg1=$(echo "$allargs" | cut --delimiter " " --field 1)
             # Get user args for this selection for use below
             userargs="$(echo $allargs | cut -s --delimiter " " --field 2-)"
-            if [[ "$arg1" = $(basename $f) ]]; then
+            if [[ "$arg1" = $(basename $f) ]] || [[  "$arg1" = $(dirname $f) ]]; then
                 found=true
                 break
             fi
@@ -122,9 +141,7 @@ do
         fi
     fi
 done
-if [ -n "$precore" ]; then
-    sudo sysctl -w ${KERNCORE}=${precore}
-fi
+cleanup
 
 if [ "$errors" != "0" ]; then
     echo "$errors TESTS FAILED, $count TOTAL TESTS"