• [gentoo-dev] [PATCH 2/2] meson.eclass: build test targets first in meso

    From Sam James@21:1/5 to All on Sun Apr 6 07:40:02 2025
    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

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mike Gilbert@21:1/5 to sam@gentoo.org on Sun Apr 6 21:50:01 2025
    On Sun, Apr 6, 2025 at 1:34 AM Sam James <sam@gentoo.org> wrote:

    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.

    I think this change will break sys-apps/systemd-utils, which builds
    only a subset of the available test binaries.

    It's probably fine in most cases, I just wanted to point it out.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)