Commit 6d4c7f57 authored by Kenton Varda's avatar Kenton Varda

Fix tests on Cygwin.

parent bd613c86
......@@ -294,8 +294,10 @@ TEST(AsyncIo, Udp) {
EXPECT_FALSE(ancillary.isTruncated);
}
#ifdef IP_PKTINFO
#if defined(IP_PKTINFO) && !__CYGWIN__
// Set IP_PKTINFO header and try to receive it.
// Doesn't work on Cygwin; see: https://cygwin.com/ml/cygwin/2009-01/msg00350.html
// TODO(someday): Might work on more-recent Cygwin; I'm still testing against 1.7.
int one = 1;
port1->setsockopt(IPPROTO_IP, IP_PKTINFO, &one, sizeof(one));
......
......@@ -513,12 +513,23 @@ TEST(AsyncUnixTest, UrgentObserver) {
UnixEventPort::FdObserver observer(port, clientFd,
UnixEventPort::FdObserver::OBSERVE_READ | UnixEventPort::FdObserver::OBSERVE_URGENT);
// Attempt to read the urgent byte prior to reading the in-band byte.
observer.whenUrgentDataAvailable().wait(waitScope);
#if __CYGWIN__
// On Cygwin, reading the urgent byte first causes the subsequent regular read to block until
// such a time as the connection closes -- and then the byte is successfully returned. This
// seems to be a cygwin bug.
KJ_SYSCALL(recv(clientFd, &c, 1, 0));
EXPECT_EQ('i', c);
KJ_SYSCALL(recv(clientFd, &c, 1, MSG_OOB));
EXPECT_EQ('o', c);
#else
// Attempt to read the urgent byte prior to reading the in-band byte.
KJ_SYSCALL(recv(clientFd, &c, 1, MSG_OOB));
EXPECT_EQ('o', c);
KJ_SYSCALL(recv(clientFd, &c, 1, 0));
EXPECT_EQ('i', c);
#endif
// Allow server thread to let its clientFd go out of scope.
c = 'q';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment