mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-11 16:32:14 -06:00
ci: limit builds by machine load
To avoid starving test jobs, the build jobs should also back off if there is a lot of machine load.
This commit is contained in:
@@ -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(
|
||||
|
||||
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user