eclass/cmake: Sync with Gentoo

It's from Gentoo commit b892fae26fa19e44f4189ebf0a4088483770805b.
This commit is contained in:
Flatcar Buildbot 2025-04-07 07:07:54 +00:00 committed by Krzesimir Nowak
parent e026a91dc3
commit 546fb74f12

View File

@ -1,4 +1,4 @@
# Copyright 1999-2024 Gentoo Authors # Copyright 1999-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2 # Distributed under the terms of the GNU General Public License v2
# @ECLASS: cmake.eclass # @ECLASS: cmake.eclass
@ -681,6 +681,19 @@ cmake-utils_src_make() {
die "cmake-utils_src_make is banned. Use cmake_build instead" die "cmake-utils_src_make is banned. Use cmake_build instead"
} }
# @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 # @FUNCTION: cmake_src_test
# @DESCRIPTION: # @DESCRIPTION:
# Function for testing the package. Automatically detects the build type. # Function for testing the package. Automatically detects the build type.
@ -694,8 +707,9 @@ cmake_src_test() {
[[ -n ${TEST_VERBOSE} ]] && myctestargs+=( --extra-verbose --output-on-failure ) [[ -n ${TEST_VERBOSE} ]] && myctestargs+=( --extra-verbose --output-on-failure )
[[ -n ${CMAKE_SKIP_TESTS} ]] && myctestargs+=( -E '('$( IFS='|'; echo "${CMAKE_SKIP_TESTS[*]}")')' ) [[ -n ${CMAKE_SKIP_TESTS} ]] && myctestargs+=( -E '('$( IFS='|'; echo "${CMAKE_SKIP_TESTS[*]}")')' )
set -- ctest -j "$(makeopts_jobs "${MAKEOPTS}" 999)" \ set -- ctest -j "${CTEST_JOBS:-$(get_makeopts_jobs 999)}" \
--test-load "$(makeopts_loadavg)" "${myctestargs[@]}" "$@" --test-load "${CTEST_LOADAVG:-$(get_makeopts_loadavg)}" \
"${myctestargs[@]}" "$@"
echo "$@" >&2 echo "$@" >&2
if "$@" ; then if "$@" ; then
einfo "Tests succeeded." einfo "Tests succeeded."