1
0
mirror of https://github.com/facebookincubator/mvfst.git synced 2025-08-08 09:42:06 +03:00

Enable more tests for Windows

Summary: Enable more tests for Windows

Reviewed By: mjoras

Differential Revision: D39595126

fbshipit-source-id: 702d243ff7fbb5ffdb18af2dd1d13c184599ef75
This commit is contained in:
Konstantin Tsoy
2022-09-20 21:01:48 -07:00
committed by Facebook GitHub Bot
parent 64bb5c731e
commit bad5e085ba
8 changed files with 98 additions and 91 deletions

View File

@@ -401,14 +401,9 @@ class MockLegacyObserver : public LegacyObserver {
bool timeoutLoss) {
return AllOf(
testing::Field(
&SocketObserverInterface::LostPacket::lostByReorderThreshold,
testing::Eq(reorderLoss)),
testing::Field(
&SocketObserverInterface::LostPacket::lostByTimeout,
testing::Eq(timeoutLoss)),
testing::Field(
&SocketObserverInterface::LostPacket::packet,
getLossPacketNum(packetNum)));
&LostPacket::lostByReorderThreshold, testing::Eq(reorderLoss)),
testing::Field(&LostPacket::lostByTimeout, testing::Eq(timeoutLoss)),
testing::Field(&LostPacket::packet, getLossPacketNum(packetNum)));
}
static auto getStreamEventMatcher(

View File

@@ -627,8 +627,8 @@ INSTANTIATE_TEST_SUITE_P(
QuicTransportImplTestBase,
QuicTransportImplTestBase,
::testing::Values(
DelayedStreamNotifsTestParam{.notifyOnNewStreamsExplicitly = false},
DelayedStreamNotifsTestParam{.notifyOnNewStreamsExplicitly = true}));
DelayedStreamNotifsTestParam{false},
DelayedStreamNotifsTestParam{true}));
TEST_P(QuicTransportImplTestBase, AckTimeoutExpiredWillResetTimeoutFlag) {
transport->invokeAckTimeout();
@@ -1662,14 +1662,10 @@ TEST_P(QuicTransportImplTestBase, ByteEventCallbacksManagementSingleStream) {
auto stream = transport->createBidirectionalStream().value();
uint64_t offset1 = 10, offset2 = 20;
ByteEvent txEvent1 = {
.id = stream, .offset = offset1, .type = ByteEvent::Type::TX};
ByteEvent txEvent2 = {
.id = stream, .offset = offset2, .type = ByteEvent::Type::TX};
ByteEvent ackEvent1 = {
.id = stream, .offset = offset1, .type = ByteEvent::Type::ACK};
ByteEvent ackEvent2 = {
.id = stream, .offset = offset2, .type = ByteEvent::Type::ACK};
ByteEvent txEvent1 = ByteEvent{stream, offset1, ByteEvent::Type::TX};
ByteEvent txEvent2 = ByteEvent{stream, offset2, ByteEvent::Type::TX};
ByteEvent ackEvent1 = ByteEvent{stream, offset1, ByteEvent::Type::ACK};
ByteEvent ackEvent2 = ByteEvent{stream, offset2, ByteEvent::Type::ACK};
// Register 2 TX and 2 ACK events for the same stream at 2 different offsets
transport->registerTxCallback(
@@ -1750,14 +1746,10 @@ TEST_P(
auto stream1 = transport->createBidirectionalStream().value();
auto stream2 = transport->createBidirectionalStream().value();
ByteEvent txEvent1 = {
.id = stream1, .offset = 10, .type = ByteEvent::Type::TX};
ByteEvent txEvent2 = {
.id = stream2, .offset = 20, .type = ByteEvent::Type::TX};
ByteEvent ackEvent1 = {
.id = stream1, .offset = 10, .type = ByteEvent::Type::ACK};
ByteEvent ackEvent2 = {
.id = stream2, .offset = 20, .type = ByteEvent::Type::ACK};
ByteEvent txEvent1 = ByteEvent{stream1, 10, ByteEvent::Type::TX};
ByteEvent txEvent2 = ByteEvent{stream2, 20, ByteEvent::Type::TX};
ByteEvent ackEvent1 = ByteEvent{stream1, 10, ByteEvent::Type::ACK};
ByteEvent ackEvent2 = ByteEvent{stream2, 20, ByteEvent::Type::ACK};
EXPECT_THAT(byteEventCallback.getByteEventTracker(), IsEmpty());
// Register 2 TX and 2 ACK events for 2 separate streams.
@@ -4130,8 +4122,7 @@ class QuicTransportImplTestWithGroups : public QuicTransportImplTestBase {};
INSTANTIATE_TEST_SUITE_P(
QuicTransportImplTestWithGroups,
QuicTransportImplTestWithGroups,
::testing::Values(DelayedStreamNotifsTestParam{
.notifyOnNewStreamsExplicitly = true}));
::testing::Values(DelayedStreamNotifsTestParam{true}));
TEST_P(QuicTransportImplTestWithGroups, ReadCallbackWithGroupsDataAvailable) {
auto transportSettings = transport->getTransportSettings();

View File

@@ -1170,11 +1170,11 @@ TYPED_TEST(
transport,
AllOf(
// should not be equal to an empty event
testing::Ne(SocketObserverInterface::CloseStartedEvent{
.maybeCloseReason = folly::none}),
testing::Ne(
SocketObserverInterface::CloseStartedEvent{folly::none}),
// should be equal to a populated event with default error
testing::Eq(SocketObserverInterface::CloseStartedEvent{
.maybeCloseReason = defaultError}))));
testing::Eq(
SocketObserverInterface::CloseStartedEvent{defaultError}))));
EXPECT_CALL(*observer, closing(transport, _));
transport->close(folly::none);
Mock::VerifyAndClearExpectations(observer.get());
@@ -1210,11 +1210,11 @@ TYPED_TEST(
transport,
AllOf(
// should not be equal to an empty event
testing::Ne(SocketObserverInterface::CloseStartedEvent{
.maybeCloseReason = folly::none}),
testing::Ne(
SocketObserverInterface::CloseStartedEvent{folly::none}),
// should be equal to a populated event with default error
testing::Eq(SocketObserverInterface::CloseStartedEvent{
.maybeCloseReason = defaultError}))));
testing::Eq(
SocketObserverInterface::CloseStartedEvent{defaultError}))));
transport->close(folly::none);
// wait for the drain
@@ -1257,11 +1257,11 @@ TYPED_TEST(
transport,
AllOf(
// should not be equal to an empty event
testing::Ne(SocketObserverInterface::CloseStartedEvent{
.maybeCloseReason = folly::none}),
testing::Ne(
SocketObserverInterface::CloseStartedEvent{folly::none}),
// should be equal to a populated event with default error
testing::Eq(SocketObserverInterface::CloseStartedEvent{
.maybeCloseReason = defaultError}))));
testing::Eq(
SocketObserverInterface::CloseStartedEvent{defaultError}))));
transport->close(folly::none);
Mock::VerifyAndClearExpectations(observer.get());
@@ -1298,11 +1298,11 @@ TYPED_TEST(
transport,
AllOf(
// should not be equal to an empty event
testing::Ne(SocketObserverInterface::CloseStartedEvent{
.maybeCloseReason = folly::none}),
testing::Ne(
SocketObserverInterface::CloseStartedEvent{folly::none}),
// should be equal to a populated event with default error
testing::Eq(SocketObserverInterface::CloseStartedEvent{
.maybeCloseReason = testError}))));
testing::Eq(
SocketObserverInterface::CloseStartedEvent{testError}))));
EXPECT_CALL(*observer, closing(transport, _));
transport->close(testError);
Mock::VerifyAndClearExpectations(observer.get());
@@ -1340,11 +1340,11 @@ TYPED_TEST(
transport,
AllOf(
// should not be equal to an empty event
testing::Ne(SocketObserverInterface::CloseStartedEvent{
.maybeCloseReason = folly::none}),
testing::Ne(
SocketObserverInterface::CloseStartedEvent{folly::none}),
// should be equal to a populated event with default error
testing::Eq(SocketObserverInterface::CloseStartedEvent{
.maybeCloseReason = testError}))));
testing::Eq(
SocketObserverInterface::CloseStartedEvent{testError}))));
EXPECT_CALL(*observer, closing(transport, _));
transport->close(testError);
Mock::VerifyAndClearExpectations(observer.get());
@@ -2056,7 +2056,8 @@ TYPED_TEST(
testing::Gt(strLength)));
EXPECT_CALL(*obs1, packetsWritten(_, _)).Times(0);
EXPECT_CALL(*obs2, packetsWritten(transport, packetsWrittenMatcher))
.WillOnce([oldTInfo = this->getTransport()->getTransportInfo()](
.WillOnce([oldTInfo = this->getTransport()->getTransportInfo(),
cwndInBytes = cwndInBytes](
const auto& socket, const auto& event) {
const auto bytesWritten =
socket->getTransportInfo().bytesSent - oldTInfo.bytesSent;
@@ -2067,7 +2068,8 @@ TYPED_TEST(
EXPECT_EQ(bytesWritten, event.numBytesWritten);
});
EXPECT_CALL(*obs3, packetsWritten(transport, packetsWrittenMatcher))
.WillOnce([oldTInfo = this->getTransport()->getTransportInfo()](
.WillOnce([oldTInfo = this->getTransport()->getTransportInfo(),
cwndInBytes = cwndInBytes](
const auto& socket, const auto& event) {
const auto bytesWritten =
socket->getTransportInfo().bytesSent - oldTInfo.bytesSent;
@@ -2095,7 +2097,8 @@ TYPED_TEST(
EXPECT_CALL(*obs1, appRateLimited(_, _)).Times(0);
EXPECT_CALL(*obs2, appRateLimited(transport, appRateLimitedMatcher))
.WillOnce([oldTInfo = this->getTransport()->getTransportInfo()](
.WillOnce([oldTInfo = this->getTransport()->getTransportInfo(),
cwndInBytes = cwndInBytes](
const auto& socket, const auto& event) {
const auto bytesWritten =
socket->getTransportInfo().bytesSent - oldTInfo.bytesSent;
@@ -2105,7 +2108,8 @@ TYPED_TEST(
event.maybeWritableBytes);
});
EXPECT_CALL(*obs3, appRateLimited(transport, appRateLimitedMatcher))
.WillOnce([oldTInfo = this->getTransport()->getTransportInfo()](
.WillOnce([oldTInfo = this->getTransport()->getTransportInfo(),
cwndInBytes = cwndInBytes](
const auto& socket, const auto& event) {
const auto bytesWritten =
socket->getTransportInfo().bytesSent - oldTInfo.bytesSent;
@@ -2233,7 +2237,8 @@ TYPED_TEST(
testing::AllOf(testing::Gt(bufLength), testing::Gt(cwndInBytes))));
EXPECT_CALL(*obs1, packetsWritten(_, _)).Times(0);
EXPECT_CALL(*obs2, packetsWritten(transport, packetsWrittenMatcher))
.WillOnce([oldTInfo = this->getTransport()->getTransportInfo()](
.WillOnce([oldTInfo = this->getTransport()->getTransportInfo(),
cwndInBytes = cwndInBytes](
const auto& socket, const auto& event) {
const auto bytesWritten =
socket->getTransportInfo().bytesSent - oldTInfo.bytesSent;
@@ -2244,7 +2249,8 @@ TYPED_TEST(
EXPECT_EQ(bytesWritten, event.numBytesWritten);
});
EXPECT_CALL(*obs3, packetsWritten(transport, packetsWrittenMatcher))
.WillOnce([oldTInfo = this->getTransport()->getTransportInfo()](
.WillOnce([oldTInfo = this->getTransport()->getTransportInfo(),
cwndInBytes = cwndInBytes](
const auto& socket, const auto& event) {
const auto bytesWritten =
socket->getTransportInfo().bytesSent - oldTInfo.bytesSent;
@@ -2377,7 +2383,8 @@ TYPED_TEST(
testing::Ge(cwndInBytes))); // full CWND written
EXPECT_CALL(*obs1, packetsWritten(_, _)).Times(0);
EXPECT_CALL(*obs2, packetsWritten(transport, packetsWrittenMatcher))
.WillOnce([oldTInfo = this->getTransport()->getTransportInfo()](
.WillOnce([oldTInfo = this->getTransport()->getTransportInfo(),
cwndInBytes = cwndInBytes](
const auto& socket, const auto& event) {
const auto bytesWritten =
socket->getTransportInfo().bytesSent - oldTInfo.bytesSent;
@@ -2388,7 +2395,8 @@ TYPED_TEST(
EXPECT_EQ(bytesWritten, event.numBytesWritten);
});
EXPECT_CALL(*obs3, packetsWritten(transport, packetsWrittenMatcher))
.WillOnce([oldTInfo = this->getTransport()->getTransportInfo()](
.WillOnce([oldTInfo = this->getTransport()->getTransportInfo(),
cwndInBytes = cwndInBytes](
const auto& socket, const auto& event) {
const auto bytesWritten =
socket->getTransportInfo().bytesSent - oldTInfo.bytesSent;
@@ -2444,7 +2452,8 @@ TYPED_TEST(
testing::Lt(cwndInBytes)));
EXPECT_CALL(*obs1, packetsWritten(_, _)).Times(0);
EXPECT_CALL(*obs2, packetsWritten(transport, packetsWrittenMatcher))
.WillOnce([oldTInfo = this->getTransport()->getTransportInfo()](
.WillOnce([oldTInfo = this->getTransport()->getTransportInfo(),
cwndInBytes = cwndInBytes](
const auto& socket, const auto& event) {
const auto bytesWritten =
socket->getTransportInfo().bytesSent - oldTInfo.bytesSent;
@@ -2455,7 +2464,8 @@ TYPED_TEST(
EXPECT_EQ(bytesWritten, event.numBytesWritten);
});
EXPECT_CALL(*obs3, packetsWritten(transport, packetsWrittenMatcher))
.WillOnce([oldTInfo = this->getTransport()->getTransportInfo()](
.WillOnce([oldTInfo = this->getTransport()->getTransportInfo(),
cwndInBytes = cwndInBytes](
const auto& socket, const auto& event) {
const auto bytesWritten =
socket->getTransportInfo().bytesSent - oldTInfo.bytesSent;
@@ -2482,7 +2492,8 @@ TYPED_TEST(
testing::Lt(folly::Optional<uint64_t>(cwndInBytes))));
EXPECT_CALL(*obs1, appRateLimited(_, _)).Times(0);
EXPECT_CALL(*obs2, appRateLimited(transport, appRateLimitedMatcher))
.WillOnce([oldTInfo = this->getTransport()->getTransportInfo()](
.WillOnce([oldTInfo = this->getTransport()->getTransportInfo(),
cwndInBytes = cwndInBytes](
const auto& socket, const auto& event) {
const auto bytesWritten =
socket->getTransportInfo().bytesSent - oldTInfo.bytesSent;
@@ -2492,7 +2503,8 @@ TYPED_TEST(
event.maybeWritableBytes);
});
EXPECT_CALL(*obs3, appRateLimited(transport, appRateLimitedMatcher))
.WillOnce([oldTInfo = this->getTransport()->getTransportInfo()](
.WillOnce([oldTInfo = this->getTransport()->getTransportInfo(),
cwndInBytes = cwndInBytes](
const auto& socket, const auto& event) {
const auto bytesWritten =
socket->getTransportInfo().bytesSent - oldTInfo.bytesSent;

View File

@@ -67,36 +67,36 @@ INSTANTIATE_TEST_SUITE_P(
Packet8DecodeTests,
Packet8DecodeTest,
Values(
(Packet8DecodeData){0xaa82f30e, 0x94, 0xaa82f294},
(Packet8DecodeData){0xaa82f3fe, 0xff, 0xaa82f3ff},
(Packet8DecodeData){0xaa82ffff, 0x01, 0xaa830001},
(Packet8DecodeData){0xaa82fffe, 0x01, 0xaa830001}));
Packet8DecodeData{0xaa82f30e, 0x94, 0xaa82f294},
Packet8DecodeData{0xaa82f3fe, 0xff, 0xaa82f3ff},
Packet8DecodeData{0xaa82ffff, 0x01, 0xaa830001},
Packet8DecodeData{0xaa82fffe, 0x01, 0xaa830001}));
INSTANTIATE_TEST_SUITE_P(
Packet16DecodeTests,
Packet16DecodeTest,
Values(
(Packet16DecodeData){0xaa82f30e, 0x1f94, 0xaa831f94},
(Packet16DecodeData){0x10000, 0x9000, 0x9000},
(Packet16DecodeData){0x10000, 0x8000, 0x18000},
(Packet16DecodeData){0xffff, 0x8000, 0x18000},
(Packet16DecodeData){0xf20000, 0xffff, 0xf1ffff},
(Packet16DecodeData){0x0fff00f, 0x0000, 0x1000000},
(Packet16DecodeData){0x001f, 0x010f, 0x010f},
(Packet16DecodeData){0x001f, 0x000f, 0x000f},
(Packet16DecodeData){0x0001, 0x0fff, 0x0fff},
(Packet16DecodeData){0x0001, 0x0002, 0x0002},
(Packet16DecodeData){0x10000, 0x0001, 0x10001},
(Packet16DecodeData){0xaa82f30e, 0x9b3, 0xaa8309b3},
(Packet16DecodeData){0xa82f30ea, 0x9b32, 0xa82f9b32}));
Packet16DecodeData{0xaa82f30e, 0x1f94, 0xaa831f94},
Packet16DecodeData{0x10000, 0x9000, 0x9000},
Packet16DecodeData{0x10000, 0x8000, 0x18000},
Packet16DecodeData{0xffff, 0x8000, 0x18000},
Packet16DecodeData{0xf20000, 0xffff, 0xf1ffff},
Packet16DecodeData{0x0fff00f, 0x0000, 0x1000000},
Packet16DecodeData{0x001f, 0x010f, 0x010f},
Packet16DecodeData{0x001f, 0x000f, 0x000f},
Packet16DecodeData{0x0001, 0x0fff, 0x0fff},
Packet16DecodeData{0x0001, 0x0002, 0x0002},
Packet16DecodeData{0x10000, 0x0001, 0x10001},
Packet16DecodeData{0xaa82f30e, 0x9b3, 0xaa8309b3},
Packet16DecodeData{0xa82f30ea, 0x9b32, 0xa82f9b32}));
INSTANTIATE_TEST_SUITE_P(
Packet32DecodeTests,
Packet32DecodeTest,
Values(
(Packet32DecodeData){0xaa82f30e, 0x0094f30e, 0x10094f30e},
(Packet32DecodeData){0xbcaa82f30e, 0x00000000, 0xbd00000000},
(Packet32DecodeData){0xbcaa82f30e, 0xaa82f30f, 0xbcaa82f30f}));
Packet32DecodeData{0xaa82f30e, 0x0094f30e, 0x10094f30e},
Packet32DecodeData{0xbcaa82f30e, 0x00000000, 0xbd00000000},
Packet32DecodeData{0xbcaa82f30e, 0xaa82f30f, 0xbcaa82f30f}));
class EncodingTest : public Test {};

View File

@@ -1422,6 +1422,7 @@ TEST_F(QLoggerTest, NonPrettyStream) {
EXPECT_EQ((bool)getline(file, s), false);
}
#ifndef _WIN32
TEST_F(QLoggerTest, CompressedStream) {
folly::dynamic expected = folly::parseJson(expectedJsonStr1);
@@ -1509,6 +1510,7 @@ TEST_F(QLoggerTest, CompressedNonStream) {
EXPECT_EQ(expected["summary"], parsed["summary"]);
EXPECT_EQ(expected["traces"], parsed["traces"]);
}
#endif
TEST_F(QLoggerTest, NoThrowOnStreamingWithNonExistentDirectory) {
auto headerIn =

View File

@@ -63,6 +63,17 @@ class SocketObserverInterface {
friend auto operator<=>(
const CloseStartedEvent&,
const CloseStartedEvent&) = default;
#elif _WIN32
friend auto operator!=(
const CloseStartedEvent& right,
const CloseStartedEvent& left) {
return right.maybeCloseReason != left.maybeCloseReason;
}
friend auto operator==(
const CloseStartedEvent& right,
const CloseStartedEvent& left) {
return right.maybeCloseReason == left.maybeCloseReason;
}
#endif
};

View File

@@ -7,7 +7,7 @@
#include <quic/state/PacketEvent.h>
#include <gtest/gtest.h>
#include <folly/portability/GTest.h>
namespace quic {
namespace test {

View File

@@ -21,8 +21,8 @@ namespace quic {
namespace test {
struct StreamManagerTestParam {
bool notifyOnNewStreamsExplicitly;
bool isUnidirectional;
bool notifyOnNewStreamsExplicitly{false};
bool isUnidirectional{false};
};
class QuicStreamManagerTest
@@ -707,8 +707,8 @@ INSTANTIATE_TEST_SUITE_P(
QuicStreamManagerTest,
QuicStreamManagerTest,
::testing::Values(
StreamManagerTestParam{.notifyOnNewStreamsExplicitly = false},
StreamManagerTestParam{.notifyOnNewStreamsExplicitly = true}));
StreamManagerTestParam{false},
StreamManagerTestParam{true}));
class QuicStreamManagerGroupsTest : public QuicStreamManagerTest {
public:
@@ -874,12 +874,8 @@ INSTANTIATE_TEST_SUITE_P(
QuicStreamManagerGroupsTest,
QuicStreamManagerGroupsTest,
::testing::Values(
StreamManagerTestParam{
.notifyOnNewStreamsExplicitly = true,
.isUnidirectional = false},
StreamManagerTestParam{
.notifyOnNewStreamsExplicitly = true,
.isUnidirectional = true}));
StreamManagerTestParam{true, false},
StreamManagerTestParam{true, true}));
} // namespace test
} // namespace quic