From df45d597211b037d305ed47192b99f5b470d4360 Mon Sep 17 00:00:00 2001 From: ManickaP Date: Thu, 13 Apr 2023 19:10:22 +0200 Subject: [PATCH 01/11] Implement the same hack as for functional tests to prevent msquic from dropping connections --- .../StressTests/HttpStress/HttpStress.csproj | 11 ++++++ .../tests/StressTests/HttpStress/Program.cs | 20 ++++++++++- .../HttpStress/System.Net.Quic.Stub.cs | 34 +++++++++++++++++++ 3 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 src/libraries/System.Net.Http/tests/StressTests/HttpStress/System.Net.Quic.Stub.cs diff --git a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/HttpStress.csproj b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/HttpStress.csproj index bb71d66d214c2..fcf8a31177fc4 100644 --- a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/HttpStress.csproj +++ b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/HttpStress.csproj @@ -4,8 +4,19 @@ $(NetCoreAppCurrent) enable True + CA2252 + true + + + + + + + + + diff --git a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Program.cs b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Program.cs index a1a2769273591..46d6efa08f55e 100644 --- a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Program.cs +++ b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Program.cs @@ -13,6 +13,8 @@ using System.Threading.Tasks; using System.Net; using HttpStress; +using System.Net.Quic; +using Microsoft.Quic; [assembly:SupportedOSPlatform("windows")] [assembly:SupportedOSPlatform("linux")] @@ -26,6 +28,8 @@ public static class Program { public enum ExitCode { Success = 0, StressError = 1, CliError = 2 }; + public static readonly bool IsQuicSupported = QuicListener.IsSupported && QuicConnection.IsSupported; + public static async Task Main(string[] args) { if (!TryParseCli(args, out Configuration? config)) @@ -169,6 +173,8 @@ private static async Task Run(Configuration config) Console.WriteLine(" Concurrency: " + config.ConcurrentRequests); Console.WriteLine(" Content Length: " + config.MaxContentLength); Console.WriteLine(" HTTP Version: " + config.HttpVersion); + Console.WriteLine(" QUIC supported: " + (IsQuicSupported ? "yes" : "no")); + Console.WriteLine(" MsQuic Version: " + MsQuicApi.MsQuicLibraryVersion); Console.WriteLine(" Lifetime: " + (config.ConnectionLifetime.HasValue ? $"{config.ConnectionLifetime.Value.TotalMilliseconds}ms" : "(infinite)")); Console.WriteLine(" Operations: " + string.Join(", ", usedClientOperations.Select(o => o.name))); Console.WriteLine(" Random Seed: " + config.RandomSeed); @@ -176,7 +182,19 @@ private static async Task Run(Configuration config) Console.WriteLine("Max Content Size: " + config.MaxContentLength); Console.WriteLine("Query Parameters: " + config.MaxParameters); Console.WriteLine(); - + if (config.HttpVersion == HttpVersion.Version30 && IsQuicSupported) + { + unsafe + { + QUIC_SETTINGS settings = default(QUIC_SETTINGS); + settings.IsSet.MaxWorkerQueueDelayUs = 1; + settings.MaxWorkerQueueDelayUs = 2_500_000u; // 2.5s, 10x the default + if (MsQuic.StatusFailed(MsQuicApi.Api.ApiTable->SetParam(null, MsQuic.QUIC_PARAM_GLOBAL_SETTINGS, (uint)sizeof(QUIC_SETTINGS), (byte*)&settings))) + { + Console.WriteLine($"Unable to set MsQuic MaxWorkerQueueDelayUs."); + } + } + } StressServer? server = null; if (config.RunMode.HasFlag(RunMode.server)) diff --git a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/System.Net.Quic.Stub.cs b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/System.Net.Quic.Stub.cs new file mode 100644 index 0000000000000..6e7d68f07023a --- /dev/null +++ b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/System.Net.Quic.Stub.cs @@ -0,0 +1,34 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using static Microsoft.Quic.MsQuic; + +namespace System.Net.Quic; + +internal static class ThrowHelper +{ + internal static Exception GetExceptionForMsQuicStatus(int status, string? message = null) + => new QuicException(QuicError.InternalError, null, $"{message} (0x{status:x})"); + + internal static void ThrowIfMsQuicError(int status, string? message = null) + { + if (StatusFailed(status)) + { + throw GetExceptionForMsQuicStatus(status, message); + } + } +} + +internal static partial class Interop +{ + internal static partial class Libraries + { +#if WINDOWS + internal const string MsQuic = "msquic.dll"; +#elif OSX + internal const string MsQuic = "libmsquic.dylib"; +#else + internal const string MsQuic = "libmsquic.so"; +#endif + } +} From df7b54153667a137fa407754142c2788dbbe4ae0 Mon Sep 17 00:00:00 2001 From: ManickaP Date: Fri, 14 Apr 2023 11:10:51 +0200 Subject: [PATCH 02/11] Feedback: removed code sharing and used reflaction --- .../StressTests/HttpStress/HttpStress.csproj | 9 ----- .../tests/StressTests/HttpStress/Program.cs | 20 ++++------- .../HttpStress/System.Net.Quic.Stub.cs | 34 ------------------- .../src/System/Net/Quic/Internal/MsQuicApi.cs | 16 +++++++++ .../FunctionalTests/QuicListenerTests.cs | 4 +-- .../tests/FunctionalTests/QuicTestBase.cs | 18 ++++------ .../System.Net.Quic.Functional.Tests.csproj | 11 ------ 7 files changed, 32 insertions(+), 80 deletions(-) delete mode 100644 src/libraries/System.Net.Http/tests/StressTests/HttpStress/System.Net.Quic.Stub.cs diff --git a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/HttpStress.csproj b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/HttpStress.csproj index fcf8a31177fc4..984ce233dc029 100644 --- a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/HttpStress.csproj +++ b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/HttpStress.csproj @@ -8,15 +8,6 @@ true - - - - - - - - - diff --git a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Program.cs b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Program.cs index 46d6efa08f55e..15f9d956d0555 100644 --- a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Program.cs +++ b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Program.cs @@ -14,7 +14,6 @@ using System.Net; using HttpStress; using System.Net.Quic; -using Microsoft.Quic; [assembly:SupportedOSPlatform("windows")] [assembly:SupportedOSPlatform("linux")] @@ -162,6 +161,10 @@ private static async Task Run(Configuration config) string GetAssemblyInfo(Assembly assembly) => $"{assembly.Location}, modified {new FileInfo(assembly.Location).LastWriteTime}"; + + Type msQuicApi = typeof(QuicConnection).Assembly.GetType("System.Net.Quic.MsQuicApi")!; + (bool maxQueueWorkDelaySet, string msQuicLibraryVersion) = ((bool, string))msQuicApi.GetMethod("SetUpForTests", BindingFlags.NonPublic | BindingFlags.Static)!.Invoke(null, Array.Empty())!; + Console.WriteLine(" .NET Core: " + GetAssemblyInfo(typeof(object).Assembly)); Console.WriteLine(" ASP.NET Core: " + GetAssemblyInfo(typeof(WebHost).Assembly)); Console.WriteLine(" System.Net.Http: " + GetAssemblyInfo(typeof(System.Net.Http.HttpClient).Assembly)); @@ -174,7 +177,7 @@ private static async Task Run(Configuration config) Console.WriteLine(" Content Length: " + config.MaxContentLength); Console.WriteLine(" HTTP Version: " + config.HttpVersion); Console.WriteLine(" QUIC supported: " + (IsQuicSupported ? "yes" : "no")); - Console.WriteLine(" MsQuic Version: " + MsQuicApi.MsQuicLibraryVersion); + Console.WriteLine(" MsQuic Version: " + msQuicLibraryVersion); Console.WriteLine(" Lifetime: " + (config.ConnectionLifetime.HasValue ? $"{config.ConnectionLifetime.Value.TotalMilliseconds}ms" : "(infinite)")); Console.WriteLine(" Operations: " + string.Join(", ", usedClientOperations.Select(o => o.name))); Console.WriteLine(" Random Seed: " + config.RandomSeed); @@ -182,18 +185,9 @@ private static async Task Run(Configuration config) Console.WriteLine("Max Content Size: " + config.MaxContentLength); Console.WriteLine("Query Parameters: " + config.MaxParameters); Console.WriteLine(); - if (config.HttpVersion == HttpVersion.Version30 && IsQuicSupported) + if (config.HttpVersion == HttpVersion.Version30 && IsQuicSupported && !maxQueueWorkDelaySet) { - unsafe - { - QUIC_SETTINGS settings = default(QUIC_SETTINGS); - settings.IsSet.MaxWorkerQueueDelayUs = 1; - settings.MaxWorkerQueueDelayUs = 2_500_000u; // 2.5s, 10x the default - if (MsQuic.StatusFailed(MsQuicApi.Api.ApiTable->SetParam(null, MsQuic.QUIC_PARAM_GLOBAL_SETTINGS, (uint)sizeof(QUIC_SETTINGS), (byte*)&settings))) - { - Console.WriteLine($"Unable to set MsQuic MaxWorkerQueueDelayUs."); - } - } + Console.WriteLine($"Unable to set MsQuic MaxWorkerQueueDelayUs."); } StressServer? server = null; diff --git a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/System.Net.Quic.Stub.cs b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/System.Net.Quic.Stub.cs deleted file mode 100644 index 6e7d68f07023a..0000000000000 --- a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/System.Net.Quic.Stub.cs +++ /dev/null @@ -1,34 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using static Microsoft.Quic.MsQuic; - -namespace System.Net.Quic; - -internal static class ThrowHelper -{ - internal static Exception GetExceptionForMsQuicStatus(int status, string? message = null) - => new QuicException(QuicError.InternalError, null, $"{message} (0x{status:x})"); - - internal static void ThrowIfMsQuicError(int status, string? message = null) - { - if (StatusFailed(status)) - { - throw GetExceptionForMsQuicStatus(status, message); - } - } -} - -internal static partial class Interop -{ - internal static partial class Libraries - { -#if WINDOWS - internal const string MsQuic = "msquic.dll"; -#elif OSX - internal const string MsQuic = "libmsquic.dylib"; -#else - internal const string MsQuic = "libmsquic.so"; -#endif - } -} diff --git a/src/libraries/System.Net.Quic/src/System/Net/Quic/Internal/MsQuicApi.cs b/src/libraries/System.Net.Quic/src/System/Net/Quic/Internal/MsQuicApi.cs index 1923a18e841f3..46cb947c172a6 100644 --- a/src/libraries/System.Net.Quic/src/System/Net/Quic/Internal/MsQuicApi.cs +++ b/src/libraries/System.Net.Quic/src/System/Net/Quic/Internal/MsQuicApi.cs @@ -31,6 +31,7 @@ internal sealed unsafe partial class MsQuicApi // Remove once fixed: https://github.com/mono/linker/issues/1660 [DynamicDependency(DynamicallyAccessedMemberTypes.PublicConstructors, typeof(MsQuicSafeHandle))] [DynamicDependency(DynamicallyAccessedMemberTypes.PublicConstructors, typeof(MsQuicContextSafeHandle))] + [DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(MsQuicApi))] private MsQuicApi(QUIC_API_TABLE* apiTable) { ApiTable = apiTable; @@ -227,4 +228,19 @@ private static bool IsTls13Disabled(bool isServer) #endif return false; } + + // Do not change the name and signature without looking for textual occurrences! + // This method is invoked via reflection from QUIC functional and HTTP stress tests. + private static (bool, string) SetUpForTests() + { + if (!IsQuicSupported) + { + return (true, MsQuicLibraryVersion); + } + + QUIC_SETTINGS settings = default(QUIC_SETTINGS); + settings.IsSet.MaxWorkerQueueDelayUs = 1; + settings.MaxWorkerQueueDelayUs = 2_500_000u; // 2.5s, 10x the default + return (StatusSucceeded(MsQuicApi.Api.ApiTable->SetParam(null, QUIC_PARAM_GLOBAL_SETTINGS, (uint)sizeof(QUIC_SETTINGS), (byte*)&settings)), MsQuicLibraryVersion); + } } diff --git a/src/libraries/System.Net.Quic/tests/FunctionalTests/QuicListenerTests.cs b/src/libraries/System.Net.Quic/tests/FunctionalTests/QuicListenerTests.cs index 51d2b23fce26c..4cbcbe1ff4a58 100644 --- a/src/libraries/System.Net.Quic/tests/FunctionalTests/QuicListenerTests.cs +++ b/src/libraries/System.Net.Quic/tests/FunctionalTests/QuicListenerTests.cs @@ -119,7 +119,7 @@ public async Task AcceptConnectionAsync_SlowOptionsCallback_TimesOut(bool useCan // Connect attempt should be stopped with "UserCanceled". var connectException = await Assert.ThrowsAsync(async () => await connectTask); - Assert.Contains(TlsAlertMessage.UserCanceled.ToString(), connectException.Message); + Assert.Contains("UserCanceled", connectException.Message); } [Fact] @@ -160,7 +160,7 @@ public async Task AcceptConnectionAsync_ListenerDisposed_Throws() // Connect attempt should be stopped with "UserCanceled". var connectException = await Assert.ThrowsAsync(async () => await connectTask); - Assert.Contains(TlsAlertMessage.UserCanceled.ToString(), connectException.Message); + Assert.Contains("UserCanceled", connectException.Message); } [Fact] diff --git a/src/libraries/System.Net.Quic/tests/FunctionalTests/QuicTestBase.cs b/src/libraries/System.Net.Quic/tests/FunctionalTests/QuicTestBase.cs index 34872a740e1fb..ce7645647b007 100644 --- a/src/libraries/System.Net.Quic/tests/FunctionalTests/QuicTestBase.cs +++ b/src/libraries/System.Net.Quic/tests/FunctionalTests/QuicTestBase.cs @@ -13,8 +13,7 @@ using Xunit.Abstractions; using System.Diagnostics.Tracing; using System.Net.Sockets; -using Microsoft.Quic; -using static Microsoft.Quic.MsQuic; +using System.Reflection; namespace System.Net.Quic.Tests { @@ -44,17 +43,14 @@ public abstract class QuicTestBase : IDisposable static unsafe QuicTestBase() { - Console.WriteLine($"MsQuic {(IsSupported ? "supported" : "not supported")} and using '{MsQuicApi.MsQuicLibraryVersion}'."); + Type msQuicApi = typeof(QuicConnection).Assembly.GetType("System.Net.Quic.MsQuicApi"); + (bool maxQueueWorkDelaySet, string msQuicLibraryVersion) = ((bool, string))msQuicApi.GetMethod("SetUpForTests", BindingFlags.NonPublic | BindingFlags.Static).Invoke(null, Array.Empty()); - if (IsSupported) + Console.WriteLine($"MsQuic {(IsSupported ? "supported" : "not supported")} and using '{msQuicLibraryVersion}'."); + + if (IsSupported && !maxQueueWorkDelaySet) { - QUIC_SETTINGS settings = default(QUIC_SETTINGS); - settings.IsSet.MaxWorkerQueueDelayUs = 1; - settings.MaxWorkerQueueDelayUs = 2_500_000u; // 2.5s, 10x the default - if (StatusFailed(MsQuicApi.Api.ApiTable->SetParam(null, QUIC_PARAM_GLOBAL_SETTINGS, (uint)sizeof(QUIC_SETTINGS), (byte*)&settings))) - { - Console.WriteLine($"Unable to set MsQuic MaxWorkerQueueDelayUs."); - } + Console.WriteLine($"Unable to set MsQuic MaxWorkerQueueDelayUs."); } } diff --git a/src/libraries/System.Net.Quic/tests/FunctionalTests/System.Net.Quic.Functional.Tests.csproj b/src/libraries/System.Net.Quic/tests/FunctionalTests/System.Net.Quic.Functional.Tests.csproj index 2b31dee92406b..c087cce24659a 100644 --- a/src/libraries/System.Net.Quic/tests/FunctionalTests/System.Net.Quic.Functional.Tests.csproj +++ b/src/libraries/System.Net.Quic/tests/FunctionalTests/System.Net.Quic.Functional.Tests.csproj @@ -31,18 +31,7 @@ - - - - - - - - - - - From bd6c04d3917372f1da4fb2efc6a56a83a17d62b7 Mon Sep 17 00:00:00 2001 From: ManickaP Date: Fri, 14 Apr 2023 11:29:45 +0200 Subject: [PATCH 03/11] Try to fix missing build dependency --- eng/docker/libraries-sdk.linux.Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/docker/libraries-sdk.linux.Dockerfile b/eng/docker/libraries-sdk.linux.Dockerfile index a06bd46fcb729..105c6ad86634f 100644 --- a/eng/docker/libraries-sdk.linux.Dockerfile +++ b/eng/docker/libraries-sdk.linux.Dockerfile @@ -1,5 +1,5 @@ # Builds and copies library artifacts into target dotnet sdk image -ARG BUILD_BASE_IMAGE=mcr.microsoft.com/dotnet-buildtools/prereqs:centos-7-f39df28-20191023143754 +ARG BUILD_BASE_IMAGE=mcr.microsoft.com/dotnet-buildtools/prereqs:centos-7 ARG SDK_BASE_IMAGE=mcr.microsoft.com/dotnet/nightly/sdk:7.0-bullseye-slim FROM $BUILD_BASE_IMAGE as corefxbuild From fa5820e5f00a73be4f23458b70429e3a2ae8c7bf Mon Sep 17 00:00:00 2001 From: ManickaP Date: Thu, 20 Apr 2023 12:05:02 +0200 Subject: [PATCH 04/11] Feedback - removed test only function and replaced with shared code + some reflection --- .../StressTests/HttpStress/HttpStress.csproj | 5 +++++ .../tests/StressTests/HttpStress/Program.cs | 22 ++++++++++++++----- .../src/System/Net/Quic/Internal/MsQuicApi.cs | 16 -------------- .../tests/FunctionalTests/MsQuicTests.cs | 2 +- .../FunctionalTests/QuicListenerTests.cs | 4 ++-- .../tests/FunctionalTests/QuicTestBase.cs | 18 +++++++++++---- .../System.Net.Quic.Functional.Tests.csproj | 2 ++ 7 files changed, 41 insertions(+), 28 deletions(-) diff --git a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/HttpStress.csproj b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/HttpStress.csproj index 984ce233dc029..6ba4df8a45ae4 100644 --- a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/HttpStress.csproj +++ b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/HttpStress.csproj @@ -17,6 +17,11 @@ + + + + + false diff --git a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Program.cs b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Program.cs index 15f9d956d0555..3fd8ee1d887e2 100644 --- a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Program.cs +++ b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Program.cs @@ -14,6 +14,7 @@ using System.Net; using HttpStress; using System.Net.Quic; +using Microsoft.Quic; [assembly:SupportedOSPlatform("windows")] [assembly:SupportedOSPlatform("linux")] @@ -161,9 +162,8 @@ private static async Task Run(Configuration config) string GetAssemblyInfo(Assembly assembly) => $"{assembly.Location}, modified {new FileInfo(assembly.Location).LastWriteTime}"; - - Type msQuicApi = typeof(QuicConnection).Assembly.GetType("System.Net.Quic.MsQuicApi")!; - (bool maxQueueWorkDelaySet, string msQuicLibraryVersion) = ((bool, string))msQuicApi.GetMethod("SetUpForTests", BindingFlags.NonPublic | BindingFlags.Static)!.Invoke(null, Array.Empty())!; + Type msQuicApiType = typeof(QuicConnection).Assembly.GetType("System.Net.Quic.MsQuicApi"); + string msQuicLibraryVersion = (string)msQuicApiType.GetProperty("MsQuicLibraryVersion", BindingFlags.NonPublic | BindingFlags.Static).GetGetMethod(true).Invoke(null, Array.Empty()); Console.WriteLine(" .NET Core: " + GetAssemblyInfo(typeof(object).Assembly)); Console.WriteLine(" ASP.NET Core: " + GetAssemblyInfo(typeof(WebHost).Assembly)); @@ -185,9 +185,21 @@ private static async Task Run(Configuration config) Console.WriteLine("Max Content Size: " + config.MaxContentLength); Console.WriteLine("Query Parameters: " + config.MaxParameters); Console.WriteLine(); - if (config.HttpVersion == HttpVersion.Version30 && IsQuicSupported && !maxQueueWorkDelaySet) + + if (config.HttpVersion == HttpVersion.Version30 && IsQuicSupported) { - Console.WriteLine($"Unable to set MsQuic MaxWorkerQueueDelayUs."); + unsafe + { + object msQuicApiInstance = msQuicApiType.GetProperty("Api", BindingFlags.NonPublic | BindingFlags.Static).GetGetMethod(true).Invoke(null, Array.Empty()); + QUIC_API_TABLE* apiTable = (QUIC_API_TABLE*)(Pointer.Unbox(msQuicApiType.GetProperty("ApiTable").GetGetMethod().Invoke(msQuicApiInstance, Array.Empty()))); + QUIC_SETTINGS settings = default(QUIC_SETTINGS); + settings.IsSet.MaxWorkerQueueDelayUs = 1; + settings.MaxWorkerQueueDelayUs = 2_500_000u; // 2.5s, 10x the default + if (MsQuic.StatusFailed(apiTable->SetParam(null, MsQuic.QUIC_PARAM_GLOBAL_SETTINGS, (uint)sizeof(QUIC_SETTINGS), (byte*)&settings))) + { + Console.WriteLine($"Unable to set MsQuic MaxWorkerQueueDelayUs."); + } + } } StressServer? server = null; diff --git a/src/libraries/System.Net.Quic/src/System/Net/Quic/Internal/MsQuicApi.cs b/src/libraries/System.Net.Quic/src/System/Net/Quic/Internal/MsQuicApi.cs index 46cb947c172a6..1923a18e841f3 100644 --- a/src/libraries/System.Net.Quic/src/System/Net/Quic/Internal/MsQuicApi.cs +++ b/src/libraries/System.Net.Quic/src/System/Net/Quic/Internal/MsQuicApi.cs @@ -31,7 +31,6 @@ internal sealed unsafe partial class MsQuicApi // Remove once fixed: https://github.com/mono/linker/issues/1660 [DynamicDependency(DynamicallyAccessedMemberTypes.PublicConstructors, typeof(MsQuicSafeHandle))] [DynamicDependency(DynamicallyAccessedMemberTypes.PublicConstructors, typeof(MsQuicContextSafeHandle))] - [DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(MsQuicApi))] private MsQuicApi(QUIC_API_TABLE* apiTable) { ApiTable = apiTable; @@ -228,19 +227,4 @@ private static bool IsTls13Disabled(bool isServer) #endif return false; } - - // Do not change the name and signature without looking for textual occurrences! - // This method is invoked via reflection from QUIC functional and HTTP stress tests. - private static (bool, string) SetUpForTests() - { - if (!IsQuicSupported) - { - return (true, MsQuicLibraryVersion); - } - - QUIC_SETTINGS settings = default(QUIC_SETTINGS); - settings.IsSet.MaxWorkerQueueDelayUs = 1; - settings.MaxWorkerQueueDelayUs = 2_500_000u; // 2.5s, 10x the default - return (StatusSucceeded(MsQuicApi.Api.ApiTable->SetParam(null, QUIC_PARAM_GLOBAL_SETTINGS, (uint)sizeof(QUIC_SETTINGS), (byte*)&settings)), MsQuicLibraryVersion); - } } diff --git a/src/libraries/System.Net.Quic/tests/FunctionalTests/MsQuicTests.cs b/src/libraries/System.Net.Quic/tests/FunctionalTests/MsQuicTests.cs index 5812a9b69c17d..8bcdbb7e79cbd 100644 --- a/src/libraries/System.Net.Quic/tests/FunctionalTests/MsQuicTests.cs +++ b/src/libraries/System.Net.Quic/tests/FunctionalTests/MsQuicTests.cs @@ -335,7 +335,7 @@ public async Task ConnectWithServerCertificateCallback() // TODO: the exception may change if we implement https://github.com/dotnet/runtime/issues/73152 to make server close // connections with CONNECTION_REFUSED in such cases var authEx = await Assert.ThrowsAsync(() => clientTask); - Assert.Contains("UserCanceled", authEx.Message); + Assert.Contains(TlsAlertMessage.UserCanceled.ToString(), authEx.Message); Assert.Equal(clientOptions.ClientAuthenticationOptions.TargetHost, receivedHostName); await Assert.ThrowsAsync(async () => await listener.AcceptConnectionAsync()); diff --git a/src/libraries/System.Net.Quic/tests/FunctionalTests/QuicListenerTests.cs b/src/libraries/System.Net.Quic/tests/FunctionalTests/QuicListenerTests.cs index 4cbcbe1ff4a58..51d2b23fce26c 100644 --- a/src/libraries/System.Net.Quic/tests/FunctionalTests/QuicListenerTests.cs +++ b/src/libraries/System.Net.Quic/tests/FunctionalTests/QuicListenerTests.cs @@ -119,7 +119,7 @@ public async Task AcceptConnectionAsync_SlowOptionsCallback_TimesOut(bool useCan // Connect attempt should be stopped with "UserCanceled". var connectException = await Assert.ThrowsAsync(async () => await connectTask); - Assert.Contains("UserCanceled", connectException.Message); + Assert.Contains(TlsAlertMessage.UserCanceled.ToString(), connectException.Message); } [Fact] @@ -160,7 +160,7 @@ public async Task AcceptConnectionAsync_ListenerDisposed_Throws() // Connect attempt should be stopped with "UserCanceled". var connectException = await Assert.ThrowsAsync(async () => await connectTask); - Assert.Contains("UserCanceled", connectException.Message); + Assert.Contains(TlsAlertMessage.UserCanceled.ToString(), connectException.Message); } [Fact] diff --git a/src/libraries/System.Net.Quic/tests/FunctionalTests/QuicTestBase.cs b/src/libraries/System.Net.Quic/tests/FunctionalTests/QuicTestBase.cs index ce7645647b007..c5f7fb5c751e4 100644 --- a/src/libraries/System.Net.Quic/tests/FunctionalTests/QuicTestBase.cs +++ b/src/libraries/System.Net.Quic/tests/FunctionalTests/QuicTestBase.cs @@ -14,6 +14,7 @@ using System.Diagnostics.Tracing; using System.Net.Sockets; using System.Reflection; +using Microsoft.Quic; namespace System.Net.Quic.Tests { @@ -43,14 +44,23 @@ public abstract class QuicTestBase : IDisposable static unsafe QuicTestBase() { - Type msQuicApi = typeof(QuicConnection).Assembly.GetType("System.Net.Quic.MsQuicApi"); - (bool maxQueueWorkDelaySet, string msQuicLibraryVersion) = ((bool, string))msQuicApi.GetMethod("SetUpForTests", BindingFlags.NonPublic | BindingFlags.Static).Invoke(null, Array.Empty()); + // If any of the reflection bellow breaks due to changes in "System.Net.Quic.MsQuicApi", also check and fix HttpStress project as it uses the same hack. + Type msQuicApiType = typeof(QuicConnection).Assembly.GetType("System.Net.Quic.MsQuicApi"); + string msQuicLibraryVersion = (string)msQuicApiType.GetProperty("MsQuicLibraryVersion", BindingFlags.NonPublic | BindingFlags.Static).GetGetMethod(true).Invoke(null, Array.Empty()); Console.WriteLine($"MsQuic {(IsSupported ? "supported" : "not supported")} and using '{msQuicLibraryVersion}'."); - if (IsSupported && !maxQueueWorkDelaySet) + if (IsSupported) { - Console.WriteLine($"Unable to set MsQuic MaxWorkerQueueDelayUs."); + object msQuicApiInstance = msQuicApiType.GetProperty("Api", BindingFlags.NonPublic | BindingFlags.Static).GetGetMethod(true).Invoke(null, Array.Empty()); + QUIC_API_TABLE* apiTable = (QUIC_API_TABLE*)(Pointer.Unbox(msQuicApiType.GetProperty("ApiTable").GetGetMethod().Invoke(msQuicApiInstance, Array.Empty()))); + QUIC_SETTINGS settings = default(QUIC_SETTINGS); + settings.IsSet.MaxWorkerQueueDelayUs = 1; + settings.MaxWorkerQueueDelayUs = 2_500_000u; // 2.5s, 10x the default + if (MsQuic.StatusFailed(apiTable->SetParam(null, MsQuic.QUIC_PARAM_GLOBAL_SETTINGS, (uint)sizeof(QUIC_SETTINGS), (byte*)&settings))) + { + Console.WriteLine($"Unable to set MsQuic MaxWorkerQueueDelayUs."); + } } } diff --git a/src/libraries/System.Net.Quic/tests/FunctionalTests/System.Net.Quic.Functional.Tests.csproj b/src/libraries/System.Net.Quic/tests/FunctionalTests/System.Net.Quic.Functional.Tests.csproj index c087cce24659a..b2e61c1bd189b 100644 --- a/src/libraries/System.Net.Quic/tests/FunctionalTests/System.Net.Quic.Functional.Tests.csproj +++ b/src/libraries/System.Net.Quic/tests/FunctionalTests/System.Net.Quic.Functional.Tests.csproj @@ -16,6 +16,7 @@ + @@ -32,6 +33,7 @@ + From ed73b020e58a6a290c26e961672fcce32ff63a05 Mon Sep 17 00:00:00 2001 From: antonfirsov Date: Wed, 26 Apr 2023 01:52:33 +0200 Subject: [PATCH 05/11] fix argument handling in build-local.ps1 --- .../tests/StressTests/HttpStress/build-local.ps1 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/build-local.ps1 b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/build-local.ps1 index b0509e14879d9..dbdd2e696c634 100644 --- a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/build-local.ps1 +++ b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/build-local.ps1 @@ -14,7 +14,7 @@ if (-not ([string]::IsNullOrEmpty($args[0]))) { $LibrariesConfiguration = "Release" if (-not ([string]::IsNullOrEmpty($args[1]))) { - $LibrariesConfiguration = $args[0] + $LibrariesConfiguration = $args[1] } $TestHostRoot="$RepoRoot/artifacts/bin/testhost/net$Version-windows-$LibrariesConfiguration-x64" @@ -53,11 +53,11 @@ if (-not (Test-Path -Path "$TestHostRoot/shared/Microsoft.AspNetCore.App")) { Write-Host "Building solution." dotnet build -c $StressConfiguration -$Runscript=".\run-stress-$LibrariesConfiguration-$StressConfiguration.ps1" +$Runscript=".\run-stress-$StressConfiguration-$LibrariesConfiguration.ps1" if (-not (Test-Path $Runscript)) { Write-Host "Generating Runscript." Add-Content -Path $Runscript -Value "& '$TestHostRoot/dotnet' exec --roll-forward Major ./bin/$StressConfiguration/net$Version/HttpStress.dll `$args" } Write-Host "To run tests type:" -Write-Host "$Runscript [stress test args]" \ No newline at end of file +Write-Host "$Runscript [stress test args]" From 7e4d512b0fcf6a8dd3bbb4eadb68743e183b32a6 Mon Sep 17 00:00:00 2001 From: antonfirsov Date: Wed, 26 Apr 2023 01:53:16 +0200 Subject: [PATCH 06/11] do not use MsQuicLibraryVersion --- .../System.Net.Http/tests/StressTests/HttpStress/Program.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Program.cs b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Program.cs index 3fd8ee1d887e2..2a9865d464d06 100644 --- a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Program.cs +++ b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Program.cs @@ -162,9 +162,6 @@ private static async Task Run(Configuration config) string GetAssemblyInfo(Assembly assembly) => $"{assembly.Location}, modified {new FileInfo(assembly.Location).LastWriteTime}"; - Type msQuicApiType = typeof(QuicConnection).Assembly.GetType("System.Net.Quic.MsQuicApi"); - string msQuicLibraryVersion = (string)msQuicApiType.GetProperty("MsQuicLibraryVersion", BindingFlags.NonPublic | BindingFlags.Static).GetGetMethod(true).Invoke(null, Array.Empty()); - Console.WriteLine(" .NET Core: " + GetAssemblyInfo(typeof(object).Assembly)); Console.WriteLine(" ASP.NET Core: " + GetAssemblyInfo(typeof(WebHost).Assembly)); Console.WriteLine(" System.Net.Http: " + GetAssemblyInfo(typeof(System.Net.Http.HttpClient).Assembly)); @@ -177,7 +174,6 @@ private static async Task Run(Configuration config) Console.WriteLine(" Content Length: " + config.MaxContentLength); Console.WriteLine(" HTTP Version: " + config.HttpVersion); Console.WriteLine(" QUIC supported: " + (IsQuicSupported ? "yes" : "no")); - Console.WriteLine(" MsQuic Version: " + msQuicLibraryVersion); Console.WriteLine(" Lifetime: " + (config.ConnectionLifetime.HasValue ? $"{config.ConnectionLifetime.Value.TotalMilliseconds}ms" : "(infinite)")); Console.WriteLine(" Operations: " + string.Join(", ", usedClientOperations.Select(o => o.name))); Console.WriteLine(" Random Seed: " + config.RandomSeed); @@ -188,6 +184,7 @@ private static async Task Run(Configuration config) if (config.HttpVersion == HttpVersion.Version30 && IsQuicSupported) { + Type msQuicApiType = typeof(QuicConnection).Assembly.GetType("System.Net.Quic.MsQuicApi"); unsafe { object msQuicApiInstance = msQuicApiType.GetProperty("Api", BindingFlags.NonPublic | BindingFlags.Static).GetGetMethod(true).Invoke(null, Array.Empty()); From 1f8f56e4e145e087bf525be8b76fc10c026d89d2 Mon Sep 17 00:00:00 2001 From: antonfirsov Date: Wed, 26 Apr 2023 22:36:29 +0200 Subject: [PATCH 07/11] copy msquic interop utils to the SDK base image --- eng/docker/build-docker-sdk.ps1 | 3 +++ .../tests/StressTests/HttpStress/Directory.Build.props | 5 +++-- .../tests/StressTests/HttpStress/HttpStress.csproj | 2 +- .../tests/StressTests/HttpStress/windows.Dockerfile | 1 + 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/eng/docker/build-docker-sdk.ps1 b/eng/docker/build-docker-sdk.ps1 index bc73312efcb6c..1a09343defbf6 100755 --- a/eng/docker/build-docker-sdk.ps1 +++ b/eng/docker/build-docker-sdk.ps1 @@ -36,6 +36,7 @@ if ($buildWindowsContainers) # 2. Runtime pack (microsoft.netcore.app.runtime.win-x64) # 3. targetingpacks.targets, so stress test builds can target the live-built runtime instead of the one in the pre-installed SDK # 4. testhost + # 5. msquic interop sources (needed for HttpStress) $binArtifacts = "$REPO_ROOT_DIR\artifacts\bin" $dockerContext = "$REPO_ROOT_DIR\artifacts\docker-context" @@ -51,6 +52,8 @@ if ($buildWindowsContainers) -Destination $dockerContext\testhost Copy-Item -Recurse -Path $REPO_ROOT_DIR\eng\targetingpacks.targets ` -Destination $dockerContext\targetingpacks.targets + Copy-Item -Recurse -Path $REPO_ROOT_DIR\src\libraries\System.Net.Quic\src\System\Net\Quic\Interop ` + -Destination $dockerContext\msquic-interop # In case of non-CI builds, testhost may already contain Microsoft.AspNetCore.App (see build-local.ps1 in HttpStress): $testHostAspNetCorePath="$dockerContext\testhost\net$dotNetVersion-windows-$configuration-x64/shared/Microsoft.AspNetCore.App" diff --git a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Directory.Build.props b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Directory.Build.props index 509bca64fdc3d..3ee8cbfa7ae05 100644 --- a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Directory.Build.props +++ b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Directory.Build.props @@ -5,7 +5,8 @@ $([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory)../, global.json))/ - + + $(RepositoryRoot)src/libraries/System.Net.Quic/src/System/Net/Quic/Interop/*.cs $(RepositoryRoot)eng/targetingpacks.targets 8.0.0 net8.0 @@ -14,4 +15,4 @@ $(RepositoryRoot)artifacts/bin/microsoft.netcore.app.ref/ $(RepositoryRoot)artifacts/bin/microsoft.netcore.app.runtime.$(OutputRID)/$(Configuration)/ - \ No newline at end of file + diff --git a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/HttpStress.csproj b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/HttpStress.csproj index 6ba4df8a45ae4..b98a4bd529c76 100644 --- a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/HttpStress.csproj +++ b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/HttpStress.csproj @@ -19,7 +19,7 @@ - + diff --git a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/windows.Dockerfile b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/windows.Dockerfile index 4c4539b43fd93..b090d4eb24636 100644 --- a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/windows.Dockerfile +++ b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/windows.Dockerfile @@ -12,6 +12,7 @@ ARG VERSION=8.0 ARG CONFIGURATION=Release RUN dotnet build -c $env:CONFIGURATION ` + -p:MsQuicInteropIncludes="C:/live-runtime-artifacts/msquic-interop/*.cs" ` -p:TargetingPacksTargetsLocation=C:/live-runtime-artifacts/targetingpacks.targets ` -p:MicrosoftNetCoreAppRefPackDir=C:/live-runtime-artifacts/microsoft.netcore.app.ref/ ` -p:MicrosoftNetCoreAppRuntimePackDir=C:/live-runtime-artifacts/microsoft.netcore.app.runtime.win-x64/$env:CONFIGURATION/ From d2c113c2d170bb155d431a190da8dc8f50f6e2fb Mon Sep 17 00:00:00 2001 From: antonfirsov Date: Wed, 26 Apr 2023 22:54:10 +0200 Subject: [PATCH 08/11] use LinkBase in Functional.Tests.csproj for wildcard include --- .../FunctionalTests/System.Net.Quic.Functional.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libraries/System.Net.Quic/tests/FunctionalTests/System.Net.Quic.Functional.Tests.csproj b/src/libraries/System.Net.Quic/tests/FunctionalTests/System.Net.Quic.Functional.Tests.csproj index b2e61c1bd189b..55ddd30f86abb 100644 --- a/src/libraries/System.Net.Quic/tests/FunctionalTests/System.Net.Quic.Functional.Tests.csproj +++ b/src/libraries/System.Net.Quic/tests/FunctionalTests/System.Net.Quic.Functional.Tests.csproj @@ -33,7 +33,7 @@ - + From 0a9731fae68573c4fe02a6bfe9459baf6d5a0ebe Mon Sep 17 00:00:00 2001 From: ManickaP Date: Thu, 27 Apr 2023 13:56:54 +0200 Subject: [PATCH 09/11] Use MsQuicLibraryVersion in out internal logging and as a side-effect avoid the property being trimmed --- .../System.Net.Http/tests/StressTests/HttpStress/Program.cs | 5 ++++- .../src/System/Net/Quic/Internal/MsQuicApi.cs | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Program.cs b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Program.cs index 2a9865d464d06..3fd8ee1d887e2 100644 --- a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Program.cs +++ b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Program.cs @@ -162,6 +162,9 @@ private static async Task Run(Configuration config) string GetAssemblyInfo(Assembly assembly) => $"{assembly.Location}, modified {new FileInfo(assembly.Location).LastWriteTime}"; + Type msQuicApiType = typeof(QuicConnection).Assembly.GetType("System.Net.Quic.MsQuicApi"); + string msQuicLibraryVersion = (string)msQuicApiType.GetProperty("MsQuicLibraryVersion", BindingFlags.NonPublic | BindingFlags.Static).GetGetMethod(true).Invoke(null, Array.Empty()); + Console.WriteLine(" .NET Core: " + GetAssemblyInfo(typeof(object).Assembly)); Console.WriteLine(" ASP.NET Core: " + GetAssemblyInfo(typeof(WebHost).Assembly)); Console.WriteLine(" System.Net.Http: " + GetAssemblyInfo(typeof(System.Net.Http.HttpClient).Assembly)); @@ -174,6 +177,7 @@ private static async Task Run(Configuration config) Console.WriteLine(" Content Length: " + config.MaxContentLength); Console.WriteLine(" HTTP Version: " + config.HttpVersion); Console.WriteLine(" QUIC supported: " + (IsQuicSupported ? "yes" : "no")); + Console.WriteLine(" MsQuic Version: " + msQuicLibraryVersion); Console.WriteLine(" Lifetime: " + (config.ConnectionLifetime.HasValue ? $"{config.ConnectionLifetime.Value.TotalMilliseconds}ms" : "(infinite)")); Console.WriteLine(" Operations: " + string.Join(", ", usedClientOperations.Select(o => o.name))); Console.WriteLine(" Random Seed: " + config.RandomSeed); @@ -184,7 +188,6 @@ private static async Task Run(Configuration config) if (config.HttpVersion == HttpVersion.Version30 && IsQuicSupported) { - Type msQuicApiType = typeof(QuicConnection).Assembly.GetType("System.Net.Quic.MsQuicApi"); unsafe { object msQuicApiInstance = msQuicApiType.GetProperty("Api", BindingFlags.NonPublic | BindingFlags.Static).GetGetMethod(true).Invoke(null, Array.Empty()); diff --git a/src/libraries/System.Net.Quic/src/System/Net/Quic/Internal/MsQuicApi.cs b/src/libraries/System.Net.Quic/src/System/Net/Quic/Internal/MsQuicApi.cs index 53842f8c43ac7..778b2d72d45cb 100644 --- a/src/libraries/System.Net.Quic/src/System/Net/Quic/Internal/MsQuicApi.cs +++ b/src/libraries/System.Net.Quic/src/System/Net/Quic/Internal/MsQuicApi.cs @@ -130,7 +130,7 @@ static MsQuicApi() } string? gitHash = Marshal.PtrToStringUTF8((IntPtr)libGitHash); - MsQuicLibraryVersion = $"{Interop.Libraries.MsQuic} version={version} commit={gitHash}"; + MsQuicLibraryVersion = $"{Interop.Libraries.MsQuic} {version} ({gitHash})"; if (version < s_minMsQuicVersion) { @@ -143,7 +143,7 @@ static MsQuicApi() if (NetEventSource.Log.IsEnabled()) { - NetEventSource.Info(null, $"Loaded MsQuic library version '{version}', commit '{gitHash}'."); + NetEventSource.Info(null, $"Loaded MsQuic library '{MsQuicLibraryVersion}'."); } // Assume SChannel is being used on windows and query for the actual provider from the library if querying is supported From e316a13ee2580ec68901617ca196d3b067639d49 Mon Sep 17 00:00:00 2001 From: ManickaP Date: Thu, 27 Apr 2023 16:56:16 +0200 Subject: [PATCH 10/11] Comment --- .../System.Net.Http/tests/StressTests/HttpStress/Program.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Program.cs b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Program.cs index 3fd8ee1d887e2..5a60db6364aad 100644 --- a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Program.cs +++ b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Program.cs @@ -190,6 +190,8 @@ private static async Task Run(Configuration config) { unsafe { + // If the system gets overloaded, MsQuic has a tendency to drop incoming connections, see https://github.com/dotnet/runtime/issues/55979. + // So in case we're running H/3 stress test, we're using the same hack as for System.Net.Quic tests, which increases the time limit for pending operations in MsQuic thread pool. object msQuicApiInstance = msQuicApiType.GetProperty("Api", BindingFlags.NonPublic | BindingFlags.Static).GetGetMethod(true).Invoke(null, Array.Empty()); QUIC_API_TABLE* apiTable = (QUIC_API_TABLE*)(Pointer.Unbox(msQuicApiType.GetProperty("ApiTable").GetGetMethod().Invoke(msQuicApiInstance, Array.Empty()))); QUIC_SETTINGS settings = default(QUIC_SETTINGS); From 949d82bfde443eb44f9ca753ef88a696eb741fe5 Mon Sep 17 00:00:00 2001 From: anton Date: Thu, 27 Apr 2023 20:20:36 +0200 Subject: [PATCH 11/11] also copy files to the Linux container --- eng/docker/libraries-sdk.linux.Dockerfile | 5 +++++ .../System.Net.Http/tests/StressTests/HttpStress/Dockerfile | 1 + 2 files changed, 6 insertions(+) diff --git a/eng/docker/libraries-sdk.linux.Dockerfile b/eng/docker/libraries-sdk.linux.Dockerfile index 8d7d6169a9fe9..401ce9f1ffd43 100644 --- a/eng/docker/libraries-sdk.linux.Dockerfile +++ b/eng/docker/libraries-sdk.linux.Dockerfile @@ -26,6 +26,7 @@ RUN bash ./dotnet-install.sh --channel $_DOTNET_INSTALL_CHANNEL --quality daily # 2. Runtime pack (microsoft.netcore.app.runtime.linux-x64) # 3. targetingpacks.targets, so stress test builds can target the live-built runtime instead of the one in the pre-installed SDK # 4. testhost +# 5. msquic interop sources (needed for HttpStress) COPY --from=corefxbuild \ /repo/artifacts/bin/microsoft.netcore.app.ref \ @@ -43,6 +44,10 @@ COPY --from=corefxbuild \ /repo/artifacts/bin/testhost \ /live-runtime-artifacts/testhost +COPY --from=corefxbuild \ + /repo/src/libraries/System.Net.Quic/src/System/Net/Quic/Interop \ + /live-runtime-artifacts/msquic-interop + # Add AspNetCore bits to testhost: ENV _ASPNETCORE_SOURCE="/usr/share/dotnet/shared/Microsoft.AspNetCore.App/$VERSION*" ENV _ASPNETCORE_DEST="/live-runtime-artifacts/testhost/net$VERSION-linux-$CONFIGURATION-x64/shared/Microsoft.AspNetCore.App" diff --git a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Dockerfile b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Dockerfile index e56f8c80c3212..6dc83bce1895e 100644 --- a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Dockerfile +++ b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Dockerfile @@ -28,6 +28,7 @@ WORKDIR /app COPY . . RUN dotnet build -c $CONFIGURATION \ + -p:MsQuicInteropIncludes="/live-runtime-artifacts/msquic-interop/*.cs" \ -p:TargetingPacksTargetsLocation=/live-runtime-artifacts/targetingpacks.targets \ -p:MicrosoftNetCoreAppRefPackDir=/live-runtime-artifacts/microsoft.netcore.app.ref/ \ -p:MicrosoftNetCoreAppRuntimePackDir=/live-runtime-artifacts/microsoft.netcore.app.runtime.linux-x64/$CONFIGURATION/