From d36d71cadec885e563e2358aaadb3e23a28c33c7 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Tue, 27 Aug 2024 06:22:19 +0900 Subject: [PATCH] test: use more suitable assertions --- .../sd-device/test-sd-device-monitor.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/libsystemd/sd-device/test-sd-device-monitor.c b/src/libsystemd/sd-device/test-sd-device-monitor.c index d6a6e5d364b..e1d65b5bc98 100644 --- a/src/libsystemd/sd-device/test-sd-device-monitor.c +++ b/src/libsystemd/sd-device/test-sd-device-monitor.c @@ -48,7 +48,7 @@ static int monitor_handler(sd_device_monitor *m, sd_device *d, void *userdata) { const char *s, *syspath = userdata; ASSERT_OK(sd_device_get_syspath(d, &s)); - ASSERT_TRUE(streq(s, syspath)); + ASSERT_STREQ(s, syspath); return sd_event_exit(sd_device_monitor_get_event(m), 100); } @@ -104,14 +104,14 @@ static void send_by_enumerator( TEST(sd_device_monitor_is_running) { _cleanup_(sd_device_monitor_unrefp) sd_device_monitor *m = NULL; - ASSERT_EQ(sd_device_monitor_is_running(NULL), 0); + ASSERT_OK_ZERO(sd_device_monitor_is_running(NULL)); ASSERT_OK(device_monitor_new_full(&m, MONITOR_GROUP_NONE, -1)); - ASSERT_EQ(sd_device_monitor_is_running(m), 0); + ASSERT_OK_ZERO(sd_device_monitor_is_running(m)); ASSERT_OK(sd_device_monitor_start(m, NULL, NULL)); - ASSERT_EQ(sd_device_monitor_is_running(m), 1); + ASSERT_OK_POSITIVE(sd_device_monitor_is_running(m)); ASSERT_OK(sd_device_monitor_stop(m)); - ASSERT_EQ(sd_device_monitor_is_running(m), 0); + ASSERT_OK_ZERO(sd_device_monitor_is_running(m)); } TEST(sd_device_monitor_start_stop) { @@ -381,16 +381,16 @@ TEST(sd_device_monitor_receive) { r = fd_wait_for_event(fd, POLLIN, 10 * USEC_PER_SEC); if (r == -EINTR) continue; - ASSERT_GT(r, 0); + ASSERT_OK_POSITIVE(r); break; } _cleanup_(sd_device_unrefp) sd_device *dev = NULL; - ASSERT_GT(sd_device_monitor_receive(monitor_client, &dev), 0); + ASSERT_OK_POSITIVE(sd_device_monitor_receive(monitor_client, &dev)); const char *s; ASSERT_OK(sd_device_get_syspath(dev, &s)); - ASSERT_TRUE(streq(s, syspath)); + ASSERT_STREQ(s, syspath); } static int intro(void) { -- 2.47.3