Skip to content

Commit

Permalink
Ensure tests the modify same git repo don't execute at the same time (#…
Browse files Browse the repository at this point in the history
…446)

A subset of the rapids_cpm tests modify the same git repo active branch which isn't safe. We need to serialize those tests to ensure everything works robustly.

Authors:
  - Robert Maynard (https://github.com/robertmaynard)

Approvers:
  - Bradley Dice (https://github.com/bdice)
  - Vyas Ramasubramani (https://github.com/vyasr)

URL: #446
  • Loading branch information
robertmaynard authored Jul 25, 2023
1 parent 280908b commit 2787398
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 8 deletions.
12 changes: 6 additions & 6 deletions testing/cpm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,16 @@ add_cmake_config_test( cpm_gbench-simple.cmake )
add_cmake_config_test( cpm_gtest-export.cmake )
add_cmake_config_test( cpm_gtest-simple.cmake )

add_cmake_config_test( cpm_libcudacxx-after_cpmfind.cmake )
add_cmake_config_test( cpm_libcudacxx-after_cpmfind.cmake SERIAL)
add_cmake_config_test( cpm_libcudacxx-export.cmake )
add_cmake_config_test( cpm_libcudacxx-simple.cmake )
add_cmake_build_test( cpm_libcudacxx-verify-install-custom-libdir )

add_cmake_config_test( cpm_nvbench-export.cmake )
add_cmake_config_test( cpm_nvbench-simple.cmake )
add_cmake_config_test( cpm_nvbench-already-found-fmt.cmake )
add_cmake_build_test( cpm_nvbench-conda.cmake )
add_cmake_build_test( cpm_nvbench-conda-fmt.cmake )
add_cmake_config_test( cpm_nvbench-export.cmake SERIAL )
add_cmake_config_test( cpm_nvbench-simple.cmake SERIAL)
add_cmake_config_test( cpm_nvbench-already-found-fmt.cmake SERIAL)
add_cmake_build_test( cpm_nvbench-conda.cmake SERIAL)
add_cmake_build_test( cpm_nvbench-conda-fmt.cmake SERIAL)

add_cmake_config_test( cpm_nvcomp-export.cmake )
add_cmake_config_test( cpm_nvcomp-proprietary-off.cmake )
Expand Down
2 changes: 1 addition & 1 deletion testing/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ if(RAPIDS_CMAKE_TESTING_GPU_COUNT GREATER 0)
add_cmake_ctest_test(add-allocation-simple)
add_cmake_ctest_test(add-allocation-throws-runtime-error)
add_cmake_ctest_test(add-multi-allocations-same-gpu)
add_cmake_ctest_test(add-multi-jobs-single-gpu)
add_cmake_ctest_test(add-multi-jobs-single-gpu SERIAL)
add_cmake_ctest_test(no_add-with-cpp-handler-from-docs)
add_cmake_ctest_test(no_add-with-no-resource-spec)
endif()
Expand Down
14 changes: 13 additions & 1 deletion testing/utils/cmake_test.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ adds a test for each generator:

add_cmake_build_test( (config|build|test|install)
<SourceOrDir>
[SERIAL]
[SHOULD_FAIL <expected error message string>]
)

Expand All @@ -57,7 +58,7 @@ adds a test for each generator:

#]=======================================================================]
function(add_cmake_test mode source_or_dir)
set(options)
set(options SERIAL)
set(one_value SHOULD_FAIL)
set(multi_value)
cmake_parse_arguments(RAPIDS_TEST "${options}" "${one_value}" "${multi_value}" ${ARGN})
Expand Down Expand Up @@ -141,6 +142,17 @@ 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)
if(TEST ${test_name}_configure)
message(STATUS "${test_name}_configure is serial")
set_tests_properties(${test_name}_configure PROPERTIES RUN_SERIAL ON)
endif()
if(TEST ${test_name}_build)
set_tests_properties(${test_name}_build PROPERTIES RUN_SERIAL ON)
endif()
endif()

if(RAPIDS_TEST_SHOULD_FAIL)
# Make sure we have a match
set_tests_properties(${test_name} PROPERTIES WILL_FAIL ON)
Expand Down

0 comments on commit 2787398

Please sign in to comment.