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

A couple of test tweaks #350

Merged
merged 3 commits into from
Mar 13, 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
36 changes: 26 additions & 10 deletions test/dbus/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,30 @@ test_matches = executable('test-matches', ['test-matches.c'], dependencies: [ de
test('Signals and Matches', test_matches)

if use_reference_test
dbus_bin = dep_dbus.get_pkgconfig_variable('bindir') + '/dbus-daemon'

benchmark('dbus-daemon(1): Connection', bench_connect, env: [ 'DBUS_BROKER_TEST_DAEMON=' + dbus_bin ], timeout: 60)
benchmark('dbus-daemon(1): Message passing', bench_message, env: [ 'DBUS_BROKER_TEST_DAEMON=' + dbus_bin ], timeout: 120)

test('dbus-daemon(1): Broker API', test_broker, env: [ 'DBUS_BROKER_TEST_DAEMON=' + dbus_bin ])
test('dbus-daemon(1): Driver API', test_driver, env: [ 'DBUS_BROKER_TEST_DAEMON=' + dbus_bin ])
test('dbus-daemon(1): FD Stream Constraints', test_fdstream, env: [ 'DBUS_BROKER_TEST_DAEMON=' + dbus_bin ])
test('dbus-daemon(1): Client Lifetime', test_lifetime, env: [ 'DBUS_BROKER_TEST_DAEMON=' + dbus_bin ])
test('dbus-daemon(1): Signals and Matches', test_matches, env: [ 'DBUS_BROKER_TEST_DAEMON=' + dbus_bin ])
dbus_bin = dep_dbus.get_variable(pkgconfig: 'bindir') + '/dbus-daemon'

benchmark('Connection', bench_connect,
suite: 'dbus-daemon(1)',
env: [ 'DBUS_BROKER_TEST_DAEMON=' + dbus_bin ],
timeout: 60)
benchmark('Message passing', bench_message,
suite: 'dbus-daemon(1)',
env: [ 'DBUS_BROKER_TEST_DAEMON=' + dbus_bin ],
timeout: 120)

test('Broker API', test_broker,
suite: 'dbus-daemon(1)',
env: [ 'DBUS_BROKER_TEST_DAEMON=' + dbus_bin ])
test('Driver API', test_driver,
suite: 'dbus-daemon(1)',
env: [ 'DBUS_BROKER_TEST_DAEMON=' + dbus_bin ])
test('FD Stream Constraints', test_fdstream,
suite: 'dbus-daemon(1)',
env: [ 'DBUS_BROKER_TEST_DAEMON=' + dbus_bin ])
test('Client Lifetime', test_lifetime,
suite: 'dbus-daemon(1)',
env: [ 'DBUS_BROKER_TEST_DAEMON=' + dbus_bin ])
test('Signals and Matches', test_matches,
suite: 'dbus-daemon(1)',
env: [ 'DBUS_BROKER_TEST_DAEMON=' + dbus_bin ])
endif
23 changes: 17 additions & 6 deletions test/dbus/util-broker.c
Original file line number Diff line number Diff line change
Expand Up @@ -465,14 +465,25 @@ void util_broker_spawn(Broker *broker) {
/* read address from pipe */
n = read(broker->pipe_fds[0], buffer, sizeof(buffer) - 1);
c_assert(n >= 0 && n < (ssize_t)sizeof(buffer));
c_assert(!strncmp(buffer, "unix:abstract=", strlen("unix:abstract=")));

/* copy over the path into @broker */
broker->address.sun_path[0] = '\0';
e = memccpy(broker->address.sun_path + 1,
buffer + strlen("unix:abstract="),
',',
sizeof(broker->address.sun_path) - 2);
if (strncmp(buffer, "unix:abstract=", strlen("unix:abstract=")) == 0) {
/* Abstract socket (dbus-daemon pre-v1.15.2) */
broker->address.sun_path[0] = '\0';
e = memccpy(broker->address.sun_path + 1,
buffer + strlen("unix:abstract="),
',',
sizeof(broker->address.sun_path) - 2);
} else if (strncmp(buffer, "unix:path=", strlen("unix:path=")) == 0) {
/* Path-based socket (dbus-daemon v1.15.2 and later) */
e = memccpy(broker->address.sun_path,
buffer + strlen("unix:path="),
',',
sizeof(broker->address.sun_path) - 1);
} else
/* Anything else is unexpected */
assert(false);

c_assert(e);
--e;
c_assert(*e == ',');
Expand Down
Loading