public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: Sam James <sam@gentoo.org>
To: gentoo-dev@lists.gentoo.org
Cc: base-system@gentoo.org, eschwartz@gentoo.org, Sam James <sam@gentoo.org>
Subject: [gentoo-dev] [PATCH 2/2] meson.eclass: build test targets first in meson_src_test
Date: Sun,  6 Apr 2025 06:34:49 +0100	[thread overview]
Message-ID: <6cef3ecbaa1909ebe9d848fa0d6ba3e9891ca7bd.1743917689.git.sam@gentoo.org> (raw)
In-Reply-To: <28881e68ac50fef361c4d0a0f8dd87d1faa7bcb4.1743917689.git.sam@gentoo.org>

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 <sam@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	other threads:[~2025-04-06  5:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-06  5:34 [gentoo-dev] [PATCH 1/2] meson.eclass: use edo Sam James
2025-04-06  5:34 ` Sam James [this message]
2025-04-06 19:42   ` [gentoo-dev] Re: [PATCH 2/2] meson.eclass: build test targets first in meson_src_test Mike Gilbert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6cef3ecbaa1909ebe9d848fa0d6ba3e9891ca7bd.1743917689.git.sam@gentoo.org \
    --to=sam@gentoo.org \
    --cc=base-system@gentoo.org \
    --cc=eschwartz@gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox