Skip to content

Commit b44e63f

Browse files
pks-tgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 5e0752b commit b44e63f

File tree

4 files changed

+9
-5
lines changed

4 files changed

+9
-5
lines changed

contrib/credential/netrc/meson.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ if get_option('tests')
1717
workdir: meson.current_source_dir(),
1818
env: credential_netrc_testenv,
1919
depends: test_dependencies + bin_wrappers + [credential_netrc],
20-
timeout: 0,
20+
kwargs: test_kwargs,
2121
)
2222
endif

contrib/subtree/meson.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ if get_option('tests')
2121
env: subtree_test_environment,
2222
workdir: meson.current_source_dir() / 't',
2323
depends: test_dependencies + bin_wrappers + [ git_subtree ],
24-
timeout: 0,
24+
kwargs: test_kwargs,
2525
)
2626
endif
2727

meson.build

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2036,6 +2036,10 @@ subdir('templates')
20362036
# can properly set up test dependencies. The bin-wrappers themselves are set up
20372037
# at configuration time, so these are fine.
20382038
if get_option('tests')
2039+
test_kwargs = {
2040+
'timeout': 0,
2041+
}
2042+
20392043
subdir('t')
20402044
endif
20412045

t/meson.build

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ clar_unit_tests = executable('unit-tests',
5151
sources: clar_sources + clar_test_suites,
5252
dependencies: [libgit_commonmain],
5353
)
54-
test('unit-tests', clar_unit_tests)
54+
test('unit-tests', clar_unit_tests, kwargs: test_kwargs)
5555

5656
unit_test_programs = [
5757
'unit-tests/t-reftable-basics.c',
@@ -76,7 +76,7 @@ foreach unit_test_program : unit_test_programs
7676
)
7777
test(unit_test_name, unit_test,
7878
workdir: meson.current_source_dir(),
79-
timeout: 0,
79+
kwargs: test_kwargs,
8080
)
8181
endforeach
8282

@@ -1212,7 +1212,7 @@ foreach integration_test : integration_tests
12121212
workdir: meson.current_source_dir(),
12131213
env: test_environment,
12141214
depends: test_dependencies + bin_wrappers,
1215-
timeout: 0,
1215+
kwargs: test_kwargs,
12161216
)
12171217
endforeach
12181218

0 commit comments

Comments
 (0)