Created attachment 250976 [details] Patch for cmake.mk Some projects don't support running tests in parallel (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. Reference: https://git.alpinelinux.org/aports/tree/community/libchewing/APKBUILD#n44
Created attachment 250977 [details] Patch for cmake.mk v2 Remove stray blank line
Why not append ${CMAKE_TESTING_PARALLEL_LEVEL} to TEST_ENV rather than adding it verbatim into do-test?
It overwrites TEST_ENV Without appending to TEST_ENV make test -V TEST_ENV NINJA_STATUS="[%p %s/%t] " XDG_DATA_HOME=/usr/ports/textproc/libxml2/work XDG_CONFIG_HOME=/usr/ports/textproc/libxml2/work XDG_CACHE_HOME=/usr/ports/textproc/libxml2/work/.cache HOME=/usr/ports/textproc/libxml2/work PATH=/usr/ports/textproc/libxml2/work/.bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/root/bin PKG_CONFIG_LIBDIR=/usr/ports/textproc/libxml2/work/.pkgconfig:/usr/local/libdata/pkgconfig:/usr/local/share/pkgconfig:/usr/libdata/pkgconfig MK_DEBUG_FILES=no MK_KERNEL_SYMBOLS=no SHELL=/bin/sh NO_LINT=YES DESTDIR=/usr/ports/textproc/libxml2/work/stage PREFIX=/usr/local LOCALBASE=/usr/local CC="cc" CFLAGS="-O2 -pipe -march=tigerlake -DLIBICONV_PLUG -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing " CPP="cpp" CPPFLAGS="-DLIBICONV_PLUG -isystem /usr/local/include" LDFLAGS=" -Wl,--undefined-version -fstack-protector-strong -L/usr/local/lib " LIBS="" CXX="c++" CXXFLAGS="-O2 -pipe -march=tigerlake -DLIBICONV_PLUG -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing -DLIBICONV_PLUG -isystem /usr/local/include " BSD_INSTALL_PROGRAM="install -s -m 555" BSD_INSTALL_LIB="install -s -m 0644" BSD_INSTALL_SCRIPT="install -m 555" BSD_INSTALL_DATA="install -m 0644" BSD_INSTALL_MAN="install -m 444" Appending (TEST_ENV+= .... in cmake.mk) make test -V TEST_ENV CTEST_PARALLEL_LEVEL=6
We could use more straightforward (and simpler) knob such as CMAKE_TESTING_JOBS or CMAKE_TESTING_JOBS_NUMBER rather than CMAKE_TESTING_PARALLEL_LEVEL. We don't have to follow upstream (cmake) naming here.
Thank you, Daniel, for the initiative. (In reply to Po-Chuan Hsieh from comment #4) I find that proposal for consistency useful, but should we make this a generic "use different test concurrency level" knob and omit the CMAKE_ from the feature's name in as far as our framework exposes it, and only use it in the implementation? I am thinking that the cmake-independent approach could be like: TEST_JOBS_NUMBER?=${MAKE_JOBS_NUMBER} or possibly blank or 1 if we find TEST_JOBS_UNSAFE defined or == "yes". ...and then cmake.mk can derive CMAKE_TESTING_PARALLEL_LEVEL from that ${TEST_JOBS_NUMBER}.
I think there's value to keep it separate as it doesn't apply to MAKE_JOBS_NUMBER to highlight the difference, setting 0 is allowed whereas (g)make will barf doing so for example.
Is this fine as is or what needs to be done to get it moving?
LGTM
A commit in branch main references this bug: 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(-)