Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests now can be SERIAL and use FetchContent to get rapids-cmake #48

Merged
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
2 changes: 1 addition & 1 deletion testing/utils/cmake_build_test.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ include_guard(GLOBAL)
include(utils/cmake_test.cmake)

function(add_cmake_build_test source_or_dir)
add_cmake_test(BUILD "${source_or_dir}")
add_cmake_test(BUILD "${source_or_dir}" ${ARGN})
endfunction()
2 changes: 1 addition & 1 deletion testing/utils/cmake_config_test.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ include_guard(GLOBAL)
include(utils/cmake_test.cmake)

function(add_cmake_config_test source_or_dir)
add_cmake_test(CONFIG "${source_or_dir}")
add_cmake_test(CONFIG "${source_or_dir}" ${ARGN})
endfunction()
11 changes: 10 additions & 1 deletion testing/utils/cmake_test.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ adds a test for each generator:
.. code-block:: cmake

add_cmake_build_test( (config|build|run|install)
<SourceOrDir>
<SourceOrDir>
[SERIAL]
)

``config``
Expand All @@ -51,6 +52,10 @@ adds a test for each generator:

#]=======================================================================]
function(add_cmake_test mode source_or_dir)
set(options SERIAL)
set(one_value)
set(multi_value)
cmake_parse_arguments(RAPIDS_TEST "${options}" "${one_value}" "${multi_value}" ${ARGN})

cmake_detect_generators(supported_generators nice_gen_names)

Expand Down Expand Up @@ -102,6 +107,10 @@ function(add_cmake_test mode source_or_dir)
message(FATAL_ERROR "${mode} mode not one of the valid modes (config|build|install) by add_cmake_build_test")
endif()

if(RAPIDS_TEST_SERIAL)
set_tests_properties(${test_name} PROPERTIES RUN_SERIAL ON)
endif()

# Apply a label to the test based on the folder it is in and the generator used
get_filename_component(label_name ${CMAKE_CURRENT_LIST_DIR} NAME_WE)
string(TOLOWER "${label_name}" lower_case_label )
Expand Down
24 changes: 23 additions & 1 deletion testing/utils/project_template.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,29 @@
#=============================================================================
cmake_minimum_required(VERSION 3.20.1)

add_subdirectory("${rapids-cmake-testing-dir}/../" rapids-cmake)
include(FetchContent)

set(local-rapids-cmake-root "${rapids-cmake-dir}/..")
FetchContent_Declare(
rapids-cmake
GIT_REPOSITORY "${local-rapids-cmake-root}/.git"
GIT_TAG HEAD
)

FetchContent_GetProperties(rapids-cmake)
FetchContent_Populate(rapids-cmake)

# Copy any local uncommited changes over
file(COPY ${local-rapids-cmake-root}/rapids-cmake/
DESTINATION ${rapids-cmake_SOURCE_DIR}/rapids-cmake/)
file(COPY ${local-rapids-cmake-root}/CMakeLists.txt
DESTINATION ${rapids-cmake_SOURCE_DIR}/)
file(COPY ${local-rapids-cmake-root}/init.cmake
DESTINATION ${rapids-cmake_SOURCE_DIR}/)
file(COPY ${local-rapids-cmake-root}/RAPIDS.cmake
DESTINATION ${rapids-cmake_SOURCE_DIR}/)

add_subdirectory(${rapids-cmake_SOURCE_DIR} ${rapids-cmake_BINARY_DIR})

# We need to enable at least one language so that we get properly
# generated system search paths.
Expand Down