diff options
author | Brad King <brad.king@kitware.com> | 2021-04-14 14:55:10 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2021-04-14 14:55:18 (GMT) |
commit | 337b39d3420aa6160e91037dbbf21b95a972fe13 (patch) | |
tree | 5a4934a4735b2649c0fbf593576d10459ca21437 | |
parent | 156504fe755dedbdc9ed9147a65f4c730aad4b8a (diff) | |
parent | 3fd2cffb4d4649f7773297d5af7a6bda5ef9a69b (diff) | |
download | CMake-337b39d3420aa6160e91037dbbf21b95a972fe13.zip CMake-337b39d3420aa6160e91037dbbf21b95a972fe13.tar.gz CMake-337b39d3420aa6160e91037dbbf21b95a972fe13.tar.bz2 |
Merge topic 'ci-parallelism-limits'
3fd2cffb4d ci: limit builds by machine load
6317f92120 ci: pay attention to the machine load when running tests
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5989
-rw-r--r-- | .gitlab/ci/ctest_build.cmake | 14 | ||||
-rw-r--r-- | .gitlab/ci/ctest_test.cmake | 1 | ||||
-rw-r--r-- | .gitlab/ci/ctest_test_external.cmake | 5 |
3 files changed, 16 insertions, 4 deletions
diff --git a/.gitlab/ci/ctest_build.cmake b/.gitlab/ci/ctest_build.cmake index 6402a5d..e7a0985 100644 --- a/.gitlab/ci/ctest_build.cmake +++ b/.gitlab/ci/ctest_build.cmake @@ -8,10 +8,18 @@ ctest_read_custom_files("${CTEST_BINARY_DIRECTORY}") # Pick up from where the configure left off. ctest_start(APPEND) +include(ProcessorCount) +ProcessorCount(nproc) +if (NOT "$ENV{CTEST_MAX_PARALLELISM}" STREQUAL "") + if (nproc GREATER "$ENV{CTEST_MAX_PARALLELISM}") + set(nproc "$ENV{CTEST_MAX_PARALLELISM}") + endif () +endif () + if (CTEST_CMAKE_GENERATOR STREQUAL "Unix Makefiles") - include(ProcessorCount) - ProcessorCount(nproc) - set(CTEST_BUILD_FLAGS "-j${nproc}") + set(CTEST_BUILD_FLAGS "-j${nproc} -l${nproc}") +elseif (CTEST_CMAKE_GENERATOR MATCHES "Ninja") + set(CTEST_BUILD_FLAGS "-l${nproc}") endif () ctest_build( diff --git a/.gitlab/ci/ctest_test.cmake b/.gitlab/ci/ctest_test.cmake index 08ef18f..facf9ba 100644 --- a/.gitlab/ci/ctest_test.cmake +++ b/.gitlab/ci/ctest_test.cmake @@ -19,6 +19,7 @@ endif () include("${CMAKE_CURRENT_LIST_DIR}/ctest_exclusions.cmake") ctest_test( PARALLEL_LEVEL "${nproc}" + TEST_LOAD "${nproc}" RETURN_VALUE test_result EXCLUDE "${test_exclusions}") ctest_submit(PARTS Test) diff --git a/.gitlab/ci/ctest_test_external.cmake b/.gitlab/ci/ctest_test_external.cmake index 7a5e94a..6576c26 100644 --- a/.gitlab/ci/ctest_test_external.cmake +++ b/.gitlab/ci/ctest_test_external.cmake @@ -42,7 +42,9 @@ if (NOT "$ENV{CTEST_MAX_PARALLELISM}" STREQUAL "") endif () if (CTEST_CMAKE_GENERATOR STREQUAL "Unix Makefiles") - set(CTEST_BUILD_FLAGS "-j${nproc}") + set(CTEST_BUILD_FLAGS "-j${nproc} -l${nproc}") +elseif (CTEST_CMAKE_GENERATOR MATCHES "Ninja") + set(CTEST_BUILD_FLAGS "-l${nproc}") endif () ctest_build( @@ -71,6 +73,7 @@ endif () include("${CMAKE_CURRENT_LIST_DIR}/ctest_exclusions.cmake") ctest_test( PARALLEL_LEVEL "${nproc}" + TEST_LOAD "${nproc}" RETURN_VALUE test_result ${ctest_label_args} EXCLUDE "${test_exclusions}") |