chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
remove unused includes
[elogind.git]
/
src
/
libsystemd
/
sd-bus
/
test-bus-cleanup.c
diff --git
a/src/libsystemd/sd-bus/test-bus-cleanup.c
b/src/libsystemd/sd-bus/test-bus-cleanup.c
index e36a69f0d1e14d4334ec9c7b0fd194b493f05b4f..f58688059304e821be5be2495317eeaf9814eb9f 100644
(file)
--- a/
src/libsystemd/sd-bus/test-bus-cleanup.c
+++ b/
src/libsystemd/sd-bus/test-bus-cleanup.c
@@
-34,11
+34,18
@@
static void test_bus_new(void) {
printf("after new: refcount %u\n", REFCNT_GET(bus->n_ref));
}
printf("after new: refcount %u\n", REFCNT_GET(bus->n_ref));
}
-static
void
test_bus_open(void) {
+static
int
test_bus_open(void) {
_cleanup_bus_unref_ sd_bus *bus = NULL;
_cleanup_bus_unref_ sd_bus *bus = NULL;
+ int r;
- assert_se(sd_bus_open_system(&bus) >= 0);
+ r = sd_bus_open_system(&bus);
+ if (r == -ECONNREFUSED || r == -ENOENT)
+ return r;
+
+ assert_se(r >= 0);
printf("after open: refcount %u\n", REFCNT_GET(bus->n_ref));
printf("after open: refcount %u\n", REFCNT_GET(bus->n_ref));
+
+ return 0;
}
static void test_bus_new_method_call(void) {
}
static void test_bus_new_method_call(void) {
@@
-70,11
+77,20
@@
static void test_bus_new_signal(void) {
}
int main(int argc, char **argv) {
}
int main(int argc, char **argv) {
+ int r;
+
log_parse_environment();
log_open();
test_bus_new();
log_parse_environment();
log_open();
test_bus_new();
- test_bus_open();
+ r = test_bus_open();
+ if (r < 0) {
+ log_info("Failed to connect to bus, skipping tests.");
+ return EXIT_TEST_SKIP;
+ }
+
test_bus_new_method_call();
test_bus_new_signal();
test_bus_new_method_call();
test_bus_new_signal();
+
+ return EXIT_SUCCESS;
}
}