]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cmake/modules/AddCephTest.cmake: make ${name}-venv a target
authorKefu Chai <kchai@redhat.com>
Sun, 4 Aug 2019 06:31:03 +0000 (14:31 +0800)
committerKefu Chai <kchai@redhat.com>
Mon, 5 Aug 2019 10:47:08 +0000 (18:47 +0800)
so we can prepare the venv for tox with `make tests`. and it's optional,
as run_tox.sh will check for it and setup a venv if it's not around.

Signed-off-by: Kefu Chai <kchai@redhat.com>
cmake/modules/AddCephTest.cmake
src/pybind/mgr/CMakeLists.txt
src/pybind/mgr/ansible/CMakeLists.txt [deleted file]
src/pybind/mgr/insights/CMakeLists.txt [deleted file]
src/pybind/mgr/orchestrator_cli/CMakeLists.txt [deleted file]

index 5bc11c542bad3da94982a4550b6bdab01bd58325..c121083888061e8bbf948c97ef1ad8d47faef40c 100644 (file)
@@ -53,6 +53,15 @@ endfunction()
 
 function(add_tox_test name tox_path)
   set(test_name run-tox-${name})
+  set(venv_path ${CEPH_BUILD_VIRTUALENV}/${name}-virtualenv)
+  add_custom_command(
+    OUTPUT ${venv_path}/bin/activate
+    COMMAND ${CMAKE_SOURCE_DIR}/src/tools/setup-virtualenv.sh ${venv_path}
+    WORKING_DIRECTORY ${tox_path}
+    COMMENT "preparing venv for ${name}")
+  add_custom_target(${name}-venv
+    DEPENDS ${venv_path}/bin/activate)
+  add_dependencies(tests ${name}-venv)
   add_test(
     NAME ${test_name}
     COMMAND ${CMAKE_SOURCE_DIR}/src/script/run_tox.sh
@@ -61,7 +70,7 @@ function(add_tox_test name tox_path)
               --with-python2 ${WITH_PYTHON2}
               --with-python3 ${WITH_PYTHON3}
               --tox-path ${tox_path}
-              --venv-path ${CEPH_BUILD_VIRTUALENV}/${name})
+              --venv-path ${venv_path})
   set_property(
     TEST ${test_name}
     PROPERTY ENVIRONMENT
index 2b5f4a7d4ad73dfcfac618d2c033e7592bd8c9ff..e7a373e0c8262380964e243e853cb1712e12bc44 100644 (file)
@@ -1,7 +1,4 @@
 add_subdirectory(dashboard)
-add_subdirectory(insights)
-add_subdirectory(ansible)
-add_subdirectory(orchestrator_cli)
 
 # Location needs to match default setting for mgr_module_path, currently:
 # OPTION(mgr_module_path, OPT_STR, CEPH_PKGLIBDIR "/mgr")
diff --git a/src/pybind/mgr/ansible/CMakeLists.txt b/src/pybind/mgr/ansible/CMakeLists.txt
deleted file mode 100644 (file)
index c706aa8..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-set(MGR_ANSIBLE_VIRTUALENV ${CEPH_BUILD_VIRTUALENV}/mgr-ansible-virtualenv)
-
-add_custom_target(mgr-ansible-test-venv
-  COMMAND ${CMAKE_SOURCE_DIR}/src/tools/setup-virtualenv.sh --python=${MGR_PYTHON_EXECUTABLE} ${MGR_ANSIBLE_VIRTUALENV}
-  WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/src/pybind/mgr/ansible
-  COMMENT "ansible tests virtualenv is being created")
-add_dependencies(tests mgr-ansible-test-venv)
diff --git a/src/pybind/mgr/insights/CMakeLists.txt b/src/pybind/mgr/insights/CMakeLists.txt
deleted file mode 100644 (file)
index 00722a9..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-set(MGR_INSIGHTS_VIRTUALENV ${CEPH_BUILD_VIRTUALENV}/mgr-insights-virtualenv)
-
-add_custom_target(mgr-insights-test-venv
-  COMMAND ${CMAKE_SOURCE_DIR}/src/tools/setup-virtualenv.sh --python=${MGR_PYTHON_EXECUTABLE} ${MGR_INSIGHTS_VIRTUALENV}
-  WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/src/pybind/mgr/insights
-  COMMENT "insights tests virtualenv is being created")
-add_dependencies(tests mgr-insights-test-venv)
diff --git a/src/pybind/mgr/orchestrator_cli/CMakeLists.txt b/src/pybind/mgr/orchestrator_cli/CMakeLists.txt
deleted file mode 100644 (file)
index 195b79a..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-set(MGR_ORCHESTRATOR_CLI_VIRTUALENV ${CEPH_BUILD_VIRTUALENV}/mgr-orchestrator_cli-virtualenv)
-
-add_custom_target(mgr-orchestrator_cli-test-venv
-  COMMAND ${CMAKE_SOURCE_DIR}/src/tools/setup-virtualenv.sh --python=${MGR_PYTHON_EXECUTABLE} ${MGR_ORCHESTRATOR_CLI_VIRTUALENV}
-  WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/src/pybind/mgr/orchestrator_cli
-  COMMENT "orchestrator_cli tests virtualenv is being created")
-add_dependencies(tests mgr-orchestrator_cli-test-venv)