summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2024-12-05 10:22:03 +0100
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2024-12-05 10:42:15 +0100
commitc96e272e4f439c5b58853facdef53156cf59247f (patch)
tree51abab25944126e2ad6aa812824f1abbe971b732
parenttest-acl-util: use ASSERT_* macros (diff)
downloadsystemd-c96e272e4f439c5b58853facdef53156cf59247f.tar.xz
systemd-c96e272e4f439c5b58853facdef53156cf59247f.zip
test-bus-util: use ASSERT_* macros
-rw-r--r--src/test/test-bus-util.c24
1 files changed, 11 insertions, 13 deletions
diff --git a/src/test/test-bus-util.c b/src/test/test-bus-util.c
index 2cf44d6e5a..491e790f6a 100644
--- a/src/test/test-bus-util.c
+++ b/src/test/test-bus-util.c
@@ -22,26 +22,24 @@ TEST(destroy_callback) {
int r, n_called = 0;
r = bus_open_system_watch_bind_with_description(&bus, "test-bus");
- if (r < 0) {
- log_error_errno(r, "Failed to connect to bus: %m");
- return;
- }
+ if (r < 0)
+ return (void) log_error_errno(r, "Failed to connect to bus: %m");
- r = sd_bus_request_name_async(bus, &slot, "org.freedesktop.systemd.test-bus-util", 0, callback, &n_called);
- assert_se(r == 1);
+ ASSERT_OK_EQ(sd_bus_request_name_async(bus, &slot, "org.freedesktop.systemd.test-bus-util", 0, callback, &n_called),
+ 1);
- assert_se(sd_bus_slot_get_destroy_callback(slot, NULL) == 0);
- assert_se(sd_bus_slot_get_destroy_callback(slot, &t) == 0);
+ ASSERT_EQ(sd_bus_slot_get_destroy_callback(slot, NULL), 0);
+ ASSERT_EQ(sd_bus_slot_get_destroy_callback(slot, &t), 0);
- assert_se(sd_bus_slot_set_destroy_callback(slot, destroy_callback) == 0);
- assert_se(sd_bus_slot_get_destroy_callback(slot, NULL) == 1);
- assert_se(sd_bus_slot_get_destroy_callback(slot, &t) == 1);
+ ASSERT_EQ(sd_bus_slot_set_destroy_callback(slot, destroy_callback), 0);
+ ASSERT_EQ(sd_bus_slot_get_destroy_callback(slot, NULL), 1);
+ ASSERT_EQ(sd_bus_slot_get_destroy_callback(slot, &t), 1);
assert_se(t == destroy_callback);
/* Force cleanup so we can look at n_called */
- assert_se(n_called == 0);
+ ASSERT_EQ(n_called, 0);
sd_bus_slot_unref(slot);
- assert_se(n_called == 1);
+ ASSERT_EQ(n_called, 1);
}
DEFINE_TEST_MAIN(LOG_DEBUG);