From: Yu Watanabe Date: Mon, 26 Aug 2024 21:22:19 +0000 (+0900) Subject: test: use more suitable assertions X-Git-Tag: v257-rc1~613^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d36d71cadec885e563e2358aaadb3e23a28c33c7;p=thirdparty%2Fsystemd.git test: use more suitable assertions --- 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) {