Skip to content

Commit

Permalink
More Loss and BBR Tests (microsoft#3808)
Browse files Browse the repository at this point in the history
  • Loading branch information
nibanks authored Aug 12, 2023
1 parent c6736ef commit 46b7512
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 10 deletions.
10 changes: 8 additions & 2 deletions src/test/MsQuicTests.h
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,8 @@ QuicTestChangeAlpn(

void
QuicTestHandshakeSpecificLossPatterns(
_In_ int Family
_In_ int Family,
_In_ QUIC_CONGESTION_CONTROL_ALGORITHM CcAlgo
);

//
Expand Down Expand Up @@ -1181,9 +1182,14 @@ typedef struct {
#define IOCTL_QUIC_RUN_ECN \
QUIC_CTL_CODE(108, METHOD_BUFFERED, FILE_WRITE_DATA)

typedef struct {
int Family;
QUIC_CONGESTION_CONTROL_ALGORITHM CcAlgo;
} QUIC_HANDSHAKE_LOSS_PARAMS;

#define IOCTL_QUIC_RUN_HANDSHAKE_SPECIFIC_LOSS_PATTERNS \
QUIC_CTL_CODE(109, METHOD_BUFFERED, FILE_WRITE_DATA)
// int - Family
// QUIC_HANDSHAKE_LOSS_PARAMS

#define IOCTL_QUIC_RUN_CUSTOM_CLIENT_CERT_VALIDATION \
QUIC_CTL_CODE(110, METHOD_BUFFERED, FILE_WRITE_DATA)
Expand Down
17 changes: 14 additions & 3 deletions src/test/bin/quic_gtest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1594,12 +1594,16 @@ TEST_P(WithFamilyArgs, LoadBalanced) {
}
}

TEST_P(WithFamilyArgs, HandshakeSpecificLossPatterns) {
TEST_P(WithHandshakeArgs10, HandshakeSpecificLossPatterns) {
TestLoggerT<ParamType> Logger("QuicTestHandshakeSpecificLossPatterns", GetParam());
if (TestingKernelMode) {
ASSERT_TRUE(DriverClient.Run(IOCTL_QUIC_RUN_HANDSHAKE_SPECIFIC_LOSS_PATTERNS, GetParam().Family));
QUIC_HANDSHAKE_LOSS_PARAMS Params = {
GetParam().Family,
GetParam().CcAlgo
};
ASSERT_TRUE(DriverClient.Run(IOCTL_QUIC_RUN_HANDSHAKE_SPECIFIC_LOSS_PATTERNS, Params));
} else {
QuicTestHandshakeSpecificLossPatterns(GetParam().Family);
QuicTestHandshakeSpecificLossPatterns(GetParam().Family, GetParam().CcAlgo);
}
}
#endif // QUIC_TEST_DATAPATH_HOOKS_ENABLED
Expand Down Expand Up @@ -2293,6 +2297,13 @@ INSTANTIATE_TEST_SUITE_P(
#endif
#endif

#if QUIC_TEST_DATAPATH_HOOKS_ENABLED
INSTANTIATE_TEST_SUITE_P(
Handshake,
WithHandshakeArgs10,
testing::ValuesIn(HandshakeArgs10::Generate()));
#endif

INSTANTIATE_TEST_SUITE_P(
AppData,
WithSendArgs1,
Expand Down
26 changes: 26 additions & 0 deletions src/test/bin/quic_gtest.h
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,32 @@ class WithHandshakeArgs9 : public testing::Test,
public testing::WithParamInterface<bool> {
};

struct HandshakeArgs10 {
int Family;
QUIC_CONGESTION_CONTROL_ALGORITHM CcAlgo;
static ::std::vector<HandshakeArgs10> Generate() {
::std::vector<HandshakeArgs10> list;
for (int Family : { 4, 6 })
#ifdef QUIC_API_ENABLE_PREVIEW_FEATURES
for (auto CcAlgo : { QUIC_CONGESTION_CONTROL_ALGORITHM_CUBIC, QUIC_CONGESTION_CONTROL_ALGORITHM_BBR })
#else
for (auto CcAlgo : { QUIC_CONGESTION_CONTROL_ALGORITHM_CUBIC })
#endif
list.push_back({ Family, CcAlgo });
return list;
}
};

std::ostream& operator << (std::ostream& o, const HandshakeArgs10& args) {
return o <<
(args.Family == 4 ? "v4" : "v6") << "/" <<
(args.CcAlgo == QUIC_CONGESTION_CONTROL_ALGORITHM_CUBIC ? "cubic" : "bbr");
}

class WithHandshakeArgs10 : public testing::Test,
public testing::WithParamInterface<HandshakeArgs10> {
};

struct ReliableResetArgs {
int Family;
bool ServerSupport;
Expand Down
8 changes: 6 additions & 2 deletions src/test/bin/winkernel/control.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ size_t QUIC_IOCTL_BUFFER_SIZES[] =
sizeof(UINT8),
sizeof(BOOLEAN),
sizeof(INT32),
sizeof(INT32),
sizeof(QUIC_HANDSHAKE_LOSS_PARAMS),
sizeof(QUIC_RUN_CUSTOM_CERT_VALIDATION),
sizeof(QUIC_RUN_RELIABLE_RESET_NEGOTIATION)
};
Expand Down Expand Up @@ -519,6 +519,7 @@ typedef union {
UINT8 TestServerVNTP;
BOOLEAN Bidirectional;
QUIC_RUN_RELIABLE_RESET_NEGOTIATION ReliableResetNegotiationParams;
QUIC_HANDSHAKE_LOSS_PARAMS HandshakeLossParams;
} QUIC_IOCTL_PARAMS;

#define QuicTestCtlRun(X) \
Expand Down Expand Up @@ -1329,7 +1330,10 @@ QuicTestCtlEvtIoDeviceControl(

case IOCTL_QUIC_RUN_HANDSHAKE_SPECIFIC_LOSS_PATTERNS:
CXPLAT_FRE_ASSERT(Params != nullptr);
QuicTestCtlRun(QuicTestHandshakeSpecificLossPatterns(Params->Family));
QuicTestCtlRun(
QuicTestHandshakeSpecificLossPatterns(
Params->HandshakeLossParams.Family,
Params->HandshakeLossParams.CcAlgo));
break;

case IOCTL_QUIC_RUN_CUSTOM_CLIENT_CERT_VALIDATION:
Expand Down
8 changes: 6 additions & 2 deletions src/test/lib/HandshakeTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3762,14 +3762,18 @@ QuicTestVNTPOtherVersionZero(

void
QuicTestHandshakeSpecificLossPatterns(
_In_ int Family
_In_ int Family,
_In_ QUIC_CONGESTION_CONTROL_ALGORITHM CcAlgo
)
{
MsQuicRegistration Registration;
TEST_QUIC_SUCCEEDED(Registration.GetInitStatus());

MsQuicSettings Settings;
Settings.SetIdleTimeoutMs(60000).SetDisconnectTimeoutMs(60000).SetInitialRttMs(20);
Settings.SetIdleTimeoutMs(60000)
.SetDisconnectTimeoutMs(60000)
.SetInitialRttMs(20)
.SetCongestionControlAlgorithm(CcAlgo);

MsQuicConfiguration ServerConfiguration(Registration, "MsQuicTest", Settings, ServerSelfSignedCredConfig);
TEST_QUIC_SUCCEEDED(ServerConfiguration.GetInitStatus());
Expand Down
2 changes: 1 addition & 1 deletion src/tools/spin/spinquic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1530,7 +1530,7 @@ main(int argc, char **argv)
SpinSettings.AlpnPrefix = "spin";
SpinSettings.MaxOperationCount = UINT64_MAX;
SpinSettings.MaxFuzzIterationCount = UINT64_MAX;
SpinSettings.LossPercent = 1;
SpinSettings.LossPercent = 5;
SpinSettings.AllocFailDenominator = 0;
SpinSettings.RepeatCount = 1;

Expand Down

0 comments on commit 46b7512

Please sign in to comment.