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
To run a subset of the tests, use:
```shell-session
$ ninja -C ~/arrow/cpp/debug-build test-arrow_dataset
```

Closes #6547 from bkietz/8014-Provide-CMake-targets-to- and squashes the following commits:

cf9bbb0 <Benjamin Kietzman> test-lable- => test-
90a1a7f <Benjamin Kietzman> ARROW-8014:  Provide Cmake targets exercising tests with a label

Authored-by: Benjamin Kietzman <bengilgit@gmail.com>
Signed-off-by: Antoine Pitrou <antoine@python.org>
  • Loading branch information
bkietz authored and pitrou committed Mar 9, 2020
1 parent a64f590 commit 7db3855
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}")
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 7db3855

Please sign in to comment.