From 1ecf307e3ec34573c0fea3fa3a29fe436ce7d94a Mon Sep 17 00:00:00 2001 From: Frantisek Sumsal Date: Wed, 13 Mar 2024 15:39:28 +0100 Subject: [PATCH 1/3] test: use get_variable() instead of deprecated get_pkgconfig_variable() get_pkgconfig_variable() was deprecated in 0.56.0. test/dbus/meson.build:76: WARNING: Project targets '>=0.60.0' but uses feature deprecated since '0.56.0': dependency.get_pkgconfig_variable. use dependency.get_variable(pkgconfig : ...) instead --- test/dbus/meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/dbus/meson.build b/test/dbus/meson.build index 683a653c..2bb58340 100644 --- a/test/dbus/meson.build +++ b/test/dbus/meson.build @@ -73,7 +73,7 @@ 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' + dbus_bin = dep_dbus.get_variable(pkgconfig: '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) From 6525694dc91cbe521760807e84de464ce9f8921a Mon Sep 17 00:00:00 2001 From: Frantisek Sumsal Date: Wed, 13 Mar 2024 15:32:25 +0100 Subject: [PATCH 2/3] test: separate reference tests into a suite Newer meson doesn't like colons in test names: test/dbus/meson.build:78: DEPRECATION: ":" is not allowed in test name "dbus-daemon(1): Connection", it has been replaced with "_" test/dbus/meson.build:79: DEPRECATION: ":" is not allowed in test name "dbus-daemon(1): Message passing", it has been replaced with "_" ... Let's instead separate the reference tests/benchmarks into their own suite. This also makes running just the reference tests easier by using meson test's --suite= argument: $ meson test -C build --list --suite 'dbus-daemon(1)' dbus-broker:dbus-daemon(1) / Broker API dbus-broker:dbus-daemon(1) / Driver API dbus-broker:dbus-daemon(1) / FD Stream Constraints dbus-broker:dbus-daemon(1) / Client Lifetime dbus-broker:dbus-daemon(1) / Signals and Matches --- test/dbus/meson.build | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/test/dbus/meson.build b/test/dbus/meson.build index 2bb58340..ec8ecd6f 100644 --- a/test/dbus/meson.build +++ b/test/dbus/meson.build @@ -75,12 +75,28 @@ test('Signals and Matches', test_matches) if use_reference_test dbus_bin = dep_dbus.get_variable(pkgconfig: '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 ]) + 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 From d44b619be0347f74868cceed22474af5012fa1f7 Mon Sep 17 00:00:00 2001 From: Frantisek Sumsal Date: Wed, 13 Mar 2024 16:26:01 +0100 Subject: [PATCH 3/3] test: support dbus-daemon v1.15.2 dbus-daemon v1.15.2 switched from using abstract sockets to path-based sockets. Let's tweak the reference tests to support both cases. --- test/dbus/util-broker.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/test/dbus/util-broker.c b/test/dbus/util-broker.c index 3cb4e1dd..a9636a50 100644 --- a/test/dbus/util-broker.c +++ b/test/dbus/util-broker.c @@ -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 == ',');