]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
test: ceph-disk: run ceph-disk with cmake 9919/head
authorKefu Chai <kchai@redhat.com>
Fri, 24 Jun 2016 07:26:54 +0000 (15:26 +0800)
committerKefu Chai <kchai@redhat.com>
Mon, 27 Jun 2016 01:24:07 +0000 (09:24 +0800)
* CMakeLists.txt: do not run ceph-disk/run-tox.sh in its source
  directory anymore, "ceph" cli needs to run in the build directory.
* CMakeLists.txt, run-tox.sh:
  - pass $CEPH_BUILD_DIR down to tox.ini, so tox can set the working
    directory to $CEPH_BUILD_DIR to $CMAKE_BINARY_DIR, in which the
    "ceph" cli will be able to figure out where the pybind dso are
    located, and respawn itself with the necessary paths set accordingly.
  - pass $CEPH_BUILD_VIRTUALENV to tox, so ceph-helpers.sh is able to
    set the paths to ceph-disk and ceph-detect-init right.
* run-tox.sh: specify the full path of tox.ini, since we will call
  "tox" in the build directory.
* tox.ini:
  - move the non-flake8 related settings into [testenv:py27] section.
  - always use absolute path, as we will call "tox" in the build
    directory, instead where "tox.ini" lives.

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/ceph-disk/run-tox.sh
src/ceph-disk/tox.ini
src/test/CMakeLists.txt

index 13447127de802b743dfac43b7e0ca72b0fa7ea93..ae96e803dea1e58bbb0d9a48e05d0eb249d7e9fc 100755 (executable)
 # run from the ceph-disk directory or from its parent
 : ${CEPH_DISK_VIRTUALENV:=/tmp/ceph-disk-virtualenv}
 test -d ceph-disk && cd ceph-disk
+
+if [ -e tox.ini ]; then
+    TOX_PATH=`readlink -f tox.ini`
+else
+    TOX_PATH=`readlink -f $(dirname $0)/tox.ini`
+fi
+
+if [ -z $CEPH_BUILD_DIR ]; then
+    export CEPH_BUILD_DIR=$(dirname ${TOX_PATH})
+fi
+
 source ${CEPH_DISK_VIRTUALENV}/bin/activate
-tox > ${CEPH_DISK_VIRTUALENV}/tox.out 2>&1
+tox -c ${TOX_PATH} > ${CEPH_DISK_VIRTUALENV}/tox.out 2>&1
 status=$?
 grep -v InterpreterNotFound < ${CEPH_DISK_VIRTUALENV}/tox.out
 exit $status
index 34c58a7c853ccfa4b4fbd7e4807369e3440a58c9..786136e058f98eada49715dcb187622c0eccb272 100644 (file)
@@ -5,7 +5,6 @@ envlist = flake8,py27
 setenv =
        VIRTUAL_ENV={envdir}
        CEPH_DISK={envbindir}/coverage run --append --source=ceph_disk -- {envbindir}/ceph-disk
-passenv = CEPH_ROOT CEPH_BIN CEPH_LIB
 usedevelop = true
 deps =
   {env:NO_INDEX:}
@@ -15,9 +14,12 @@ deps =
   -r{toxinidir}/test-requirements.txt
   ../ceph-detect-init
 
-commands = coverage run --append --source=ceph_disk {envbindir}/py.test -vv tests/test_main.py
-           coverage run --append --source=ceph_disk {envbindir}/py.test -vv tests/test_prepare.py
-           tests/ceph-disk.sh
+[testenv:py27]
+passenv = CEPH_ROOT CEPH_BIN CEPH_LIB CEPH_BUILD_VIRTUALENV
+changedir = {env:CEPH_BUILD_DIR}
+commands = coverage run --append --source=ceph_disk {envbindir}/py.test -vv {toxinidir}/tests/test_main.py
+           coverage run --append --source=ceph_disk {envbindir}/py.test -vv {toxinidir}/tests/test_prepare.py
+           {toxinidir}/tests/ceph-disk.sh
            coverage report --omit=*test*,*tox* --show-missing
 
 [testenv:flake8]
index 08baa54fd8de51f6809b9a46c5006e77431b01e0..aebddb3b3482c2ff770877925dfa8761b4895fe3 100644 (file)
@@ -518,7 +518,7 @@ add_ceph_test(test_objectstore_memstore.sh ${CMAKE_CURRENT_SOURCE_DIR}/test_obje
 add_ceph_test(test_pidfile.sh ${CMAKE_CURRENT_SOURCE_DIR}/test_pidfile.sh)
 add_ceph_test(unittest_bufferlist.sh ${CMAKE_SOURCE_DIR}/src/unittest_bufferlist.sh)
 
-add_test(NAME run-tox-ceph-disk COMMAND bash ${CMAKE_SOURCE_DIR}/src/ceph-disk/run-tox.sh WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/src)
+add_test(NAME run-tox-ceph-disk COMMAND bash ${CMAKE_SOURCE_DIR}/src/ceph-disk/run-tox.sh)
 add_dependencies(check run-tox-ceph-disk)
 
 add_test(NAME run-tox-ceph-detect-init COMMAND bash ${CMAKE_SOURCE_DIR}/src/ceph-detect-init/run-tox.sh WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/src)
@@ -530,10 +530,12 @@ set(CEPH_DETECT_INIT_VIRTUALENV ${CEPH_BUILD_VIRTUALENV}/ceph-detect-init-virtua
 set_property(TEST 
   run-tox-ceph-disk
   run-tox-ceph-detect-init
-  PROPERTY ENVIRONMENT 
+  PROPERTY ENVIRONMENT
+  CEPH_BUILD_DIR=${CMAKE_BINARY_DIR}
   CEPH_ROOT=${CMAKE_SOURCE_DIR}
   CEPH_BIN=${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
   CEPH_LIB=${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
+  CEPH_BUILD_VIRTUALENV=${CEPH_BUILD_VIRTUALENV}
   CEPH_DISK_VIRTUALENV=${CEPH_DISK_VIRTUALENV}
   CEPH_DETECT_INIT_VIRTUALENV=${CEPH_DETECT_INIT_VIRTUALENV}
   LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/lib