From 8258d270437e0bc1df5f14f9c09248af7c4989b1 Mon Sep 17 00:00:00 2001 From: John Mulligan Date: Fri, 26 Sep 2025 19:03:39 -0400 Subject: [PATCH] pybind/mgr: add default set of cmake/ctest labels to tests Add a pair of default test labels (`PurePython` and `PythonTox`) to the tests generated by the add_tox_test cmake function. In addition, the function can extend the set of labels applied with a new LABELS argument to the cmake function. Using the label can be done with something like: ``` ctest -L PythonTox -j8 ``` Note that these tests are labeled PurePython because they do not require C extensions to be built. The above example command can be run successfully immediately after configuring, without having to build the C++ sources first. Signed-off-by: John Mulligan --- cmake/modules/AddCephTest.cmake | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/cmake/modules/AddCephTest.cmake b/cmake/modules/AddCephTest.cmake index 7c40f831f6134..f7016f88e02e2 100644 --- a/cmake/modules/AddCephTest.cmake +++ b/cmake/modules/AddCephTest.cmake @@ -91,7 +91,7 @@ endfunction() function(add_tox_test name) set(test_name run-tox-${name}) set(venv_path ${CEPH_BUILD_VIRTUALENV}/${name}-virtualenv) - cmake_parse_arguments(TOXTEST "" "TOX_PATH" "TOX_ENVS" ${ARGN}) + cmake_parse_arguments(TOXTEST "" "TOX_PATH;LABELS" "TOX_ENVS" ${ARGN}) if(DEFINED TOXTEST_TOX_PATH) set(tox_path ${TOXTEST_TOX_PATH}) else() @@ -124,6 +124,18 @@ function(add_tox_test name) --venv-path ${venv_path}) set_tests_properties(${test_name} PROPERTIES FIXTURES_REQUIRED venv-for-${name}) + set(toxtest_default_labels "PurePython;PythonTox") + if(DEFINED TOXTEST_LABELS) + set_tests_properties( + ${test_name} + PROPERTIES + LABELS "${toxtest_default_labels};${TOXTEST_LABELS}") + else() + set_tests_properties( + ${test_name} + PROPERTIES + LABELS "${toxtest_default_labels}") + endif() set_property( TEST ${test_name} PROPERTY ENVIRONMENT -- 2.39.5