git: 3522562bd144 - main - Mk/Uses/cmake.mk: Make parallel level adjustable for tests

From: Daniel Engberg <diizzy_at_FreeBSD.org>
Date: Thu, 06 Jun 2024 19:07:54 UTC
The branch main has been updated by diizzy:

URL: https://cgit.FreeBSD.org/ports/commit/?id=3522562bd1443ced62a674a22fec1877277b1b3b

commit 3522562bd1443ced62a674a22fec1877277b1b3b
Author:     Daniel Engberg <diizzy@FreeBSD.org>
AuthorDate: 2024-06-05 21:44:44 +0000
Commit:     Daniel Engberg <diizzy@FreeBSD.org>
CommitDate: 2024-06-06 19:05:47 +0000

    Mk/Uses/cmake.mk: Make parallel level adjustable for tests
    
    Some projects don't support running tests in parallel
    (for example chinese/libchewing) and currently there's no way of
    disabling it.
    
    Add CMAKE_TESTING_PARALLEL_LEVEL and default to MAKE_JOBS_NUMBER
    Switch to MAKE_JOBS_NUMBER as _MAKE_JOBS_NUMBER is unset if
    MAKE_JOBS_UNSAFE is defined.
    
    PR:             279316
    Approved by:    portmgr (arrowd)
---
 Mk/Uses/cmake.mk | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Mk/Uses/cmake.mk b/Mk/Uses/cmake.mk
index 39a9a902ef4a..6e46c2c0051f 100644
--- a/Mk/Uses/cmake.mk
+++ b/Mk/Uses/cmake.mk
@@ -179,6 +179,7 @@ do-configure:
 
 .    if !target(do-test) && ${cmake_ARGS:Mtesting}
 CMAKE_TESTING_ON?=		BUILD_TESTING
+CMAKE_TESTING_PARALLEL_LEVEL?=	${MAKE_JOBS_NUMBER}
 CMAKE_TESTING_TARGET?=		test
 
 # Handle the option-like CMAKE_TESTING_ON and CMAKE_TESTING_OFF lists.
@@ -192,7 +193,7 @@ do-test:
 	@cd ${BUILD_WRKSRC} && \
 		${SETENVI} ${WRK_ENV} ${CONFIGURE_ENV} ${CMAKE_BIN} ${CMAKE_ARGS} ${CMAKE_TESTING_ARGS} ${CMAKE_SOURCE_PATH} && \
 		${SETENVI} ${WRK_ENV} ${MAKE_ENV} ${MAKE_CMD} ${_MAKE_JOBS} ${MAKE_ARGS} ${ALL_TARGET} && \
-		${SETENVI} ${WRK_ENV} ${TEST_ENV} CTEST_PARALLEL_LEVEL=${_MAKE_JOBS_NUMBER} ${MAKE_CMD} ${MAKE_ARGS} ${CMAKE_TESTING_TARGET}
+		${SETENVI} ${WRK_ENV} ${TEST_ENV} CTEST_PARALLEL_LEVEL=${CMAKE_TESTING_PARALLEL_LEVEL} ${MAKE_CMD} ${MAKE_ARGS} ${CMAKE_TESTING_TARGET}
 .    endif
 .  endif