From 8b054cadc548836f39ef2a6d294f65d8d8e227be Mon Sep 17 00:00:00 2001 From: Bruno Dal Bo Date: Wed, 20 Dec 2023 10:13:37 -0800 Subject: [PATCH] Use infinite timeouts for Fuchsia in syscall test PiperOrigin-RevId: 592592906 --- test/syscalls/linux/packet_socket.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/test/syscalls/linux/packet_socket.cc b/test/syscalls/linux/packet_socket.cc index e97660437..5e542d1b7 100644 --- a/test/syscalls/linux/packet_socket.cc +++ b/test/syscalls/linux/packet_socket.cc @@ -21,6 +21,7 @@ #include +#include "gmock/gmock.h" #include "gtest/gtest.h" #include "test/syscalls/linux/ip_socket_test_util.h" #include "test/util/capability_util.h" @@ -191,7 +192,9 @@ void ExpectReceiveOnPacketSocket(FileDescriptor& socket, .msg_iovlen = 1, }; - ASSERT_THAT(RecvMsgTimeout(socket.get(), &received_msg, 1 /*timeout*/), + // NB: poll indefinitely on Fuchsia to avoid timing out in Infra. + int timeout = GvisorPlatform() == Platform::kFuchsia ? -1 : 1; + ASSERT_THAT(RecvMsgTimeout(socket.get(), &received_msg, timeout), IsPosixErrorOkAndHolds(expected_read_len)); // sockaddr_ll ends with an 8 byte physical address field, but ethernet @@ -280,7 +283,9 @@ TEST_P(PacketSocketTest, RebindProtocol) { // Make sure the payload has been delivered (in case of asynchronous // delivery). char buf[sizeof(v)]; - EXPECT_THAT(RecvTimeout(udp_sock.get(), buf, sizeof(v), 1 /*timeout*/), + // NB: poll indefinitely on Fuchsia to avoid timing out in Infra. + int timeout = GvisorPlatform() == Platform::kFuchsia ? -1 : 1; + EXPECT_THAT(RecvTimeout(udp_sock.get(), buf, sizeof(v), timeout), IsPosixErrorOkAndHolds(sizeof(v))); ASSERT_EQ(*reinterpret_cast(buf), v); };