summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Szyndela <adrian.s@samsung.com>2020-03-31 12:21:31 +0200
committerAdrian Szyndela <adrian.s@samsung.com>2020-04-02 11:49:00 +0200
commit9ab291355f0b95744fe73335e3f2d3ae775b016c (patch)
treed63bfd8c6f1e90c7ca74df8792905030277ede31
parent2a1d4397401bdde86f0db8c1cf04243a1fa31e0e (diff)
downloadsystemd-9ab291355f0b95744fe73335e3f2d3ae775b016c.tar.gz
systemd-9ab291355f0b95744fe73335e3f2d3ae775b016c.tar.bz2
systemd-9ab291355f0b95744fe73335e3f2d3ae775b016c.zip
test-bus-track: add possibility of succeeding with kdbusupgrade-to-244sandbox/adrians/upgrade-to-244
-rw-r--r--src/libsystemd/sd-bus/test-bus-track.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/libsystemd/sd-bus/test-bus-track.c b/src/libsystemd/sd-bus/test-bus-track.c
index 68a0010368..5056b4806b 100644
--- a/src/libsystemd/sd-bus/test-bus-track.c
+++ b/src/libsystemd/sd-bus/test-bus-track.c
@@ -3,6 +3,8 @@
#include <errno.h>
#include <sys/socket.h>
+#include "bus-internal.h"
+#include "bus-kernel.h"
#include "sd-bus.h"
#include "macro.h"
@@ -21,7 +23,10 @@ static int track_cb_x(sd_bus_track *t, void *userdata) {
/* This means b's name disappeared. Let's now disconnect, to make sure the track handling on disconnect works
* as it should. */
- assert_se(shutdown(sd_bus_get_fd(sd_bus_track_get_bus(t)), SHUT_RDWR) >= 0);
+ if (sd_bus_track_get_bus(t)->is_kernel)
+ assert_se(bus_kernel_try_close(sd_bus_track_get_bus(t)) >= 0);
+ else
+ assert_se(shutdown(sd_bus_get_fd(sd_bus_track_get_bus(t)), SHUT_RDWR) >= 0);
return 1;
}
@@ -96,7 +101,14 @@ int main(int argc, char *argv[]) {
assert_se(r >= 0);
/* Now make b's name disappear */
- sd_bus_close(b);
+ if (b->is_kernel) {
+ r = sd_bus_try_close(b);
+ if (r < 0) {
+ log_error("Cannot close kdbus, skipping the test");
+ return EXIT_TEST_SKIP;
+ }
+ } else
+ sd_bus_close(b);
r = sd_event_loop(event);
assert_se(r >= 0);