From: Sam James <sam@gentoo•org>
To: Patrick Steinhardt <ps@pks•im>
Cc: git@vger•kernel.org, Junio C Hamano <gitster@pobox•com>,
Eli Schwartz <eschwartz@gentoo•org>,
Thorsten Glaser <tg@debian•org>,
Johannes Schindelin <Johannes.Schindelin@gmx•de>
Subject: Re: [PATCH 4/4] meson: respect 'tests' build option in contrib
Date: Fri, 28 Mar 2025 18:25:38 +0000 [thread overview]
Message-ID: <87semx3tct.fsf@gentoo.org> (raw)
In-Reply-To: <20250328-b4-pks-collect-build-fixes-v1-4-ead9deda3fbc@pks.im>
Patrick Steinhardt <ps@pks•im> writes:
> Both the "netrc" credential helper and git-subtree(1) from "contrib/"
> carry a couple of tests with them. These tests get wired up in Meson
> unconditionally even in the case where `-Dtests=false`. As those tests
> depend on the `test_enviroment` variable, which only gets defined in
> case `-Dtests=true`, the result is an error:
>
> ```
> $ meson setup -Dtests=false -Dcontrib=subtree build
> [...]
>
> contrib/subtree/meson.build:15:27: ERROR: Unknown variable "test_environment".
> ```
>
> Fix the issue by not defining these tests at all in case the "tests"
> option is set to `false`.
Thank you! Sorry for the delay in getting back to you -- I had some
thought that I was trying to resolve about the nicer style and then
dropped the ball. LGTM.
>
> Reported-by: Sam James <sam@gentoo•org>
> Signed-off-by: Patrick Steinhardt <ps@pks•im>
> ---
> contrib/credential/netrc/meson.build | 22 ++++++++++++----------
> contrib/subtree/meson.build | 20 +++++++++++---------
> 2 files changed, 23 insertions(+), 19 deletions(-)
>
> diff --git a/contrib/credential/netrc/meson.build b/contrib/credential/netrc/meson.build
> index a990dbb86da..3d74547c8ae 100644
> --- a/contrib/credential/netrc/meson.build
> +++ b/contrib/credential/netrc/meson.build
> @@ -7,14 +7,16 @@ credential_netrc = custom_target(
> install_dir: get_option('libexecdir') / 'git-core',
> )
>
> -credential_netrc_testenv = test_environment
> -credential_netrc_testenv.set('CREDENTIAL_NETRC_PATH', credential_netrc.full_path())
> +if get_option('tests')
> + credential_netrc_testenv = test_environment
> + credential_netrc_testenv.set('CREDENTIAL_NETRC_PATH', credential_netrc.full_path())
>
> -test('t-git-credential-netrc',
> - shell,
> - args: [ meson.current_source_dir() / 't-git-credential-netrc.sh' ],
> - workdir: meson.current_source_dir(),
> - env: credential_netrc_testenv,
> - depends: test_dependencies + bin_wrappers + [credential_netrc],
> - timeout: 0,
> -)
> + test('t-git-credential-netrc',
> + shell,
> + args: [ meson.current_source_dir() / 't-git-credential-netrc.sh' ],
> + workdir: meson.current_source_dir(),
> + env: credential_netrc_testenv,
> + depends: test_dependencies + bin_wrappers + [credential_netrc],
> + timeout: 0,
> + )
> +endif
> diff --git a/contrib/subtree/meson.build b/contrib/subtree/meson.build
> index 9c72b236259..63714166a61 100644
> --- a/contrib/subtree/meson.build
> +++ b/contrib/subtree/meson.build
> @@ -12,16 +12,18 @@ git_subtree = custom_target(
> install_dir: get_option('libexecdir') / 'git-core',
> )
>
> -subtree_test_environment = test_environment
> -subtree_test_environment.prepend('PATH', meson.current_build_dir())
> +if get_option('tests')
> + subtree_test_environment = test_environment
> + subtree_test_environment.prepend('PATH', meson.current_build_dir())
>
> -test('t7900-subtree', shell,
> - args: [ 't7900-subtree.sh' ],
> - env: subtree_test_environment,
> - workdir: meson.current_source_dir() / 't',
> - depends: test_dependencies + bin_wrappers + [ git_subtree ],
> - timeout: 0,
> -)
> + test('t7900-subtree', shell,
> + args: [ 't7900-subtree.sh' ],
> + env: subtree_test_environment,
> + workdir: meson.current_source_dir() / 't',
> + depends: test_dependencies + bin_wrappers + [ git_subtree ],
> + timeout: 0,
> + )
> +endif
>
> if get_option('docs').contains('man')
> subtree_xml = custom_target(
next prev parent reply other threads:[~2025-03-28 18:25 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-28 8:38 [PATCH 0/4] Collection of build fixes Patrick Steinhardt
2025-03-28 8:38 ` [PATCH 1/4] meson: fix handling of '-Dcurl=auto' Patrick Steinhardt
2025-03-28 8:38 ` [PATCH 2/4] gitweb: fix generation of "gitweb.js" Patrick Steinhardt
2025-03-28 8:38 ` [PATCH 3/4] meson: require Perl when building docs Patrick Steinhardt
2025-03-29 17:56 ` Junio C Hamano
2025-03-31 5:59 ` Patrick Steinhardt
2025-03-28 8:38 ` [PATCH 4/4] meson: respect 'tests' build option in contrib Patrick Steinhardt
2025-03-28 18:25 ` Sam James [this message]
2025-03-31 8:33 ` [PATCH v2 0/5] Collection of build fixes Patrick Steinhardt
2025-03-31 8:33 ` [PATCH v2 1/5] meson: fix handling of '-Dcurl=auto' Patrick Steinhardt
2025-04-03 8:24 ` Karthik Nayak
2025-03-31 8:33 ` [PATCH v2 2/5] gitweb: fix generation of "gitweb.js" Patrick Steinhardt
2025-04-01 16:30 ` Johannes Schindelin
2025-04-02 6:40 ` Patrick Steinhardt
2025-04-01 16:30 ` Toon Claes
2025-03-31 8:33 ` [PATCH v2 3/5] meson: respect 'tests' build option in contrib Patrick Steinhardt
2025-04-01 16:31 ` Johannes Schindelin
2025-03-31 8:33 ` [PATCH v2 4/5] meson: distinguish build and target host binaries Patrick Steinhardt
2025-04-03 8:38 ` Karthik Nayak
2025-03-31 8:33 ` [PATCH v2 5/5] ci: use Visual Studio for win+meson job on GitHub Workflows Patrick Steinhardt
2025-04-01 16:41 ` [PATCH v2 0/5] Collection of build fixes Johannes Schindelin
2025-04-03 8:39 ` Karthik Nayak
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=87semx3tct.fsf@gentoo.org \
--to=sam@gentoo$(echo .)org \
--cc=Johannes.Schindelin@gmx$(echo .)de \
--cc=eschwartz@gentoo$(echo .)org \
--cc=git@vger$(echo .)kernel.org \
--cc=gitster@pobox$(echo .)com \
--cc=ps@pks$(echo .)im \
--cc=tg@debian$(echo .)org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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