Skip to content

Commit 06b3fc7

Browse files
committed
add more tests, which all fail
1 parent 8434911 commit 06b3fc7

File tree

2 files changed

+73
-39
lines changed

2 files changed

+73
-39
lines changed

src/test/bin/winkernel/control.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1541,6 +1541,10 @@ QuicTestCtlEvtIoDeviceControl(
15411541
case IOCTL_QUIC_RUN_VALIDATE_PARTITION:
15421542
QuicTestCtlRun(QuicTestValidatePartition());
15431543
break;
1544+
1545+
case IOCTL_QUIC_RUN_VALIDATE_EXECUTION_CONTEXT:
1546+
QuicTestCtlRun(QuicTestValidateExecutionContext());
1547+
break;
15441548
#endif
15451549

15461550
case IOCTL_QUIC_RUN_TEST_KEY_UPDATE_DURING_HANDSHAKE:

src/test/lib/ApiTest.cpp

Lines changed: 69 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -6770,6 +6770,7 @@ TestCurThreadID()
67706770
}
67716771

67726772
struct TestPartitionListenerContext {
6773+
MsQuicConfiguration* ServerConfiguration;
67736774
MsQuicConnection** Server;
67746775
uint32_t ExpectedThreadId;
67756776
uint32_t ActualThreadId;
@@ -6799,6 +6800,7 @@ TestPartitionListenerCallback(
67996800
return QUIC_STATUS_SUCCESS;
68006801
},
68016802
Context);
6803+
(*Context->Server)->SetConfiguration(*Context->ServerConfiguration);
68026804
}
68036805

