Skip to content

Commit

Permalink
Run test setup as initial tests
Browse files Browse the repository at this point in the history
- This way test setup runs during meson test and not the compile test
- This way it runs only once
  I tried with add_test_setup() but that would cause the setup programs
  to be re-executed before each and every test

Signed-off-by: Simo Sorce <[email protected]>
  • Loading branch information
simo5 committed Apr 24, 2024
1 parent 5d67e6e commit cce30ed
Showing 1 changed file with 13 additions and 19 deletions.
32 changes: 13 additions & 19 deletions tests/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -30,25 +30,20 @@ if nss_softokn.found()
endif
endif

softoken_conf = custom_target(
'generate softoken configuration',
output: 'tmp.softokn.log',
env: conf_env,
command: [
find_program('setup-softokn.sh'),
],
capture: true,
)
test_setup = {
'setup_softokn': {'suite': 'softokn', 'exe': find_program('setup-softokn.sh')},
'setup_softhsm': {'suite': 'softhsm', 'exe': find_program('setup-softhsm.sh')},
}

softhsm_conf = custom_target(
'generate softhsm configuration',
output: 'tmp.softhsm.log',
env: conf_env,
command: [
find_program('setup-softhsm.sh'),
],
capture: true,
)
foreach name, targs : test_setup
test(
name,
targs.get('exe'),
suite: targs.get('suite'),
env: conf_env,
is_parallel: false,
)
endforeach

test_env = environment({
'TEST_PATH': meson.current_source_dir(),
Expand Down Expand Up @@ -148,7 +143,6 @@ foreach t, extra_args : tests
test_wrapper,
args: '@0@-@[email protected]'.format(t, suite),
suite: suite,
depends: [softoken_conf, softhsm_conf],
env: test_env,
is_parallel: is_parallel,
)
Expand Down

0 comments on commit cce30ed

Please sign in to comment.