commit:     379c70d777b48c796bf8ec54789a3761374b6b02
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sun Dec  1 16:50:31 2024 +0000
Commit:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Mon Jun  2 22:06:14 2025 +0000
URL:        https://gitweb.gentoo.org/proj/kde.git/commit/?id=379c70d7

cmake.eclass: Permit overriding CTEST_{JOBS,LOADAVG}

Bug: https://bugs.gentoo.org/945081
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>

 eclass/cmake.eclass | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/eclass/cmake.eclass b/eclass/cmake.eclass
index cf6c6355b7..2d78ebccf4 100644
--- a/eclass/cmake.eclass
+++ b/eclass/cmake.eclass
@@ -625,6 +625,19 @@ cmake_build() {
        popd > /dev/null || die
 }
 
+# @ECLASS_VARIABLE: CTEST_JOBS
+# @USER_VARIABLE
+# @DESCRIPTION:
+# Maximum number of CTest jobs to run in parallel.  If unset, the value
+# will be determined from make options.
+
+# @ECLASS_VARIABLE: CTEST_LOADAVG
+# @USER_VARIABLE
+# @DESCRIPTION:
+# Maximum load, over which no new jobs will be started by CTest.  Note
+# that unlike make, CTest will not start *any* jobs if the load
+# is exceeded.  If unset, the value will be determined from make options.
+
 # @FUNCTION: cmake_src_test
 # @DESCRIPTION:
 # Function for testing the package. Automatically detects the build type.
@@ -638,8 +651,9 @@ cmake_src_test() {
        [[ -n ${TEST_VERBOSE} ]] && myctestargs+=( --extra-verbose 
--output-on-failure )
        [[ -n ${CMAKE_SKIP_TESTS} ]] && myctestargs+=( -E '('$( IFS='|'; echo 
"${CMAKE_SKIP_TESTS[*]}")')'  )
 
-       set -- ctest -j "$(makeopts_jobs "${MAKEOPTS}" 999)" \
-               --test-load "$(makeopts_loadavg)" "${myctestargs[@]}" "$@"
+       set -- ctest -j "${CTEST_JOBS:-$(makeopts_jobs "${MAKEOPTS}" 999)}" \
+               --test-load "${CTEST_LOADAVG:-$(makeopts_loadavg)}" \
+               "${myctestargs[@]}" "$@"
        echo "$@" >&2
        if "$@" ; then
                einfo "Tests succeeded."

Reply via email to