68046806
return QUIC_STATUS_SUCCESS;
@@ -6807,12 +6809,11 @@ TestPartitionListenerCallback(
68076809
void
68086810
QuicTestValidatePartition()
68096811
{
6810-
TestPartitionListenerContext ListenerContext{};
6811-
ListenerContext.ActualThreadId = ListenerContext.ExpectedThreadId = TestCurThreadID();
68126812
const uint32_t EcCount = 4;
68136813
TestEventQ Ecs[EcCount];
68146814
QUIC_EVENTQ* EventQs[EcCount];
6815-
const uint16_t PartitionIndex = (uint16_t)(1 % EcCount);
6815+
// const uint16_t PartitionIndex = (uint16_t)(1 % EcCount);
6816+
MsQuicAlpn Alpn("MsQuicTest");
68166817

68176818
for (uint32_t i = 0; i < EcCount; i++) {
68186819
auto &Ec = Ecs[i];
@@ -6823,54 +6824,83 @@ QuicTestValidatePartition()
68236824
MsQuicExecution Execution(EventQs, EcCount, QUIC_GLOBAL_EXECUTION_CONFIG_FLAG_NONE);
68246825
TEST_TRUE(Execution.IsValid());
68256826

6826-
MsQuicRegistration Registration;
6827-
TEST_TRUE(Registration.IsValid());
6827+
{
6828+
MsQuicRegistration Registration;
6829+
TEST_TRUE(Registration.IsValid());
68286830

6829-
UniquePtr<MsQuicConnection> Server;
6830-
ListenerContext.Server = (MsQuicConnection**)&Server;
6831+
MsQuicConfiguration ServerConfiguration(Registration, Alpn, ServerSelfSignedCredConfig);
6832+
TEST_TRUE(ServerConfiguration.IsValid());
68316833

6832-
MsQuicListener Listener(
6833-
Registration,
6834-
CleanUpManual,
6835-
TestPartitionListenerCallback,
6836-
&ListenerContext);
6837-
TEST_QUIC_SUCCEEDED(Listener.GetInitStatus());
6834+
UniquePtr<MsQuicConnection> Server;
6835+
TestPartitionListenerContext ListenerContext{};
6836+
ListenerContext.ActualThreadId = ListenerContext.ExpectedThreadId = TestCurThreadID();
6837+
ListenerContext.ServerConfiguration = &ServerConfiguration;
6838+
ListenerContext.Server = (MsQuicConnection**)&Server;
68386839

6839-
TEST_QUIC_SUCCEEDED(
6840-
Listener.SetParam(
6841-
QUIC_PARAM_LISTENER_PARTITION_INDEX, sizeof(PartitionIndex), &PartitionIndex));
6840+
MsQuicListener Listener(
6841+
Registration,
6842+
CleanUpManual,
6843+
TestPartitionListenerCallback,
6844+
&ListenerContext);
6845+
TEST_QUIC_SUCCEEDED(Listener.GetInitStatus());
68426846

6843-
TEST_QUIC_SUCCEEDED(Listener.Start("MsQuicTest"));
6847+
// TEST_QUIC_SUCCEEDED(
6848+
// Listener.SetParam(
6849+
// QUIC_PARAM_LISTENER_PARTITION_INDEX, sizeof(PartitionIndex), &PartitionIndex));
68446850

6845-
TEST_QUIC_SUCCEEDED(Listener.Start("MsQuicTest"));
6851+
TEST_QUIC_SUCCEEDED(Listener.Start(Alpn));
68466852

6847-
QuicAddr ServerLocalAddr;
6848-
TEST_QUIC_SUCCEEDED(Listener.GetLocalAddr(ServerLocalAddr));
6853+
QuicAddr ServerLocalAddr;
6854+
TEST_QUIC_SUCCEEDED(Listener.GetLocalAddr(ServerLocalAddr));
68496855

6850-
MsQuicCredentialConfig ClientCredConfig;
6851-
MsQuicConfiguration ClientConfiguration(Registration, "MsQuicTest", ClientCredConfig);
6852-
TEST_QUIC_SUCCEEDED(ClientConfiguration.GetInitStatus());
6856+
MsQuicCredentialConfig ClientCredConfig;
6857+
MsQuicConfiguration ClientConfiguration(Registration, Alpn, ClientCredConfig);
6858+
TEST_QUIC_SUCCEEDED(ClientConfiguration.GetInitStatus());
68536859

6854-
MsQuicConnection Connection(Registration, PartitionIndex);
6855-
TEST_QUIC_SUCCEEDED(Connection.GetInitStatus());
6856-
TEST_QUIC_SUCCEEDED(Connection.Start(ClientConfiguration, QUIC_ADDRESS_FAMILY_INET6, "localhost", ServerLocalAddr.GetPort()));
6860+
// MsQuicConnection Connection(Registration, PartitionIndex);
6861+
MsQuicConnection Connection(Registration);
6862+
TEST_QUIC_SUCCEEDED(Connection.GetInitStatus());
6863+
TEST_QUIC_SUCCEEDED(Connection.Start(
6864+
ClientConfiguration, ServerLocalAddr.GetFamily(),
6865+
QUIC_TEST_LOOPBACK_FOR_AF(ServerLocalAddr.GetFamily()), ServerLocalAddr.GetPort()));
68576866

6858-
//
6859-
// Allow this thread to poll only the specified partition; the rest of the
6860-
// partitions will be idle.
6861-
//
6862-
TEST_QUIC_SUCCEEDED(
6863-
TryUntil(1, TestWaitTimeout, [&](){
6864-
MsQuic->ExecutionPoll(Execution[PartitionIndex]);
6865-
if (Connection.HandshakeComplete && Server) {
6866-
return QUIC_STATUS_SUCCESS;
6867-
}
6868-
return QUIC_STATUS_CONTINUE;
6869-
})
6870-
);
6867+
//
6868+
// Allow this thread to poll only the specified partition; the rest of the
6869+
// partitions will be idle.
6870+
//
6871+
TEST_QUIC_SUCCEEDED(
6872+
TryUntil(1, TestWaitTimeout, [&](){
6873+
for (uint32_t i = 0; i < EcCount; i++) {
6874+
MsQuic->ExecutionPoll(Execution[i]);
6875+
QuicTestProcessEventQ(EventQs[i], 0);
6876+
}
6877+
// MsQuic->ExecutionPoll(Execution[PartitionIndex]);
6878+
if (Connection.HandshakeComplete && Server) {
6879+
return QUIC_STATUS_SUCCESS;
6880+
}
6881+
return QUIC_STATUS_CONTINUE;
6882+
})
6883+
);
68716884

68726885
TEST_TRUE(Server->IsValid());
68736886
TEST_EQUAL(ListenerContext.ExpectedThreadId, ListenerContext.ActualThreadId);
6887+
sleep(1);
6888+
TEST_TRUE(Server->IsValid());
6889+
TEST_EQUAL(ListenerContext.ExpectedThreadId, ListenerContext.ActualThreadId);
6890+
}
6891+
6892+
//
6893+
// Give the EC a chance to run all the cleanup needed for MsQuic objects
6894+
// before its implicit destruction.
6895+
//
6896+
TryUntil(1, TestWaitTimeout, [&](){
6897+
for (uint32_t i = 0; i < EcCount; i++) {
6898+
MsQuic->ExecutionPoll(Execution[i]);
6899+
QuicTestProcessEventQ(EventQs[i], 0);
6900+
}
6901+
// MsQuic->ExecutionPoll(Execution[PartitionIndex]);
6902+
return QUIC_STATUS_CONTINUE;
6903+
});
68746904
}
68756905

68766906
#endif // defined(__linux__) && !defined(QUIC_LINUX_IOURING_ENABLED) && !defined(QUIC_LINUX_XDP_ENABLED)

0 commit comments

Comments
 (0)