A new user interface for you! Read more...

File capnproto-0.5.3-fix-eagain-test-failure.patch of Package capnproto

Description: Read all data from anon pipe in tests
  It seems that if we read less than PIPE_BUF bytes from an
  anonymous pipe after filling up its buffer, the pipe will
  never enter the writable state. As a result, the write
  observer never fires and the AsyncUnixTest::WriteObserver
  test fails on architectures with a page size > 4kb.
Author: Tom Lee <debian@tomlee.co>
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=790571
Last-Update: 2015-08-01
--- a/src/kj/async-unix-test.c++
+++ b/src/kj/async-unix-test.c++
@@ -394,15 +394,20 @@
   KJ_SYSCALL(pipe(pipefds));
   kj::AutoCloseFd infd(pipefds[0]), outfd(pipefds[1]);
   setNonblocking(outfd);
+  setNonblocking(infd);
 
   UnixEventPort::FdObserver observer(port, outfd, UnixEventPort::FdObserver::OBSERVE_WRITE);
 
-  // Fill buffer.
+  // Fill the pipe buffer.
   ssize_t n;
   do {
     KJ_NONBLOCKING_SYSCALL(n = write(outfd, "foo", 3));
   } while (n >= 0);
 
+  // Make sure we haven't hit some unexpected failure.
+  EXPECT_EQ(n, -1);
+  EXPECT_EQ(errno, EAGAIN);
+
   bool writable = false;
   auto promise = observer.whenBecomesWritable()
       .then([&]() { writable = true; }).eagerlyEvaluate(nullptr);
@@ -414,7 +419,13 @@
   EXPECT_FALSE(writable);
 
   char buffer[4096];
-  KJ_SYSCALL(read(infd, &buffer, sizeof(buffer)));
+  do {
+      KJ_NONBLOCKING_SYSCALL(n = read(infd, &buffer, sizeof(buffer)));
+  } while (n >= 0);
+
+  // Make sure we've fully drained the buffer.
+  EXPECT_EQ(n, -1);
+  EXPECT_EQ(errno, EAGAIN);
 
   loop.run();
   port.poll();