]> git.ipfire.org Git - thirdparty/git.git/commitdiff
meson: introduce kwargs variable for tests
authorPatrick Steinhardt <ps@pks.im>
Mon, 2 Jun 2025 06:44:49 +0000 (08:44 +0200)
committerJunio C Hamano <gitster@pobox.com>
Mon, 2 Jun 2025 14:51:43 +0000 (07:51 -0700)
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>
contrib/credential/netrc/meson.build
contrib/subtree/meson.build
meson.build
t/meson.build

index 3d74547c8aea30dcf6a3903ad73e8a903f8b71a8..16fa69e317e30e6275eb0847df847d29fe5ceac4 100644 (file)
@@ -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
index 63714166a61f89e840ec1694e7719c967a8e8fb1..98dd8e0c8eaceadc39dfa0a44c0b6aeb8fd9d41d 100644 (file)
@@ -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
 
index a1476e5b322aabf30dbb999955dfe9aada313433..6fb898a21d1c6028fc4194cbbd8d87007bd67145 100644 (file)
@@ -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
 
index fcfc1c2c2ba80c6eaa49d48abd11694fcb45f4ff..3fc8c6c2201d130ecc885e478d0ed3de0ba21887 100644 (file)
@@ -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