]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test-async: Wait for asynchronous_sync() to finish 36611/head
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Tue, 4 Mar 2025 21:31:39 +0000 (22:31 +0100)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Wed, 5 Mar 2025 09:50:40 +0000 (10:50 +0100)
Otherwise, if the system is busy, TEST-02-UNITTESTS will fail as
systemd will time out trying to kill the transient unit that we're
running test-async in.

src/test/test-async.c

index 443505c3eb06dca1111e1c4965e7ab990384b7dc..2b87faba7db2a5f46bfa931b4ae2ca63a7c21562 100644 (file)
@@ -15,7 +15,9 @@
 #include "tmpfile-util.h"
 
 TEST(asynchronous_sync) {
-        ASSERT_OK(asynchronous_sync(NULL));
+        _cleanup_(pidref_done) PidRef pidref = PIDREF_NULL;
+        ASSERT_OK(asynchronous_sync(&pidref));
+        ASSERT_OK(pidref_wait_for_terminate(&pidref, /* ret= */ NULL));
 }
 
 static void wait_fd_closed(int fd) {