]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
pybind/mgr: add default set of cmake/ctest labels to tests
authorJohn Mulligan <jmulligan@redhat.com>
Fri, 26 Sep 2025 23:03:39 +0000 (19:03 -0400)
committerJohn Mulligan <jmulligan@redhat.com>
Fri, 26 Sep 2025 23:10:35 +0000 (19:10 -0400)
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 <jmulligan@redhat.com>
cmake/modules/AddCephTest.cmake

index 7c40f831f6134e54d525f9a66abc5506c7a42473..f7016f88e02e223f3119f13025bd610bdbb0d8a5 100644 (file)
@@ -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