Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: follow-up on the integration tests #353

Merged
merged 7 commits into from
Apr 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,6 @@ if use_docs
prog_rst2man = find_program('rst2man', 'rst2man.py')
endif

#
# Config: install-tests
#
install_tests = get_option('install-tests')
test_install_dir = get_option('prefix') / 'lib/dbus-broker/tests'

#
# Config: launcher
#
Expand Down Expand Up @@ -119,6 +113,13 @@ endforeach

add_project_arguments('-DSYSTEM_CONSOLE_USERS=' + acc_sysusers, language: 'c')

#
# Config: tests
#

use_tests = get_option('tests')
conf.set('testdir', get_option('prefix') / 'lib/dbus-broker/tests')

#
# Global Parameters
#
Expand Down
2 changes: 1 addition & 1 deletion meson_options.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
option('apparmor', type: 'boolean', value: false, description: 'AppArmor support')
option('audit', type: 'boolean', value: false, description: 'Audit support')
option('docs', type: 'boolean', value: false, description: 'Build documentation')
option('install-tests', type: 'boolean', value: false, description: 'Install test executables')
option('launcher', type: 'boolean', value: true, description: 'Build compatibility launcher')
option('linux-4-17', type: 'boolean', value: false, description: 'Require linux-4.17 at runtime and make use of its features')
option('reference-test', type: 'boolean', value: false, description: 'Run test suite against reference implementation')
option('selinux', type: 'boolean', value: false, description: 'SELinux support')
option('system-console-users', type: 'array', value: [], description: 'Additional set of names of system-users to be considered at-console')
option('tests', type: 'boolean', value: false, description: 'Include tests in the distribution')
214 changes: 50 additions & 164 deletions src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -173,195 +173,81 @@ endif
# target: test-*
#

