Skip to content

Commit

Permalink
Fix QTIP tests in release branch (#3574)
Browse files Browse the repository at this point in the history
Test code references the flag UseQTIP defined in quic_gtest.cpp unconditionally for RAW datapath. However, the definition of UseQTIP is gated behind QUIC_API_ENABLE_PREVIEW_FEATURES.

This PR gates all references behind the same macro, QUIC_API_ENABLE_PREVIEW_FEATURES and QUIC_USE_RAW_DATAPATH.
  • Loading branch information
csujedihy authored and nibanks committed Apr 19, 2023
1 parent a029d2b commit 1903eac
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 20 deletions.
20 changes: 10 additions & 10 deletions src/test/bin/quic_gtest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
bool TestingKernelMode = false;
bool PrivateTestLibrary = false;
bool UseDuoNic = false;
#ifdef QUIC_API_ENABLE_PREVIEW_FEATURES
#if defined(QUIC_USE_RAW_DATAPATH) && defined(QUIC_API_ENABLE_PREVIEW_FEATURES)
bool UseQTIP = false;
#endif
const MsQuicApi* MsQuic;
Expand Down Expand Up @@ -81,7 +81,7 @@ class QuicTestEnvironment : public ::testing::Environment {
printf("Initializing for User Mode tests\n");
MsQuic = new(std::nothrow) MsQuicApi();
ASSERT_TRUE(QUIC_SUCCEEDED(MsQuic->GetInitStatus()));
#ifdef QUIC_API_ENABLE_PREVIEW_FEATURES
#if defined(QUIC_USE_RAW_DATAPATH) && defined(QUIC_API_ENABLE_PREVIEW_FEATURES)
if (UseQTIP) {
QUIC_EXECUTION_CONFIG Config = {QUIC_EXECUTION_CONFIG_FLAG_QTIP, 10000, 0};
ASSERT_TRUE(QUIC_SUCCEEDED(
Expand All @@ -91,7 +91,7 @@ class QuicTestEnvironment : public ::testing::Environment {
sizeof(Config),
&Config)));
}
#endif // QUIC_API_ENABLE_PREVIEW_FEATURES
#endif
memcpy(&ServerSelfSignedCredConfig, SelfSignedCertParams, sizeof(QUIC_CREDENTIAL_CONFIG));
memcpy(&ServerSelfSignedCredConfigClientAuth, SelfSignedCertParams, sizeof(QUIC_CREDENTIAL_CONFIG));
ServerSelfSignedCredConfigClientAuth.Flags |=
Expand Down Expand Up @@ -1458,7 +1458,7 @@ TEST_P(WithFamilyArgs, ClientBlockedSourcePort) {

#if QUIC_TEST_DATAPATH_HOOKS_ENABLED
TEST_P(WithFamilyArgs, RebindPort) {
#ifdef QUIC_API_ENABLE_PREVIEW_FEATURES
#if defined(QUIC_USE_RAW_DATAPATH) && defined(QUIC_API_ENABLE_PREVIEW_FEATURES)
if (UseQTIP) {
//
// NAT rebind doesn't make sense for TCP and QTIP.
Expand All @@ -1479,7 +1479,7 @@ TEST_P(WithFamilyArgs, RebindPort) {
}

TEST_P(WithRebindPaddingArgs, RebindPortPadded) {
#ifdef QUIC_API_ENABLE_PREVIEW_FEATURES
#if defined(QUIC_USE_RAW_DATAPATH) && defined(QUIC_API_ENABLE_PREVIEW_FEATURES)
if (UseQTIP) {
//
// NAT rebind doesn't make sense for TCP and QTIP.
Expand All @@ -1500,7 +1500,7 @@ TEST_P(WithRebindPaddingArgs, RebindPortPadded) {
}

TEST_P(WithFamilyArgs, RebindAddr) {
#ifdef QUIC_API_ENABLE_PREVIEW_FEATURES
#if defined(QUIC_USE_RAW_DATAPATH) && defined(QUIC_API_ENABLE_PREVIEW_FEATURES)
if (UseQTIP) {
//
// NAT rebind doesn't make sense for TCP and QTIP.
Expand All @@ -1521,7 +1521,7 @@ TEST_P(WithFamilyArgs, RebindAddr) {
}

TEST_P(WithRebindPaddingArgs, RebindAddrPadded) {
#ifdef QUIC_API_ENABLE_PREVIEW_FEATURES
#if defined(QUIC_USE_RAW_DATAPATH) && defined(QUIC_API_ENABLE_PREVIEW_FEATURES)
if (UseQTIP) {
//
// NAT rebind doesn't make sense for TCP and QTIP.
Expand Down Expand Up @@ -1705,7 +1705,7 @@ TEST_P(WithSendArgs3, SendIntermittently) {
#ifndef QUIC_DISABLE_0RTT_TESTS

TEST_P(WithSend0RttArgs1, Send0Rtt) {
#ifdef QUIC_API_ENABLE_PREVIEW_FEATURES
#if defined(QUIC_USE_RAW_DATAPATH) && defined(QUIC_API_ENABLE_PREVIEW_FEATURES)
if (UseQTIP) {
//
// QTIP doesn't work with 0-RTT. QTIP only pauses and caches 1 packet during
Expand Down Expand Up @@ -1754,7 +1754,7 @@ TEST_P(WithSend0RttArgs1, Send0Rtt) {
}

TEST_P(WithSend0RttArgs2, Reject0Rtt) {
#ifdef QUIC_API_ENABLE_PREVIEW_FEATURES
#if defined(QUIC_USE_RAW_DATAPATH) && defined(QUIC_API_ENABLE_PREVIEW_FEATURES)
if (UseQTIP) {
//
// QTIP doesn't work with 0-RTT. QTIP only pauses and caches 1 packet during
Expand Down Expand Up @@ -2375,7 +2375,7 @@ int main(int argc, char** argv) {
} else if (strcmp("--duoNic", argv[i]) == 0) {
UseDuoNic = true;
} else if (strcmp("--useQTIP", argv[i]) == 0) {
#ifdef QUIC_API_ENABLE_PREVIEW_FEATURES
#if defined(QUIC_USE_RAW_DATAPATH) && defined(QUIC_API_ENABLE_PREVIEW_FEATURES)
UseQTIP = true;
#else
printf("QTIP is not supported in this build.\n");
Expand Down
4 changes: 2 additions & 2 deletions src/test/bin/quic_gtest.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#endif

extern bool TestingKernelMode;
#ifdef QUIC_API_ENABLE_PREVIEW_FEATURES
#if defined(QUIC_USE_RAW_DATAPATH) && defined(QUIC_API_ENABLE_PREVIEW_FEATURES)
extern bool UseQTIP;
#endif

Expand Down Expand Up @@ -346,7 +346,7 @@ struct SendArgs2 {
for (bool UseZeroRtt : { false })
#endif
{
#ifdef QUIC_API_ENABLE_PREVIEW_FEATURES
#if defined(QUIC_USE_RAW_DATAPATH) && defined(QUIC_API_ENABLE_PREVIEW_FEATURES)
if (UseQTIP && UseZeroRtt) {
continue;
}
Expand Down
5 changes: 2 additions & 3 deletions src/test/lib/ApiTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

#pragma warning(disable:6387) // '_Param_(1)' could be '0': this does not adhere to the specification for the function

#ifdef QUIC_USE_RAW_DATAPATH
#if defined(QUIC_USE_RAW_DATAPATH) && defined(QUIC_API_ENABLE_PREVIEW_FEATURES)
extern bool UseQTIP;
#endif

Expand Down Expand Up @@ -2530,7 +2530,6 @@ void QuicTestGlobalParam()
//
SimpleGetParamTest(nullptr, QUIC_PARAM_GLOBAL_EXECUTION_CONFIG, DataLength, Data);
}

#ifdef QUIC_USE_RAW_DATAPATH
if (!UseQTIP) {
//
Expand All @@ -2555,7 +2554,7 @@ void QuicTestGlobalParam()
QUIC_PARAM_GLOBAL_EXECUTION_CONFIG,
&BufferLength,
nullptr));
#endif
#endif // QUIC_USE_RAW_DATAPATH
}
#endif

Expand Down
6 changes: 3 additions & 3 deletions src/test/lib/DataTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include "DataTest.cpp.clog.h"
#endif

#ifdef QUIC_USE_RAW_DATAPATH
#if defined(QUIC_USE_RAW_DATAPATH) && defined(QUIC_API_ENABLE_PREVIEW_FEATURES)
extern bool UseQTIP;
#endif

Expand Down Expand Up @@ -505,7 +505,7 @@ QuicTestConnectAndPing(
}
TEST_QUIC_SUCCEEDED(Connections.get()[i]->SetRemoteAddr(RemoteAddr));

#ifdef QUIC_USE_RAW_DATAPATH
#if defined(QUIC_USE_RAW_DATAPATH) && defined(QUIC_API_ENABLE_PREVIEW_FEATURES)
if (!UseQTIP && i != 0) {
Connections.get()[i]->SetLocalAddr(LocalAddr);
}
Expand All @@ -520,7 +520,7 @@ QuicTestConnectAndPing(
QuicAddrFamily,
ClientZeroRtt ? QUIC_LOCALHOST_FOR_AF(QuicAddrFamily) : nullptr,
ServerLocalAddr.GetPort()));
#ifdef QUIC_USE_RAW_DATAPATH
#if defined(QUIC_USE_RAW_DATAPATH) && defined(QUIC_API_ENABLE_PREVIEW_FEATURES)
if (!UseQTIP && i == 0) {
Connections.get()[i]->GetLocalAddr(LocalAddr);
}
Expand Down
4 changes: 2 additions & 2 deletions src/test/lib/MtuTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ struct ResetSettings {
void
QuicTestMtuSettings()
{
#ifdef QUIC_USE_RAW_DATAPATH
#if defined(QUIC_USE_RAW_DATAPATH) && defined(QUIC_API_ENABLE_PREVIEW_FEATURES)
const uint16_t DefaultMaximumMtu = UseQTIP ? 1488 : 1500; // reserve 12B for TCP header
#else
const uint16_t DefaultMaximumMtu = 1500;
Expand Down Expand Up @@ -315,7 +315,7 @@ QuicTestMtuDiscovery(
TEST_QUIC_SUCCEEDED(Registration.GetInitStatus());

const uint16_t MinimumMtu = RaiseMinimumMtu ? 1360 : 1248;
#ifdef QUIC_USE_RAW_DATAPATH
#if defined(QUIC_USE_RAW_DATAPATH) && defined(QUIC_API_ENABLE_PREVIEW_FEATURES)
const uint16_t MaximumMtu = UseQTIP ? 1488 : 1500; // reserve 12B for TCP header
#else
const uint16_t MaximumMtu = 1500;
Expand Down

0 comments on commit 1903eac

Please sign in to comment.