Newer versions of meson [0] don't build all test targets upfront (which
makes this more noticeable, still was a thing before w/ custom handling)
so, in the common case, test binaries are built by the `meson test` call.

That means their compile/link lines aren't emitted (even with `meson test 
--verbose`)
and they're also built without respecting $(makeopts_jobs) as `meson test
--num-processes` only affects test execution parallelism.

Preempt that by calling `eninja meson-test-prereq` first which solves both
problems. We can safely do this unconditionally as this target was added
in meson-0.63.0 and we depend on >=meson-1.2.3 in the eclass.

[0] 
https://mesonbuild.com/Release-notes-for-1-7-0.html#test-targets-no-longer-built-by-default

Signed-off-by: Sam James <s...@gentoo.org>
---
 eclass/meson.eclass | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/eclass/meson.eclass b/eclass/meson.eclass
index 382c80ec08214..da3c3c53650b4 100644
--- a/eclass/meson.eclass
+++ b/eclass/meson.eclass
@@ -458,13 +458,16 @@ meson_src_test() {
 
        pushd "${BUILD_DIR}" > /dev/null || die
 
+       nonfatal eninja meson-test-prereq || die -n "test prereqs failed"
+
        local mesontestargs=(
+               --no-rebuild
                --print-errorlogs
                --num-processes "$(makeopts_jobs "${MAKEOPTS}")"
                "$@"
        )
 
-       nonfatal edo "${mesontestargs[@]}"
+       nonfatal edo meson test "${mesontestargs[@]}"
        local rv=$?
        [[ ${rv} -eq 0 ]] || die -n "tests failed"
 
-- 
2.49.0


Reply via email to