Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions cpp/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ function(ConfigureTest CMAKE_TEST_NAME)
if(NOT DEFINED INSTALL_TARGET OR "${INSTALL_TARGET}" STREQUAL "")
target_link_options(${CMAKE_TEST_NAME} PRIVATE -Wl,--enable-new-dtags)
endif()
add_test(NAME ${CMAKE_TEST_NAME} COMMAND ${CMAKE_TEST_NAME})
rapids_test_add(NAME ${CMAKE_TEST_NAME} COMMAND ${CMAKE_TEST_NAME} INSTALL_COMPONENT_SET testing)
if(CT_LABELS)
set_tests_properties(${CMAKE_TEST_NAME} PROPERTIES LABELS "${CT_LABELS}")
endif()
Expand All @@ -147,6 +147,15 @@ endif(RAPIDS_DATASET_ROOT_DIR)

# ## test sources
if(BUILD_TESTS)
# Must run before any ConfigureTest/rapids_test_add call in the subdirectories below:
# rapids_test_add records each test against the install component set rapids_test_init()
# creates, and rapids_test_install_relocatable (after the subdirectories) packages that
# record into an installable CTestTestfile.cmake so `ctest` works against the conda
# package directly, not just the build tree.
enable_testing()
include(rapids-test)
rapids_test_init()

if(NOT SKIP_ROUTING_BUILD)
add_subdirectory(routing)
add_subdirectory(distance_engine)
Expand All @@ -160,5 +169,5 @@ if(BUILD_TESTS)
add_subdirectory(qp)
add_subdirectory(utilities)

enable_testing()
rapids_test_install_relocatable(INSTALL_COMPONENT_SET testing DESTINATION bin/gtests/libcuopt)
endif()
2 changes: 1 addition & 1 deletion cpp/tests/linear_programming/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ if (NOT SKIP_C_PYTHON_ADAPTERS)
target_link_options(C_API_TEST PRIVATE -Wl,--enable-new-dtags)
endif()

add_test(NAME C_API_TEST COMMAND C_API_TEST)
rapids_test_add(NAME C_API_TEST COMMAND C_API_TEST INSTALL_COMPONENT_SET testing)
set_tests_properties(C_API_TEST PROPERTIES LABELS "numopt")

install(
Expand Down
11 changes: 8 additions & 3 deletions cpp/tests/linear_programming/grpc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ if(NOT DEFINED INSTALL_TARGET OR "${INSTALL_TARGET}" STREQUAL "")
target_link_options(GRPC_CLIENT_TEST PRIVATE -Wl,--enable-new-dtags)
endif()

add_test(NAME GRPC_CLIENT_TEST COMMAND GRPC_CLIENT_TEST)
rapids_test_add(NAME GRPC_CLIENT_TEST COMMAND GRPC_CLIENT_TEST INSTALL_COMPONENT_SET testing)
set_tests_properties(GRPC_CLIENT_TEST PROPERTIES LABELS "numopt")

install(
Expand Down Expand Up @@ -86,7 +86,8 @@ if(NOT DEFINED INSTALL_TARGET OR "${INSTALL_TARGET}" STREQUAL "")
target_link_options(GRPC_PIPE_SERIALIZATION_TEST PRIVATE -Wl,--enable-new-dtags)
endif()

add_test(NAME GRPC_PIPE_SERIALIZATION_TEST COMMAND GRPC_PIPE_SERIALIZATION_TEST)
rapids_test_add(NAME GRPC_PIPE_SERIALIZATION_TEST COMMAND GRPC_PIPE_SERIALIZATION_TEST
INSTALL_COMPONENT_SET testing)
set_tests_properties(GRPC_PIPE_SERIALIZATION_TEST PROPERTIES LABELS "numopt")

install(
Expand Down Expand Up @@ -137,11 +138,15 @@ endif()
# Integration tests need the server binary to be built first
add_dependencies(GRPC_INTEGRATION_TEST cuopt_grpc_server)

add_test(
rapids_test_add(
NAME GRPC_INTEGRATION_TEST
COMMAND ${CMAKE_COMMAND} -E env
"CUOPT_GRPC_SERVER_PATH=$<TARGET_FILE:cuopt_grpc_server>"
$<TARGET_FILE:GRPC_INTEGRATION_TEST>
# The COMMAND's first token is cmake itself, not the test target, so
# rapids_test_add can't infer what to install -- name it explicitly.
INSTALL_COMPONENT_SET testing
INSTALL_TARGET GRPC_INTEGRATION_TEST
)
set_tests_properties(GRPC_INTEGRATION_TEST PROPERTIES LABELS "numopt")

Expand Down
6 changes: 4 additions & 2 deletions cpp/tests/routing/grpc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ if(NOT DEFINED INSTALL_TARGET OR "${INSTALL_TARGET}" STREQUAL "")
target_link_options(GRPC_ROUTING_PROBLEM_MAPPER_TEST PRIVATE -Wl,--enable-new-dtags)
endif()

add_test(NAME GRPC_ROUTING_PROBLEM_MAPPER_TEST COMMAND GRPC_ROUTING_PROBLEM_MAPPER_TEST)
rapids_test_add(NAME GRPC_ROUTING_PROBLEM_MAPPER_TEST COMMAND GRPC_ROUTING_PROBLEM_MAPPER_TEST
INSTALL_COMPONENT_SET testing)
set_tests_properties(GRPC_ROUTING_PROBLEM_MAPPER_TEST PROPERTIES LABELS "routing")

# Settings mapper round-trip (no running server). This mapper reads
Expand Down Expand Up @@ -96,7 +97,8 @@ if(NOT DEFINED INSTALL_TARGET OR "${INSTALL_TARGET}" STREQUAL "")
target_link_options(GRPC_ROUTING_SETTINGS_MAPPER_TEST PRIVATE -Wl,--enable-new-dtags)
endif()

add_test(NAME GRPC_ROUTING_SETTINGS_MAPPER_TEST COMMAND GRPC_ROUTING_SETTINGS_MAPPER_TEST)
rapids_test_add(NAME GRPC_ROUTING_SETTINGS_MAPPER_TEST COMMAND GRPC_ROUTING_SETTINGS_MAPPER_TEST
INSTALL_COMPONENT_SET testing)
set_tests_properties(GRPC_ROUTING_SETTINGS_MAPPER_TEST PROPERTIES LABELS "routing")

install(
Expand Down
Loading