diff options
| author | Patrick Steinhardt <ps@pks.im> | 2025-06-02 08:44:49 +0200 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2025-06-02 07:51:43 -0700 |
| commit | b44e63f405a6508652dab2d4ade71e6f0afb9f36 (patch) | |
| tree | 6caec071abd6246461040987b38a46988ad898a9 | |
| parent | test-lib: fail on unexpectedly passing tests (diff) | |
| download | git-b44e63f405a6508652dab2d4ade71e6f0afb9f36.tar.gz git-b44e63f405a6508652dab2d4ade71e6f0afb9f36.zip | |
meson: introduce kwargs variable for tests
Meson has the ability to create a kwargs dictionary that can then be
passed to any function call with the `kwargs:` positional argument. This
allows one to deduplicate common parameters that one wishes to pass to
several different function invocations.
Our tests already have one common parameter that we use everywhere,
"timeout", and we're about to add a second common parameter in the next
commit. Let's prepare for this by introducing `test_kwargs` so that we
can deduplicate these common arguments.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
| -rw-r--r-- | contrib/credential/netrc/meson.build | 2 | ||||
| -rw-r--r-- | contrib/subtree/meson.build | 2 | ||||
| -rw-r--r-- | meson.build | 4 | ||||
| -rw-r--r-- | t/meson.build | 6 |
4 files changed, 9 insertions, 5 deletions
diff --git a/contrib/credential/netrc/meson.build b/contrib/credential/netrc/meson.build index 3d74547c8a..16fa69e317 100644 --- a/contrib/credential/netrc/meson.build +++ b/contrib/credential/netrc/meson.build @@ -17,6 +17,6 @@ if get_option('tests') workdir: meson.current_source_dir(), env: credential_netrc_testenv, depends: test_dependencies + bin_wrappers + [credential_netrc], - timeout: 0, + kwargs: test_kwargs, ) endif diff --git a/contrib/subtree/meson.build b/contrib/subtree/meson.build index 63714166a6..98dd8e0c8e 100644 --- a/contrib/subtree/meson.build +++ b/contrib/subtree/meson.build @@ -21,7 +21,7 @@ if get_option('tests') env: subtree_test_environment, workdir: meson.current_source_dir() / 't', depends: test_dependencies + bin_wrappers + [ git_subtree ], - timeout: 0, + kwargs: test_kwargs, ) endif diff --git a/meson.build b/meson.build index a1476e5b32..6fb898a21d 100644 --- a/meson.build +++ b/meson.build @@ -2036,6 +2036,10 @@ subdir('templates') # can properly set up test dependencies. The bin-wrappers themselves are set up # at configuration time, so these are fine. if get_option('tests') + test_kwargs = { + 'timeout': 0, + } + subdir('t') endif diff --git a/t/meson.build b/t/meson.build index fcfc1c2c2b..3fc8c6c220 100644 --- a/t/meson.build +++ b/t/meson.build @@ -51,7 +51,7 @@ clar_unit_tests = executable('unit-tests', sources: clar_sources + clar_test_suites, dependencies: [libgit_commonmain], ) -test('unit-tests', clar_unit_tests) +test('unit-tests', clar_unit_tests, kwargs: test_kwargs) unit_test_programs = [ 'unit-tests/t-reftable-basics.c', @@ -76,7 +76,7 @@ foreach unit_test_program : unit_test_programs ) test(unit_test_name, unit_test, workdir: meson.current_source_dir(), - timeout: 0, + kwargs: test_kwargs, ) endforeach @@ -1212,7 +1212,7 @@ foreach integration_test : integration_tests workdir: meson.current_source_dir(), env: test_environment, depends: test_dependencies + bin_wrappers, - timeout: 0, + kwargs: test_kwargs, ) endforeach |
