Skip to content

Commit

Permalink
ARROW-8014: [C++] Provide Cmake targets exercising tests with a label
Browse files Browse the repository at this point in the history
  • Loading branch information
bkietz committed Mar 5, 2020
1 parent 245091c commit 0b0690c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
15 changes: 15 additions & 0 deletions cpp/cmake_modules/BuildUtils.cmake
Expand Up @@ -657,6 +657,21 @@ function(ADD_TEST_CASE REL_TEST_NAME)
set(ARG_LABELS unittest)
endif()

foreach(LABEL ${ARG_LABELS})
# ensure there is a cmake target which exercises tests with this LABEL
set(LABEL_TEST_NAME "test-label-${LABEL}")
if(NOT TARGET ${LABEL_TEST_NAME})
add_custom_target(${LABEL_TEST_NAME}
ctest
-L
"${LABEL}"
--output-on-failure
USES_TERMINAL)
endif()
# ensure the test is (re)built before the LABEL test runs
add_dependencies(${LABEL_TEST_NAME} ${TEST_NAME})
endforeach()

set_property(TEST ${TEST_NAME} APPEND PROPERTY LABELS ${ARG_LABELS})
endfunction()

Expand Down
2 changes: 0 additions & 2 deletions cpp/src/arrow/CMakeLists.txt
Expand Up @@ -45,8 +45,6 @@ function(ADD_ARROW_TEST REL_TEST_NAME)

if(ARG_LABELS)
set(LABELS ${ARG_LABELS})
else()
set(LABELS "arrow-tests")
endif()

# Because of https://gitlab.kitware.com/cmake/cmake/issues/20289,
Expand Down

0 comments on commit 0b0690c

Please sign in to comment.