Skip to content

Commit

Permalink
Light up Windows Kernel + DuoNic testing (#3991)
Browse files Browse the repository at this point in the history
  • Loading branch information
nigriMSFT committed Dec 7, 2023
1 parent ba4d9ed commit d40e8bc
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 8 deletions.
2 changes: 1 addition & 1 deletion scripts/run-gtest.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ param (
[switch]$BreakOnFailure = $false,

[Parameter(Mandatory = $false)]
[ValidateSet("None", "Basic.Light", "Basic.Verbose", "Full.Light", "Full.Verbose")]
[ValidateSet("None", "Basic.Light", "Datapath.Light", "Datapath.Verbose", "Stacks.Light", "Stacks.Verbose", "RPS.Light", "RPS.Verbose", "Performance.Light", "Basic.Verbose", "Performance.Light", "Performance.Verbose", "Full.Light", "Full.Verbose", "SpinQuic.Light", "SpinQuicWarnings.Light")]
[string]$LogProfile = "None",

[Parameter(Mandatory = $false)]
Expand Down
2 changes: 1 addition & 1 deletion scripts/test.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ param (
[switch]$BreakOnFailure = $false,

[Parameter(Mandatory = $false)]
[ValidateSet("None", "Basic.Light", "Basic.Verbose", "Full.Light", "Full.Verbose")]
[ValidateSet("None", "Basic.Light", "Datapath.Light", "Datapath.Verbose", "Stacks.Light", "Stacks.Verbose", "RPS.Light", "RPS.Verbose", "Performance.Light", "Basic.Verbose", "Performance.Light", "Performance.Verbose", "Full.Light", "Full.Verbose", "SpinQuic.Light", "SpinQuicWarnings.Light")]
[string]$LogProfile = "None",

[Parameter(Mandatory = $false)]
Expand Down
7 changes: 7 additions & 0 deletions src/test/MsQuicTests.h
Original file line number Diff line number Diff line change
Expand Up @@ -671,6 +671,13 @@ static const GUID QUIC_TEST_DEVICE_INSTANCE =
// IOCTL Interface
//

typedef struct {
BOOLEAN UseDuoNic;
} QUIC_TEST_CONFIGURATION_PARAMS;

#define IOCTL_QUIC_TEST_CONFIGURATION \
QUIC_CTL_CODE(0, METHOD_BUFFERED, FILE_WRITE_DATA)

typedef struct {
QUIC_CERTIFICATE_HASH ServerCertHash;
QUIC_CERTIFICATE_HASH ClientCertHash;
Expand Down
12 changes: 9 additions & 3 deletions src/test/bin/quic_gtest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,12 @@ class QuicTestEnvironment : public ::testing::Environment {
ASSERT_TRUE(DriverService.Initialize(DriverName, DependentDriverNames));
ASSERT_TRUE(DriverService.Start());
ASSERT_TRUE(DriverClient.Initialize(&CertParams, DriverName));

QUIC_TEST_CONFIGURATION_PARAMS Params {
UseDuoNic,
};
ASSERT_TRUE(DriverClient.Run(IOCTL_QUIC_TEST_CONFIGURATION, Params));

} else {
printf("Initializing for User Mode tests\n");
MsQuic = new(std::nothrow) MsQuicApi();
Expand Down Expand Up @@ -849,12 +855,12 @@ TEST_P(WithFamilyArgs, ClientSharedLocalPort) {

TEST_P(WithFamilyArgs, InterfaceBinding) {
TestLoggerT<ParamType> Logger("QuicTestInterfaceBinding", GetParam());
if (UseDuoNic) {
GTEST_SKIP_("DuoNIC is not supported");
}
if (TestingKernelMode) {
ASSERT_TRUE(DriverClient.Run(IOCTL_QUIC_RUN_INTERFACE_BINDING, GetParam().Family));
} else {
if (UseDuoNic) {
GTEST_SKIP_("DuoNIC is not supported");
}
QuicTestInterfaceBinding(GetParam().Family);
}
}
Expand Down
12 changes: 9 additions & 3 deletions src/test/bin/winkernel/control.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ QuicTestCtlEvtIoCanceled(

size_t QUIC_IOCTL_BUFFER_SIZES[] =
{
0,
sizeof(QUIC_TEST_CONFIGURATION_PARAMS),
sizeof(QUIC_RUN_CERTIFICATE_PARAMS),
0,
0,
Expand Down Expand Up @@ -633,9 +633,10 @@ size_t QUIC_IOCTL_BUFFER_SIZES[] =

CXPLAT_STATIC_ASSERT(
QUIC_MAX_IOCTL_FUNC_CODE + 1 == (sizeof(QUIC_IOCTL_BUFFER_SIZES)/sizeof(size_t)),
"QUIC_IOCTL_BUFFER_SIZES must be kept in sync with the IOTCLs");
"QUIC_IOCTL_BUFFER_SIZES must be kept in sync with the IOCTLs");

typedef union {
QUIC_TEST_CONFIGURATION_PARAMS TestConfigurationParams;
QUIC_RUN_CERTIFICATE_PARAMS CertParams;
QUIC_CERTIFICATE_HASH_STORE CertHashStore;
UINT8 Connect;
Expand Down Expand Up @@ -716,7 +717,7 @@ QuicTestCtlEvtIoDeviceControl(
}

ULONG FunctionCode = IoGetFunctionCodeFromCtlCode(IoControlCode);
if (FunctionCode == 0 || FunctionCode > QUIC_MAX_IOCTL_FUNC_CODE) {
if (FunctionCode > QUIC_MAX_IOCTL_FUNC_CODE) {
Status = STATUS_NOT_IMPLEMENTED;
QuicTraceEvent(
LibraryErrorStatus,
Expand Down Expand Up @@ -779,6 +780,11 @@ QuicTestCtlEvtIoDeviceControl(

switch (IoControlCode) {

case IOCTL_QUIC_TEST_CONFIGURATION:
CXPLAT_FRE_ASSERT(Params != nullptr);
UseDuoNic = Params->TestConfigurationParams.UseDuoNic;
break;

case IOCTL_QUIC_SET_CERT_PARAMS:
CXPLAT_FRE_ASSERT(Params != nullptr);
ServerSelfSignedCredConfig.Type = QUIC_CREDENTIAL_TYPE_CERTIFICATE_HASH;
Expand Down

0 comments on commit d40e8bc

Please sign in to comment.