From b1615d8ccc92e66080c71f11327946616ce5a044 Mon Sep 17 00:00:00 2001 From: ManickaP <mapichov@microsoft.com> Date: Fri, 3 Feb 2023 13:27:03 +0100 Subject: [PATCH] Use find to locate msquic lib; Use ActiveIssue to skip win test on singlefile --- .../TestUtilities/System/PlatformDetection.cs | 1 + .../MsQuicPlatformDetectionTests.cs | 30 +++++++------------ 2 files changed, 12 insertions(+), 19 deletions(-) diff --git a/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs b/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs index 9d81146e977cb..6205cac90595a 100644 --- a/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs +++ b/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs @@ -199,6 +199,7 @@ private static bool GetLinqExpressionsBuiltWithIsInterpretingOnly() public static bool IsDebuggerTypeProxyAttributeSupported => !IsNativeAot; public static bool HasAssemblyFiles => !string.IsNullOrEmpty(typeof(PlatformDetection).Assembly.Location); public static bool HasHostExecutable => HasAssemblyFiles; // single-file don't have a host + public static bool IsSingleFile => !HasAssemblyFiles; private static volatile Tuple<bool> s_lazyNonZeroLowerBoundArraySupported; public static bool IsNonZeroLowerBoundArraySupported diff --git a/src/libraries/System.Net.Quic/tests/FunctionalTests/MsQuicPlatformDetectionTests.cs b/src/libraries/System.Net.Quic/tests/FunctionalTests/MsQuicPlatformDetectionTests.cs index 1bcc783b876d5..6c1a42243522c 100644 --- a/src/libraries/System.Net.Quic/tests/FunctionalTests/MsQuicPlatformDetectionTests.cs +++ b/src/libraries/System.Net.Quic/tests/FunctionalTests/MsQuicPlatformDetectionTests.cs @@ -21,33 +21,25 @@ public void UnsupportedPlatforms_ThrowsPlatformNotSupportedException() Assert.ThrowsAsync<PlatformNotSupportedException>(async () => await CreateQuicConnection(new IPEndPoint(IPAddress.Loopback, 0))); } + [ActiveIssue("https://github.com/dotnet/runtime/issues/73290", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsWindows), nameof(PlatformDetection.SupportsTls13))] public void SupportedWindowsPlatforms_IsSupportedIsTrue() { - if (PlatformDetection.HasAssemblyFiles) - { - Assert.True(QuicListener.IsSupported); - Assert.True(QuicConnection.IsSupported); - } - else - { - // The above if check can be deleted when https://github.com/dotnet/runtime/issues/73290 - // gets fixed and this test starts failing. - Assert.False(QuicListener.IsSupported); - Assert.False(QuicConnection.IsSupported); - } + Assert.True(QuicListener.IsSupported); + Assert.True(QuicConnection.IsSupported); } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsLinux))] public async Task SupportedLinuxPlatforms_IsSupportedIsTrue() { - using Process ldconfig = new Process(); - ldconfig.StartInfo.FileName = "ldconfig"; - ldconfig.StartInfo.Arguments = "-p"; - ldconfig.StartInfo.RedirectStandardOutput = true; - ldconfig.Start(); - string output = await ldconfig.StandardOutput.ReadToEndAsync(); - await ldconfig.WaitForExitAsync(); + using Process find = new Process(); + find.StartInfo.FileName = "find"; + find.StartInfo.Arguments = "/usr/ -iname libmsquic.so*"; + find.StartInfo.RedirectStandardOutput = true; + find.Start(); + string output = await find.StandardOutput.ReadToEndAsync(); + _output.WriteLine(output); + await find.WaitForExitAsync(); if (output.Contains("libmsquic.so")) { Assert.True(QuicListener.IsSupported);