test: add missing test dependencies

This fixes doing "meson setup" followed by "meson test", without doing
a full build in between.

Signed-off-by: Alyssa Ross <hi@alyssa.is>
This commit is contained in:
Alyssa Ross 2024-07-25 10:49:50 +02:00 committed by Simon McVittie
parent 3d8b06a421
commit 55e60abe18
2 changed files with 59 additions and 35 deletions

View file

@ -190,6 +190,20 @@ test_shell_service = executable('test-shell-service',
link_with: libdbus_testutils,
dependencies: dbus_dependencies,
)
test_sleep_forever = executable('test-sleep-forever',
'test-sleep-forever.c',
link_with: libdbus_testutils,
include_directories: root_include,
install: install_tests,
install_dir: test_exec_dir
)
test_service = executable('test-service',
'test-service.c',
link_with: libdbus_testutils,
include_directories: root_include,
install: install_tests,
install_dir: test_exec_dir
)
if use_traditional_activation
test_spawn = executable('test-spawn',
@ -321,6 +335,12 @@ if embedded_tests
'srcs': [ 'bus/helper-activation.c', 'bus/common.c' ],
'link': [ libdbus_testutils, libdbus_daemon_internal, ],
'install': false,
'test_deps': [
launch_helper_for_tests,
test_segfault,
test_service,
test_shell_service,
],
'suite': ['slow'],
'timeout': 1000,
},
@ -341,28 +361,12 @@ if embedded_tests
'srcs': [ 'internals/spawn-oom.c', ],
'link': [ libdbus_testutils, ],
'install': false,
'test_deps': [ test_exit, test_segfault ],
}
]
endif
endif
tests += [
{
'name': 'test-service',
'srcs': [ 'test-service.c' ],
'link': [ libdbus_testutils, ],
'install': true,
'test': false,
},
{
'name': 'test-sleep-forever',
'srcs': [ 'test-sleep-forever.c' ],
'link': [ libdbus_testutils, ],
'install': true,
'test': false,
}
]
tests += [
{
'name': 'atomic',
@ -542,6 +546,7 @@ if use_glib
'srcs': [ 'internals/sysdeps.c' ],
'link': [ libdbus_testutils, ],
'deps': [ glib, gio, ],
'test_deps': [ test_sleep_forever ],
},
{
'name': 'syslog',
@ -608,11 +613,15 @@ foreach test: tests
srcs = test.get('srcs')
link = test.get('link', [])
deps = test.get('deps', [])
test_deps = test.get('test_deps', [])
suites = test.get('suite', ['dbus'])
install = test.get('install', true)
if suites.contains('runs-dbus-daemon') and not (message_bus and tools)
continue
if suites.contains('runs-dbus-daemon')
if not (message_bus and tools)
continue
endif
test_deps += dbus_daemon
endif
if test.get('test', true)
@ -645,6 +654,7 @@ foreach test: tests
test(name,
test_exe,
args: ['--tap'],
depends: test_deps,
env: test_env,
protocol: test_protocol,
suite: suites,
@ -668,7 +678,8 @@ scripts = []
if message_bus and tools and platform_unix and use_glib
scripts += [
{ 'name': 'test-dbus-daemon-fork.sh', },
{ 'name': 'test-dbus-daemon-fork.sh',
'test_deps': [ dbus_send ] },
{ 'name': 'transient-services.sh',
'subdir': 'integration',
'build_time_test': false },
@ -689,6 +700,7 @@ foreach script: scripts
name = script.get('name')
install = script.get('install', true)
suites = script.get('suite', ['dbus'])
test_deps = [xdgdir] + script.get('test_deps', [])
test_subdir = script.get('subdir', '')
if test_subdir == ''
@ -715,7 +727,7 @@ foreach script: scripts
test(name,
find_program(script.get('subdir', '.') / name),
env: test_env,
depends: xdgdir,
depends: test_deps,
suite: suites,
)
endif

View file

@ -23,29 +23,38 @@
if embedded_tests
tests = [
'test-ids',
'test-pending-call-disconnected',
'test-shutdown',
{'name': 'test-ids'},
{'name': 'test-pending-call-disconnected'},
{'name': 'test-shutdown'},
]
if platform_windows
tests += ['test-autolaunch-win']
autolaunch_name = 'test-autolaunch-win'
else
tests += ['test-autolaunch']
autolaunch_name = 'test-autolaunch'
endif
autolaunch = executable(autolaunch_name,
autolaunch_name + '.c',
include_directories: root_include,
link_with: [libdbus, libdbus_internal, libdbus_testutils],
dependencies: dbus_dependencies
)
if use_traditional_activation
tests += [
'test-pending-call-dispatch',
'test-pending-call-timeout',
'test-privserver-client',
'test-threads-init',
{'name': 'test-pending-call-dispatch', 'test_deps': [test_service]},
{'name': 'test-pending-call-timeout', 'test_deps': [test_service]},
{
'name': 'test-privserver-client',
'test_deps': [test_privserver, test_service],
},
{'name': 'test-threads-init', 'test_deps': [test_service]},
]
endif
foreach test: tests
test_exe = executable(test,
test + '.c',
test_exe = executable(test['name'],
test['name'] + '.c',
include_directories: root_include,
link_with: [
libdbus,
@ -55,12 +64,12 @@ if embedded_tests
dependencies: dbus_dependencies,
)
if test == 'test-autolaunch'
if test['name'] == 'test-autolaunch'
# This one is run from run-test.sh, not directly
continue
endif
if test == 'test-pending-call-timeout'
if test['name'] == 'test-pending-call-timeout'
timeout = 75
suites = ['name-test', 'slow']
else
@ -68,7 +77,7 @@ if embedded_tests
suites = ['name-test']
endif
test(test,
test(test['name'],
dbus_run_session,
args: [
'--config-file=@0@'.format(
@ -77,6 +86,7 @@ if embedded_tests
'--',
test_exe,
],
depends: test.get('test_deps', []),
env: test_env,
protocol: test_protocol,
suite: suites,
@ -88,6 +98,7 @@ if embedded_tests
if platform_unix
test('run-test',
find_program('run-test.sh'),
depends: autolaunch,
env: test_env,
protocol: test_protocol,
suite: 'name-test',
@ -95,6 +106,7 @@ if embedded_tests
test('run-test-systemserver',
find_program('run-test-systemserver.sh'),
depends: [dbus_send, test_service],
env: test_env,
protocol: test_protocol,
suite: 'name-test',