test_unit_install_kwargs = {
'install': install_tests,
'install_dir': test_install_dir / 'unit',
test_kwargs = {
'dependencies': dep_bus,
'install': use_tests,
'install_dir': conf.get('testdir') / 'unit',
}

test_address = executable(
'test-address',
sources: ['dbus/test-address.c'],
dependencies: dep_bus,
kwargs: test_unit_install_kwargs
)
test('Address Handling', test_address)
test_address = executable('test-address', sources: ['dbus/test-address.c'], kwargs: test_kwargs)
test('Address Handling', test_address, suite: 'unit')

test_apparmor = executable(
'test-apparmor',
sources: ['util/test-apparmor.c'],
dependencies: dep_bus,
kwargs: test_unit_install_kwargs
)
test('AppArmor Handling', test_apparmor)
test_apparmor = executable('test-apparmor', sources: ['util/test-apparmor.c'], kwargs: test_kwargs)
test('AppArmor Handling', test_apparmor, suite: 'unit')

if use_launcher
test_config = executable(
'test-config',
sources: ['launch/test-config.c'],
dependencies: dep_bus,
kwargs: test_unit_install_kwargs
)
test('Configuration Parser', test_config)
test_config = executable('test-config', sources: ['launch/test-config.c'], kwargs: test_kwargs)
test('Configuration Parser', test_config, suite: 'unit')
endif

test_dirwatch = executable(
'test-dirwatch',
sources: ['util/test-dirwatch.c'],
dependencies: dep_bus,
kwargs: test_unit_install_kwargs
)
test('Directory Watch', test_dirwatch)
test_dirwatch = executable('test-dirwatch', sources: ['util/test-dirwatch.c'], kwargs: test_kwargs)
test('Directory Watch', test_dirwatch, suite: 'unit')

test_dispatch = executable(
'test-dispatch',
sources: ['util/test-dispatch.c'],
dependencies: dep_bus,
kwargs: test_unit_install_kwargs
)
test('Event Dispatcher', test_dispatch)
test_dispatch = executable('test-dispatch', sources: ['util/test-dispatch.c'], kwargs: test_kwargs)
test('Event Dispatcher', test_dispatch, suite: 'unit')

test_error = executable(
'test-error',
sources: ['util/test-error.c'],
dependencies: dep_bus,
kwargs: test_unit_install_kwargs
)
test('Error Handling', test_error)
test_error = executable('test-error', sources: ['util/test-error.c'], kwargs: test_kwargs)
test('Error Handling', test_error, suite: 'unit')

test_fdlist = executable(
'test-fdlist',
sources: ['util/test-fdlist.c'],
dependencies: dep_bus,
kwargs: test_unit_install_kwargs
)
test('Utility File-Desciptor Lists', test_fdlist)
test_fdlist = executable('test-fdlist', sources: ['util/test-fdlist.c'], kwargs: test_kwargs)
test('Utility File-Desciptor Lists', test_fdlist, suite: 'unit')

test_fs = executable(
'test-fs',
sources: ['util/test-fs.c'],
dependencies: dep_bus,
kwargs: test_unit_install_kwargs
)
test('File System Helpers', test_fs)
test_fs = executable('test-fs', sources: ['util/test-fs.c'], kwargs: test_kwargs)
test('File System Helpers', test_fs, suite: 'unit')

test_match = executable(
'test-match',
sources: ['bus/test-match.c'],
dependencies: dep_bus,
kwargs: test_unit_install_kwargs
)
test('D-Bus Match Handling', test_match)
test_match = executable('test-match', sources: ['bus/test-match.c'], kwargs: test_kwargs)
test('D-Bus Match Handling', test_match, suite: 'unit')

test_message = executable(
'test-message',
sources: ['dbus/test-message.c'],
dependencies: dep_bus,
kwargs: test_unit_install_kwargs
)
test('D-Bus Message Abstraction', test_message)
test_message = executable('test-message', sources: ['dbus/test-message.c'], kwargs: test_kwargs)
test('D-Bus Message Abstraction', test_message, suite: 'unit')

test_misc = executable(
'test-misc',
sources: ['util/test-misc.c'],
dependencies: dep_bus,
kwargs: test_unit_install_kwargs
)
test('Miscellaneous Helpers', test_misc)
test_misc = executable('test-misc', sources: ['util/test-misc.c'], kwargs: test_kwargs)
test('Miscellaneous Helpers', test_misc, suite: 'unit')

test_name = executable(
'test-name',
sources: ['bus/test-name.c'],
dependencies: dep_bus,
kwargs: test_unit_install_kwargs
)
test('Name Registry', test_name)
test_name = executable('test-name', sources: ['bus/test-name.c'], kwargs: test_kwargs)
test('Name Registry', test_name, suite: 'unit')

if use_launcher
test_nss_cache = executable(
'test-nss-cache',
sources: ['launch/test-nss-cache.c'],
dependencies: dep_bus,
kwargs: test_unit_install_kwargs
)
test('NSS Cache', test_nss_cache)
test_nss_cache = executable('test-nss-cache', sources: ['launch/test-nss-cache.c'], kwargs: test_kwargs)
test('NSS Cache', test_nss_cache, suite: 'unit')
endif

test_peersec = executable(
'test-peersec',
sources: ['util/test-peersec.c'],
dependencies: dep_bus,
kwargs: test_unit_install_kwargs
)
test('SO_PEERSEC Queries', test_peersec)
test_peersec = executable('test-peersec', sources: ['util/test-peersec.c'], kwargs: test_kwargs)
test('SO_PEERSEC Queries', test_peersec, suite: 'unit')

test_proc = executable(
'test-proc',
sources: ['util/test-proc.c'],
dependencies: dep_bus,
kwargs: test_unit_install_kwargs
)
test('Proc Utilities', test_proc)
test_proc = executable('test-proc', sources: ['util/test-proc.c'], kwargs: test_kwargs)
test('Proc Utilities', test_proc, suite: 'unit')

test_queue = executable(
'test-queue',
sources: ['dbus/test-queue.c'],
dependencies: dep_bus,
kwargs: test_unit_install_kwargs
)
test('D-Bus I/O Queues', test_queue)
test_queue = executable('test-queue', sources: ['dbus/test-queue.c'], kwargs: test_kwargs)
test('D-Bus I/O Queues', test_queue, suite: 'unit')

test_reply = executable(
'test-reply',
sources: ['bus/test-reply.c'],
dependencies: dep_bus,
kwargs: test_unit_install_kwargs
)
test('Reply Tracking', test_reply)
test_reply = executable('test-reply', sources: ['bus/test-reply.c'], kwargs: test_kwargs)
test('Reply Tracking', test_reply, suite: 'unit')

test_sasl = executable(
'test-sasl',
sources: ['dbus/test-sasl.c'],
dependencies: dep_bus,
kwargs: test_unit_install_kwargs
)
test('D-Bus SASL Parser', test_sasl)
test_sasl = executable('test-sasl', sources: ['dbus/test-sasl.c'], kwargs: test_kwargs)
test('D-Bus SASL Parser', test_sasl, suite: 'unit')

test_socket = executable(
'test-socket',
sources: ['dbus/test-socket.c'],
dependencies: dep_bus,
kwargs: test_unit_install_kwargs
)
test('D-Bus Socket Abstraction', test_socket)
test_socket = executable('test-socket', sources: ['dbus/test-socket.c'], kwargs: test_kwargs)
test('D-Bus Socket Abstraction', test_socket, suite: 'unit')

test_sockopt = executable(
'test-sockopt',
sources: ['util/test-sockopt.c'],
dependencies: dep_bus,
kwargs: test_unit_install_kwargs
)
test('D-Bus Socket Options', test_sockopt)
test_sockopt = executable('test-sockopt', sources: ['util/test-sockopt.c'], kwargs: test_kwargs)
test('D-Bus Socket Options', test_sockopt, suite: 'unit')

test_stitching = executable(
'test-stitching',
sources: ['dbus/test-stitching.c'],
dependencies: dep_bus,
kwargs: test_unit_install_kwargs
)
test('Message Sender Stitching', test_stitching)
test_stitching = executable('test-stitching', sources: ['dbus/test-stitching.c'], kwargs: test_kwargs)
test('Message Sender Stitching', test_stitching, suite: 'unit')

test_systemd = executable(
'test-systemd',
sources: ['util/test-systemd.c'],
dependencies: dep_bus,
kwargs: test_unit_install_kwargs
)
test('Systemd Utilities', test_systemd)
test_systemd = executable('test-systemd', sources: ['util/test-systemd.c'], kwargs: test_kwargs)
test('Systemd Utilities', test_systemd, suite: 'unit')

test_user = executable(
'test-user',
sources: ['util/test-user.c'],
dependencies: dep_bus,
kwargs: test_unit_install_kwargs
)
test('User Accounting', test_user)
test_user = executable('test-user', sources: ['util/test-user.c'], kwargs: test_kwargs)
test('User Accounting', test_user, suite: 'unit')
70 changes: 16 additions & 54 deletions test/dbus/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -37,77 +37,39 @@ dep_test = declare_dependency(
version: meson.project_version(),
)

test_dbus_install_kwargs = {
'install': install_tests,
'install_dir': test_install_dir / 'dbus',
}

#
# target: tool-*
#

tool_flood = executable('tool-flood', ['tool-flood.c'], dependencies: [dep_test])

#
# target: bench-*
# target: bench-* / test-*
#

bench_connect = executable(
'bench-connect',
sources: ['bench-connect.c'],
dependencies: [dep_test],
kwargs: test_dbus_install_kwargs
)
bench_message = executable(
'bench-message',
sources: ['bench-message.c'],
dependencies: [dep_test],
kwargs: test_dbus_install_kwargs
)
test_kwargs = {
'dependencies': [dep_test],
'install': use_tests,
'install_dir': conf.get('testdir') / 'dbus',
}

#
# target: test-*
#
bench_connect = executable('bench-connect', sources: ['bench-connect.c'], kwargs: test_kwargs)
bench_message = executable('bench-message', sources: ['bench-message.c'], kwargs: test_kwargs)

test_broker = executable(
'test-broker',
sources: ['test-broker.c'],
dependencies: [dep_test],
kwargs: test_dbus_install_kwargs
)
test_driver = executable(
'test-driver',
sources: ['test-driver.c'],
dependencies: [dep_test],
kwargs: test_dbus_install_kwargs
)
test_fdstream = executable(
'test-fdstream',
sources: ['test-fdstream.c'],
dependencies: [dep_test],
kwargs: test_dbus_install_kwargs
)
test_lifetime = executable(
'test-lifetime',
sources: ['test-lifetime.c'],
dependencies: [dep_test],
kwargs: test_dbus_install_kwargs
)
test_matches = executable(
'test-matches',
sources: ['test-matches.c'],
dependencies: [dep_test],
kwargs: test_dbus_install_kwargs
)
test_broker = executable('test-broker', sources: ['test-broker.c'], kwargs: test_kwargs)
test_driver = executable('test-driver', sources: ['test-driver.c'], kwargs: test_kwargs)
test_fdstream = executable('test-fdstream', sources: ['test-fdstream.c'], kwargs: test_kwargs)
test_lifetime = executable('test-lifetime', sources: ['test-lifetime.c'], kwargs: test_kwargs)
test_matches = executable('test-matches', sources: ['test-matches.c'], kwargs: test_kwargs)

suites = [
{ 'suite': 'dbus-broker(1)', 'env': ['DBUS_BROKER_TEST_BROKER=' + exe_dbus_broker.full_path()]},
{ 'suite': 'dbus-broker', 'env': ['DBUS_BROKER_TEST_BROKER=' + exe_dbus_broker.full_path()]},
]

if use_reference_test
dbus_daemon_bin = dep_dbus.get_variable(pkgconfig: 'bindir') + '/dbus-daemon'
dbus_daemon_bin = dep_dbus.get_variable(pkgconfig: 'bindir') / 'dbus-daemon'
suites += [
{ 'suite': 'dbus-daemon(1)', 'env': ['DBUS_BROKER_TEST_DAEMON=' + dbus_daemon_bin]},
{ 'suite': 'dbus-daemon', 'env': ['DBUS_BROKER_TEST_DAEMON=' + dbus_daemon_bin]},
]
endif

Expand Down
7 changes: 6 additions & 1 deletion test/dbus/test-driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -1685,7 +1685,12 @@ static void test_verify_credentials(sd_bus_message *message) {

c_assert(got_uid);
c_assert(got_pid);
c_assert(got_gids);

if (!util_is_reference()) {
// Group-IDs are a relatively new feature, which might not be
// reported by the reference implementation used for this run.
c_assert(got_gids);
}

/*
* XXX: verify that we get the security label at least when SELinux is enabled
Expand Down
Loading
Loading