]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test-notify-recv: fix message string
authorYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 7 Apr 2025 14:47:33 +0000 (23:47 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 7 Apr 2025 17:04:13 +0000 (02:04 +0900)
Follow-up for 2351bc991e3a4f1fbdaa2d53900980b6703babbd.
Addresses https://github.com/systemd/systemd/pull/37016#discussion_r2031363409.

src/test/test-notify-recv.c

index 80efe0c0f093a1b5b90f040f252cdd4f4cd809d1..8634df9fd18f245faf151ccf998fc156a8114e90 100644 (file)
@@ -47,12 +47,12 @@ static int on_recv(sd_event_source *s, int fd, uint32_t revents, void *userdata)
         if (strv_contains(l, "FIRST_MESSAGE=1")) {
                 ASSERT_STREQ(l[0], "FIRST_MESSAGE=1");
                 ASSERT_NULL(l[1]);
-                ASSERT_EQ(c->data, 0u);
+                ASSERT_EQ(++c->data, 1u);
                 ASSERT_NULL(fds);
         } else if (strv_contains(l, "SECOND_MESSAGE=1")) {
                 ASSERT_STREQ(l[0], "SECOND_MESSAGE=1");
                 ASSERT_STREQ(l[1], "ADDITIONAL_DATA=hoge");
-                ASSERT_EQ(c->data, 1u);
+                ASSERT_EQ(++c->data, 2u);
                 ASSERT_NOT_NULL(fds);
                 ASSERT_EQ(fdset_size(fds), 2u);
 
@@ -64,8 +64,6 @@ static int on_recv(sd_event_source *s, int fd, uint32_t revents, void *userdata)
                 }
         }
 
-        c->data++;
-
         return 0;
 }
 
@@ -107,7 +105,7 @@ TEST(notify_socket_prepare) {
                 ASSERT_OK_POSITIVE(
                         sd_pid_notify_with_fds(
                                 0, /* unset_environment = */ false,
-                                "FIRST_MESSAGE=2\nADDITIONAL_DATA=hoge", (int[]) { fd1, fd2 }, 2));
+                                "SECOND_MESSAGE=1\nADDITIONAL_DATA=hoge", (int[]) { fd1, fd2 }, 2));
                 _exit(EXIT_SUCCESS);
         }