-diff --git a/cmake/modules/AddCephTest.cmake b/cmake/modules/AddCephTest.cmake
-index d26d003c779..bc962e3aa73 100644
--- a/cmake/modules/AddCephTest.cmake
+++ b/cmake/modules/AddCephTest.cmake
-@@ -68,14 +68,6 @@ function(add_tox_test name)
- list(APPEND tox_envs py3)
+@@ -70,17 +70,6 @@ function(add_tox_test name)
endif()
string(REPLACE ";" "," tox_envs "${tox_envs}")
-- add_custom_command(
-- OUTPUT ${venv_path}/bin/activate
-- COMMAND ${CMAKE_SOURCE_DIR}/src/tools/setup-virtualenv.sh --python="${Python3_EXECUTABLE}" ${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 setup-venv-for-${name}
+- COMMAND ${CMAKE_SOURCE_DIR}/src/tools/setup-virtualenv.sh --python=${Python3_EXECUTABLE} ${venv_path}
+- WORKING_DIRECTORY ${tox_path})
+- set_tests_properties(setup-venv-for-${name} PROPERTIES
+- FIXTURES_SETUP venv-for-${name})
+- add_test(
+- NAME teardown-venv-for-${name}
+- COMMAND ${CMAKE_COMMAND} -E remove_directory ${venv_path})
+- set_tests_properties(teardown-venv-for-${name} PROPERTIES
+- FIXTURES_CLEANUP venv-for-${name})
+- add_test(
NAME ${test_name}
COMMAND ${CMAKE_SOURCE_DIR}/src/script/run_tox.sh
+ --source-dir ${CMAKE_SOURCE_DIR}
+@@ -88,8 +77,7 @@ function(add_tox_test name)
+ --tox-path ${tox_path}
+ --tox-envs ${tox_envs}
+ --venv-path ${venv_path})
+- set_tests_properties(${test_name} PROPERTIES
+- FIXTURES_REQUIRED venv-for-${name})
++ set_tests_properties(${test_name} PROPERTIES)
+ set_property(
+ TEST ${test_name}
+ PROPERTY ENVIRONMENT
diff --git a/src/ceph-volume/CMakeLists.txt b/src/ceph-volume/CMakeLists.txt
index 9166553dc73..9a6c87595b9 100644
--- a/src/ceph-volume/CMakeLists.txt
add_custom_target(ceph-volume-venv-setup
DEPENDS ${CEPH_VOLUME_VIRTUALENV}/bin/ceph-volume)
-diff --git a/src/pybind/mgr/dashboard/CMakeLists.txt b/src/pybind/mgr/dashboard/CMakeLists.txt
-index 9b3432213a0..973b185f5de 100644
---- a/src/pybind/mgr/dashboard/CMakeLists.txt
-+++ b/src/pybind/mgr/dashboard/CMakeLists.txt
-@@ -5,9 +5,6 @@ function(add_npm_command)
+--- a/src/pybind/mgr/dashboard/frontend/CMakeLists.txt
++++ b/src/pybind/mgr/dashboard/frontend/CMakeLists.txt
+@@ -5,17 +5,10 @@ function(add_npm_command)
set(multi_kw COMMAND DEPENDS)
cmake_parse_arguments(NC "${options}" "${single_kw}" "${multi_kw}" ${ARGN})
string(REPLACE ";" " " command "${NC_COMMAND}")
- if(NC_NODEENV)
-- string(REGEX REPLACE "^(.*(npm|npx) .*)$" ". ${mgr-dashboard-nodeenv-dir}/bin/activate && \\1 && deactivate" command ${command})
+- string(REGEX REPLACE
+- "^(([^ ]+=[^ ]+ )*npm .*)$"
+- ". ${mgr-dashboard-nodeenv-dir}/bin/activate && \\1 && deactivate"
+- command ${command})
+- else()
+ string(REGEX REPLACE
+ "^([^ ]=[^ ] )*npm (.*)$"
+ "\\1${NPM_EXECUTABLE} \\2"
+ command ${command})
- endif()
string(REPLACE " " ";" command "${command}")
add_custom_command(
OUTPUT "${NC_OUTPUT}"
-@@ -51,11 +48,8 @@ else(WITH_SYSTEM_NPM)
+@@ -36,9 +29,7 @@ function(add_npm_options)
+ list(GET opt 1 value)
+ list(APPEND commands
+ COMMAND
+- . ${NC_NODEENV_DIR}/bin/activate &&
+- npm config set ${key} ${value} --userconfig ${NC_NODEENV_DIR}/.npmrc &&
+- deactivate)
++ npm config set ${key} ${value} --userconfig ${NC_NODEENV_DIR}/.npmrc
+ endforeach()
+ add_custom_target(${NC_TARGET}
+ ${commands}
+@@ -60,11 +51,8 @@ else(WITH_SYSTEM_NPM)
set(node_mirror_opt "--mirror=$ENV{NODE_MIRROR}")
endif()
add_custom_command(
- COMMAND ${mgr-dashboard-nodeenv-dir}/bin/nodeenv --verbose ${node_mirror_opt} -p --node=12.18.2
- COMMAND mkdir ${mgr-dashboard-nodeenv-dir}/.npm
+ OUTPUT "/bin/npm"
-+ COMMAND /bin/nodeenv ${node_mirror_opt} -p --node=12.18.2
++ COMMAND /bin/nodeenv --verbose ${node_mirror_opt} -p --node=12.18.2
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
- COMMENT "dashboard nodeenv is being installed"
- )
+ COMMENT "dashboard nodeenv is being installed")
+ if(DEFINED ENV{NPM_REGISTRY})