diff --git a/starboard/nplb/posix_compliance/posix_socket_send_test.cc b/starboard/nplb/posix_compliance/posix_socket_send_test.cc index 85fc855806eb..561b72b2021c 100644 --- a/starboard/nplb/posix_compliance/posix_socket_send_test.cc +++ b/starboard/nplb/posix_compliance/posix_socket_send_test.cc @@ -17,6 +17,7 @@ #include #include +#include #include #include "starboard/nplb/posix_compliance/posix_socket_helpers.h" #include "starboard/thread.h" @@ -78,7 +79,7 @@ TEST(PosixSocketSendTest, RainyDayUnconnectedSocket) { EXPECT_TRUE(errno == ECONNRESET || errno == ENETRESET || errno == EPIPE || errno == ENOTCONN); - SB_DLOG(INFO) << "Failed to send, errno = " << errno; + SB_DLOG(INFO) << "Failed to send, errno = " << strerror(errno); EXPECT_TRUE(close(socket_fd) == 0); } @@ -111,10 +112,11 @@ TEST(PosixSocketSendTest, RainyDaySendToClosedSocket) { EXPECT_TRUE(pthread_join(send_thread, &thread_result) == 0); EXPECT_TRUE(errno == ECONNRESET || errno == ENETRESET || errno == EPIPE || - errno == ENOTCONN || // errno on Windows - errno == EINPROGRESS // errno on Evergreen + errno == ENOTCONN || // errno on Windows + errno == EINPROGRESS || // errno on Evergreen + errno == ENETUNREACH // errno on raspi ); - SB_DLOG(INFO) << "Failed to send, errno = " << errno; + SB_DLOG(INFO) << "Failed to send, errno = " << strerror(errno); // Clean up the server socket. EXPECT_TRUE(close(server_socket_fd) == 0); @@ -149,7 +151,7 @@ TEST(PosixSocketSendTest, RainyDaySendToSocketUntilBlocking) { // If we didn't get a socket, it should be pending. EXPECT_TRUE(errno == EINPROGRESS || errno == EAGAIN || errno == EWOULDBLOCK); - SB_DLOG(INFO) << "Failed to send, errno = " << errno; + SB_DLOG(INFO) << "Failed to send, errno = " << strerror(errno); break; } @@ -201,7 +203,7 @@ TEST(PosixSocketSendTest, RainyDaySendToSocketConnectionReset) { if (result < 0) { EXPECT_TRUE(errno == ECONNRESET || errno == ENETRESET || errno == EPIPE || errno == ECONNABORTED); - SB_DLOG(INFO) << "Failed to send, errno = " << errno; + SB_DLOG(INFO) << "Failed to send, errno = " << strerror(errno); break; } diff --git a/starboard/nplb/posix_compliance/posix_socket_sendto_test.cc b/starboard/nplb/posix_compliance/posix_socket_sendto_test.cc index 1414e78cbbac..5ff829f2239a 100644 --- a/starboard/nplb/posix_compliance/posix_socket_sendto_test.cc +++ b/starboard/nplb/posix_compliance/posix_socket_sendto_test.cc @@ -17,6 +17,7 @@ #include #include +#include #include #include "starboard/nplb/posix_compliance/posix_socket_helpers.h" @@ -81,7 +82,7 @@ TEST(PosixSocketSendtoTest, RainyDayUnconnectedSocket) { EXPECT_TRUE(errno == ECONNRESET || errno == ENETRESET || errno == EPIPE || errno == ENOTCONN); - SB_DLOG(INFO) << "Failed to send, errno = " << errno; + SB_DLOG(INFO) << "Failed to send, errno = " << strerror(errno); EXPECT_TRUE(close(socket_fd) == 0); } @@ -114,10 +115,11 @@ TEST(PosixSocketSendtoTest, RainyDaySendToClosedSocket) { EXPECT_TRUE(pthread_join(send_thread, &thread_result) == 0); EXPECT_TRUE(errno == ECONNRESET || errno == ENETRESET || errno == EPIPE || - errno == ENOTCONN || // errno on Windows - errno == EINPROGRESS // errno on Evergreen + errno == ENOTCONN || // errno on Windows + errno == EINPROGRESS || // errno on Evergreen + errno == ENETUNREACH // errno on raspi ); - SB_DLOG(INFO) << "Failed to send, errno = " << errno; + SB_DLOG(INFO) << "Failed to send, errno = " << strerror(errno); // Clean up the server socket. EXPECT_TRUE(close(server_socket_fd) == 0); @@ -152,7 +154,7 @@ TEST(PosixSocketSendtoTest, RainyDaySendToSocketUntilBlocking) { // If we didn't get a socket, it should be pending. EXPECT_TRUE(errno == EINPROGRESS || errno == EAGAIN || errno == EWOULDBLOCK); - SB_DLOG(INFO) << "Failed to send, errno = " << errno; + SB_DLOG(INFO) << "Failed to send, errno = " << strerror(errno); break; } @@ -200,7 +202,7 @@ TEST(PosixSocketSendtoTest, RainyDaySendToSocketConnectionReset) { if (result < 0) { EXPECT_TRUE(errno == ECONNRESET || errno == ENETRESET || errno == EPIPE || errno == ECONNABORTED); - SB_DLOG(INFO) << "Failed to send, errno = " << errno; + SB_DLOG(INFO) << "Failed to send, errno = " << strerror(errno); break; } diff --git a/starboard/shared/win32/posix_emu/socket.cc b/starboard/shared/win32/posix_emu/socket.cc index c55afaef1c1b..f1d160f6ed88 100644 --- a/starboard/shared/win32/posix_emu/socket.cc +++ b/starboard/shared/win32/posix_emu/socket.cc @@ -15,7 +15,8 @@ // We specifically do not include since the define causes a loop #include -#include // Needed for file-specific `_close`. +#include // Needed for file-specific `_close`. +#include #include // Our version that declares generic `close`. #include #undef NO_ERROR // http://b/302733082#comment15 @@ -225,7 +226,7 @@ static void set_errno() { } _set_errno(sockError); - SB_DLOG(INFO) << "Encounter socket error: " << sockError; + SB_DLOG(INFO) << "Encounter socket error: " << strerror(sockError); } ///////////////////////////////////////////////////////////////////////////////