summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDaniel Wagner <dwagner@suse.de>2022-11-24 09:17:45 +0100
committerDaniel Wagner <dwagner@suse.de>2023-01-04 09:35:06 +0100
commitafb5bbaba40c5ba8d99c276ed42f2a043574f694 (patch)
treeeb485cd564ad4344427b17f8049714309236a438 /test
parent6a774fbb79904b5b01aeefdc712c65de1019f170 (diff)
downloaddbus-afb5bbaba40c5ba8d99c276ed42f2a043574f694.tar.gz
meson: Introduce message_bus and tools command line option
To make the consume libdbus via Meson's subproject use case more useful, introduce message_bus and tools command line options which control if the D-Bus daemon and/or the tools are build. The idea here is that depending projects are interested only in the library. The strong recommendation is only to build libdbus as static library: libdbus_dep = dependency( 'dbus-1', required: get_option('libdbus'), fallback: ['dbus', 'libdbus_dep'], default_options: [ 'default_library=static', 'embedded_tests=false', 'message_bus=false', 'modular_tests=disabled', 'tools=false', ], ) This ensures that any installed D-Bus infrastructure on the target system is not overwritten. Signed-off-by: Daniel Wagner <dwagner@suse.de>
Diffstat (limited to 'test')
-rw-r--r--test/data/meson.build13
-rw-r--r--test/meson.build63
2 files changed, 48 insertions, 28 deletions
diff --git a/test/data/meson.build b/test/data/meson.build
index e3646c9f..ef570492 100644
--- a/test/data/meson.build
+++ b/test/data/meson.build
@@ -198,15 +198,16 @@ foreach file : data_in_to_install
files += dst
endforeach
-files += meson.project_build_root() / 'bus' / 'session.conf'
-files += meson.current_build_dir() / 'valid-config-files/session.conf'
+if message_bus
+ files += meson.project_build_root() / 'bus' / 'session.conf'
+ files += meson.current_build_dir() / 'valid-config-files/session.conf'
-if platform_unix
- files += meson.project_build_root() / 'bus' / 'system.conf'
- files += meson.current_build_dir() / 'valid-config-files-system/system.conf'
+ if platform_unix
+ files += meson.project_build_root() / 'bus' / 'system.conf'
+ files += meson.current_build_dir() / 'valid-config-files-system/system.conf'
+ endif
endif
-
run_result = run_command(find_program('copy_data_for_tests.py'), files, check: true)
files_not_found = run_result.stdout().split()
diff --git a/test/meson.build b/test/meson.build
index 2a3c346d..966e8ab7 100644
--- a/test/meson.build
+++ b/test/meson.build
@@ -54,13 +54,21 @@ test_env.set('G_TEST_BUILDDIR', meson.current_build_dir())
test_env.set('DBUS_TEST_EXEC', meson.current_build_dir())
test_env.set('DBUS_TEST_DATA', meson.current_build_dir() / 'data')
-test_env.set('DBUS_TEST_DAEMON', dbus_daemon.full_path())
-test_env.set('DBUS_TEST_DBUS_LAUNCH', dbus_launch.full_path())
-test_env.set('DBUS_TEST_DBUS_MONITOR', dbus_monitor.full_path())
-test_env.set('DBUS_TEST_DBUS_SEND', dbus_send.full_path())
+if message_bus
+ test_env.set('DBUS_TEST_DAEMON', dbus_daemon.full_path())
+endif
+
+if tools
+ test_env.set('DBUS_TEST_DBUS_MONITOR', dbus_monitor.full_path())
+ test_env.set('DBUS_TEST_DBUS_SEND', dbus_send.full_path())
+endif
+
+if message_bus and tools
+ test_env.set('DBUS_TEST_DBUS_LAUNCH', dbus_launch.full_path())
+endif
-if platform_unix
- test_env.set('DBUS_TEST_DBUS_UUIDGEN', dbus_uuidgen.full_path())
+if platform_unix and tools
+ test_env.set('DBUS_TEST_DBUS_UUIDGEN', dbus_uuidgen.full_path())
endif
if platform_windows
@@ -204,7 +212,7 @@ else
test_data_config.set('TEST_LAUNCH_HELPER_BINARY', '/bin/false')
endif
-if platform_unix and use_glib
+if message_bus and tools and platform_unix and use_glib
test_apparmor_activation = executable('test-apparmor-activation',
'sd-activation.c',
include_directories: root_include,
@@ -226,7 +234,9 @@ subdir('data')
# the "name-test" subdir in fact contains a bunch of tests now that need a
# temporary bus to be running to do stuff with. The directory should be renamed.
-subdir('name-test')
+if message_bus and tools
+ subdir('name-test')
+endif
tests = []
@@ -234,19 +244,6 @@ if embedded_tests
tests += [
{
- 'name': 'bus',
- 'srcs': [ 'bus/main.c', 'bus/common.c' ],
- 'link': [ libdbus_testutils, libdbus_daemon_internal, ],
- 'install': false,
- },
- {
- 'name': 'bus-dispatch-sha1',
- 'srcs': [ 'bus/dispatch-sha1.c', 'bus/common.c' ],
- 'link': [ libdbus_testutils, libdbus_daemon_internal, ],
- 'install': false,
- 'suite': ['slow'],
- },
- {
'name': 'marshal-recursive',
'srcs': [
'internals/dbus-marshal-recursive-util.c',
@@ -270,6 +267,24 @@ if embedded_tests
},
]
+ if message_bus
+ tests += [
+ {
+ 'name': 'bus',
+ 'srcs': [ 'bus/main.c', 'bus/common.c' ],
+ 'link': [ libdbus_testutils, libdbus_daemon_internal, ],
+ 'install': false,
+ },
+ {
+ 'name': 'bus-dispatch-sha1',
+ 'srcs': [ 'bus/dispatch-sha1.c', 'bus/common.c' ],
+ 'link': [ libdbus_testutils, libdbus_daemon_internal, ],
+ 'install': false,
+ 'suite': ['slow'],
+ },
+ ]
+ endif
+
if use_traditional_activation
tests += [
{
@@ -575,6 +590,10 @@ foreach test: tests
suites = test.get('suite', ['dbus'])
install = test.get('install', true)
+ if suites.contains('runs-dbus-daemon') and not (message_bus and tools)
+ continue
+ endif
+
if test.get('test', true)
exe_name = 'test-' + name
else
@@ -626,7 +645,7 @@ endforeach
scripts = []
-if platform_unix and use_glib
+if message_bus and tools and platform_unix and use_glib
scripts += [
{ 'name': 'test-dbus-daemon-fork.sh', },
{ 'name': 'transient-services.sh',