lib/deploy: Close test suite race condition
authorColin Walters <walters@verbum.org>
Wed, 9 Aug 2017 13:07:11 +0000 (09:07 -0400)
committerAtomic Bot <atomic-devel@projectatomic.io>
Thu, 10 Aug 2017 14:42:58 +0000 (14:42 +0000)
Saw this in a PR result; we need to wait for the child to have written its
result to stderr before we exit, otherwise the test suite may not read it in
time.

Closes: #1070
Approved by: jlebon

src/libostree/ostree-sysroot-deploy.c

index 622f99753746285a6f06e7241310c5281c5cecb8..18624640890bd53bc942600efd990e1e9159fa4d 100644 (file)
@@ -1083,7 +1083,12 @@ fsfreeze_thaw_cycle (OstreeSysroot *self,
         return glnx_throw_errno_prefix (error, "write(watchdog start)");
       /* Testing infrastructure */
       if (debug_fifreeze)
-        return glnx_throw (error, "aborting due to test-fifreeze");
+        {
+          int wstatus;
+          /* Ensure the child has written its data */
+          (void) TEMP_FAILURE_RETRY (waitpid (pid, &wstatus, 0));
+          return glnx_throw (error, "aborting due to test-fifreeze");
+        }
       /* Do a freeze/thaw cycle; TODO add a FIFREEZETHAW ioctl */
       if (ioctl (rootfs_dfd, FIFREEZE, 0) != 0)
         {