diff options
author | Brad King <brad.king@kitware.com> | 2024-03-06 16:16:33 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2024-03-10 15:41:39 (GMT) |
commit | 5de1e21659090ca83e39e223d351e353347eb88e (patch) | |
tree | 1f618443c6abf98712619a5cb33a35c64439ab74 /Tests/RunCMake/Make | |
parent | bbcbcff7d94bb3dd4b47ed5484207dc960911f4c (diff) | |
download | CMake-5de1e21659090ca83e39e223d351e353347eb88e.zip CMake-5de1e21659090ca83e39e223d351e353347eb88e.tar.gz CMake-5de1e21659090ca83e39e223d351e353347eb88e.tar.bz2 |
ctest: Allow passing -j without value to choose a contextual default
Under job server integration, added by commit 80fe56c481 (ctest: Add
support for running under a make job server on POSIX systems,
2023-11-15, v3.29.0-rc1~324^2), use a very high default so that
parallelism is effectively limited only by available job server tokens.
Otherwise, choose a default limit based on the number of processors.
Also allow passing `0` to specify unbounded parallelism.
Fixes: #25739
Diffstat (limited to 'Tests/RunCMake/Make')
-rw-r--r-- | Tests/RunCMake/Make/CTestJobServer.make | 6 | ||||
-rw-r--r-- | Tests/RunCMake/Make/RunCMakeTest.cmake | 3 |
2 files changed, 6 insertions, 3 deletions
diff --git a/Tests/RunCMake/Make/CTestJobServer.make b/Tests/RunCMake/Make/CTestJobServer.make index 7fc5e28..24fe774 100644 --- a/Tests/RunCMake/Make/CTestJobServer.make +++ b/Tests/RunCMake/Make/CTestJobServer.make @@ -1,11 +1,11 @@ NoPipe: - env MAKEFLAGS= $(CMAKE_CTEST_COMMAND) -j6 + env MAKEFLAGS= $(CMAKE_CTEST_COMMAND) -j0 .PHONY: NoPipe NoTests: - +$(CMAKE_CTEST_COMMAND) -j6 -R NoTests + +$(CMAKE_CTEST_COMMAND) -j -R NoTests .PHONY: NoTests Tests: - +$(CMAKE_CTEST_COMMAND) -j6 + +$(CMAKE_CTEST_COMMAND) -j .PHONY: Tests diff --git a/Tests/RunCMake/Make/RunCMakeTest.cmake b/Tests/RunCMake/Make/RunCMakeTest.cmake index cfaf759..9673329 100644 --- a/Tests/RunCMake/Make/RunCMakeTest.cmake +++ b/Tests/RunCMake/Make/RunCMakeTest.cmake @@ -90,10 +90,13 @@ function(run_CTestJobServer) set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/CTestJobServer-build) run_cmake(CTestJobServer) set(RunCMake_TEST_NO_CLEAN 1) + # Spoof a number of processors to make sure jobserver integration is unbounded. + set(ENV{__CTEST_FAKE_PROCESSOR_COUNT_FOR_TESTING} 1) run_make_rule(CTestJobServer NoPipe 2) run_make_rule(CTestJobServer NoTests 2) run_make_rule(CTestJobServer Tests 2) run_make_rule(CTestJobServer Tests 3) + unset(ENV{__CTEST_FAKE_PROCESSOR_COUNT_FOR_TESTING) endfunction() # Jobservers are currently only supported by GNU makes, except MSYS2 make |