Skip to content

Commit f002375

Browse files
committed
test-bus-vtable: it's OK if dbus is not running
Fixes systemd#5989.
1 parent bc9e9af commit f002375

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/libsystemd/sd-bus/test-bus-vtable.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
/* We use system assert.h here, because we don't want to keep macro.h and log.h C++ compatible */
55
#undef NDEBUG
66
#include <assert.h>
7+
#include <errno.h>
78

89
#include "sd-bus-vtable.h"
910

@@ -58,14 +59,17 @@ static const sd_bus_vtable vtable[] = {
5859
static void test_vtable(void) {
5960
sd_bus *bus = NULL;
6061
struct context c = {};
62+
int r;
6163

6264
assert(sd_bus_new(&bus) >= 0);
6365

6466
assert(sd_bus_add_object_vtable(bus, NULL, "/foo", "org.freedesktop.systemd.testVtable", vtable, &c) >= 0);
6567
assert(sd_bus_add_object_vtable(bus, NULL, "/foo", "org.freedesktop.systemd.testVtable2", vtable, &c) >= 0);
6668

6769
assert(sd_bus_set_address(bus, DEFAULT_BUS_PATH) >= 0);
68-
assert(sd_bus_start(bus) >= 0);
70+
r = sd_bus_start(bus);
71+
assert(r == 0 || /* success */
72+
r == -ENOENT /* dbus is inactive */ );
6973

7074
sd_bus_unref(bus);
7175
}

0 commit comments

Comments
 (0)