Skip to content

Commit

Permalink
Do not run the QuicAsyncUDPSocket tests that require FOLLY_HAVE_MSG_E…
Browse files Browse the repository at this point in the history
…RRQUEUE on Windows

Summary:
As title.

This skips all of these tests on Windows. We can provide alternative implementations for the tests on Windows when we support the Error Callback.

If skipping the tests still causes noise in the TestX dashboard, we can completely disable them instead.

Reviewed By: sharmafb

Differential Revision: D66791494

fbshipit-source-id: 805f9cc7afaa698902812c9f53087bd28234926e
  • Loading branch information
jbeshay authored and facebook-github-bot committed Dec 5, 2024
1 parent d40144a commit c842150
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions quic/common/udpsocket/test/QuicAsyncUDPSocketTestBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,13 @@ TYPED_TEST_SUITE_P(QuicAsyncUDPSocketTest);
// Tests start here

TYPED_TEST_P(QuicAsyncUDPSocketTest, ErrToNonExistentServer) {
#ifdef FOLLY_HAVE_MSG_ERRQUEUE
this->udpSocket_->resumeRead(&this->readCb_);
this->udpSocket_->setErrMessageCallback(&this->errCb_);

folly::SocketAddress addr("127.0.0.1", 10000);
bool errRecvd = false;
#ifdef MSG_ERRQUEUE

// Expect an ICMP error
EXPECT_CALL(this->errCb_, errMessage_(testing::_))
.WillOnce(testing::Invoke([this, &errRecvd](auto& cmsg) {
Expand All @@ -59,17 +60,21 @@ TYPED_TEST_P(QuicAsyncUDPSocketTest, ErrToNonExistentServer) {

// If an error is received, the read callback should not be triggered
EXPECT_CALL(this->readCb_, onNotifyDataAvailable_(testing::_)).Times(0);
#endif // FOLLY_HAVE_MSG_ERRQUEUE

auto sendBuf = folly::IOBuf::copyBuffer("hey");
iovec vec[quic::kNumIovecBufferChains];
size_t iovec_len =
sendBuf->fillIov(vec, sizeof(vec) / sizeof(vec[0])).numIovecs;
this->udpSocket_->write(addr, vec, iovec_len);
this->udpSocket_->getEventBase()->loopForever();
EXPECT_TRUE(errRecvd);
#else // !FOLLY_HAVE_MSG_ERRQUEUE
GTEST_SKIP();
#endif
}

TYPED_TEST_P(QuicAsyncUDPSocketTest, TestUnsetErrCallback) {
#ifdef FOLLY_HAVE_MSG_ERRQUEUE
this->udpSocket_->resumeRead(&this->readCb_);
this->udpSocket_->setErrMessageCallback(&this->errCb_);
this->udpSocket_->setErrMessageCallback(nullptr);
Expand Down Expand Up @@ -99,17 +104,20 @@ TYPED_TEST_P(QuicAsyncUDPSocketTest, TestUnsetErrCallback) {
auto timeout = std::make_unique<EvbTerminateTimeout>(evb.get());
evb->scheduleTimeout(timeout.get(), std::chrono::milliseconds(30));
evb->loopForever();
#else // !FOLLY_HAVE_MSG_ERRQUEUE
GTEST_SKIP();
#endif
}

TYPED_TEST_P(QuicAsyncUDPSocketTest, CloseInErrorCallback) {
#ifdef FOLLY_HAVE_MSG_ERRQUEUE
this->udpSocket_->resumeRead(&this->readCb_);
this->udpSocket_->setErrMessageCallback(&this->errCb_);

folly::SocketAddress addr("127.0.0.1", 10000);
bool errRecvd = false;
auto evb = this->udpSocket_->getEventBase();

#ifdef MSG_ERRQUEUE
// Expect an error and close the socket in it.
EXPECT_CALL(this->errCb_, errMessage_(testing::_))
.WillOnce(testing::Invoke([this, &errRecvd, &evb](auto&) {
Expand All @@ -121,14 +129,16 @@ TYPED_TEST_P(QuicAsyncUDPSocketTest, CloseInErrorCallback) {
// Since the socket is closed by the error callback, the read callback
// should not be triggered
EXPECT_CALL(this->readCb_, onNotifyDataAvailable_(testing::_)).Times(0);
#endif // FOLLY_HAVE_MSG_ERRQUEUE
auto sendBuf = folly::IOBuf::copyBuffer("hey");
iovec vec[quic::kNumIovecBufferChains];
size_t iovec_len =
sendBuf->fillIov(vec, sizeof(vec) / sizeof(vec[0])).numIovecs;
this->udpSocket_->write(addr, vec, iovec_len);
this->udpSocket_->getEventBase()->loopForever();
EXPECT_TRUE(errRecvd);
#else // !FOLLY_HAVE_MSG_ERRQUEUE
GTEST_SKIP();
#endif
}

// Tests end here
Expand Down

0 comments on commit c842150

Please sign in to comment.