From 863ada559195d2ef9211026a13ec015f468b1ac1 Mon Sep 17 00:00:00 2001 From: Mitchell Hwang Date: Tue, 9 Jun 2020 08:17:33 -0400 Subject: [PATCH 1/2] [libraries] Skip GetOpenSslVersion on Apple OS --- .../tests/TestUtilities/System/PlatformDetection.Unix.cs | 6 +++++- .../System.Runtime.InteropServices.RuntimeInformation.cs | 2 ++ .../InteropServices/RuntimeInformation/OSPlatform.cs | 4 ++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.Unix.cs b/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.Unix.cs index 38fb7d598ce0a2..04d5b4ea8cd756 100644 --- a/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.Unix.cs +++ b/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.Unix.cs @@ -45,12 +45,16 @@ public static partial class PlatformDetection public static bool IsRedHatFamily7 => IsRedHatFamilyAndVersion(7); public static bool IsNotFedoraOrRedHatFamily => !IsFedora && !IsRedHatFamily; public static bool IsNotDebian10 => !IsDebian10; + public static bool IsNotApple => + !RuntimeInformation.IsOSPlatform(OSPlatform.iOS) && + !RuntimeInformation.IsOSPlatform(OSPlatform.OSX) && + !RuntimeInformation.IsOSPlatform(OSPlatform.tvOS); public static bool IsSuperUser => !IsWindows ? libc.geteuid() == 0 : throw new PlatformNotSupportedException(); - public static Version OpenSslVersion => !IsOSX && !IsWindows ? + public static Version OpenSslVersion => IsNotApple && !IsWindows ? GetOpenSslVersion() : throw new PlatformNotSupportedException(); diff --git a/src/libraries/System.Runtime.InteropServices.RuntimeInformation/ref/System.Runtime.InteropServices.RuntimeInformation.cs b/src/libraries/System.Runtime.InteropServices.RuntimeInformation/ref/System.Runtime.InteropServices.RuntimeInformation.cs index c350527a7a6fde..cf2f2c97740e81 100644 --- a/src/libraries/System.Runtime.InteropServices.RuntimeInformation/ref/System.Runtime.InteropServices.RuntimeInformation.cs +++ b/src/libraries/System.Runtime.InteropServices.RuntimeInformation/ref/System.Runtime.InteropServices.RuntimeInformation.cs @@ -21,8 +21,10 @@ public enum Architecture private readonly int _dummyPrimitive; public static System.Runtime.InteropServices.OSPlatform Browser { get { throw null; } } public static System.Runtime.InteropServices.OSPlatform FreeBSD { get { throw null; } } + public static System.Runtime.InteropServices.OSPlatform iOS { get { throw null; } } public static System.Runtime.InteropServices.OSPlatform Linux { get { throw null; } } public static System.Runtime.InteropServices.OSPlatform OSX { get { throw null; } } + public static System.Runtime.InteropServices.OSPlatform tvOS { get { throw null; } } public static System.Runtime.InteropServices.OSPlatform Windows { get { throw null; } } public static System.Runtime.InteropServices.OSPlatform Create(string osPlatform) { throw null; } public override bool Equals(object? obj) { throw null; } diff --git a/src/libraries/System.Runtime.InteropServices.RuntimeInformation/src/System/Runtime/InteropServices/RuntimeInformation/OSPlatform.cs b/src/libraries/System.Runtime.InteropServices.RuntimeInformation/src/System/Runtime/InteropServices/RuntimeInformation/OSPlatform.cs index 8747805f65b905..5357f1fac18fbd 100644 --- a/src/libraries/System.Runtime.InteropServices.RuntimeInformation/src/System/Runtime/InteropServices/RuntimeInformation/OSPlatform.cs +++ b/src/libraries/System.Runtime.InteropServices.RuntimeInformation/src/System/Runtime/InteropServices/RuntimeInformation/OSPlatform.cs @@ -12,10 +12,14 @@ namespace System.Runtime.InteropServices public static OSPlatform FreeBSD { get; } = new OSPlatform("FREEBSD"); + public static OSPlatform iOS { get; } = new OSPlatform("IOS"); + public static OSPlatform Linux { get; } = new OSPlatform("LINUX"); public static OSPlatform OSX { get; } = new OSPlatform("OSX"); + public static OSPlatform tvOS { get; } = new OSPlatform("TVOS"); + public static OSPlatform Windows { get; } = new OSPlatform("WINDOWS"); private OSPlatform(string osPlatform) From d64d9f2723793a489a1e56e92de5ba589f9f1aa3 Mon Sep 17 00:00:00 2001 From: Mitchell Hwang Date: Tue, 9 Jun 2020 10:57:18 -0400 Subject: [PATCH 2/2] Remove iOS and tvOS from reference --- .../tests/TestUtilities/System/PlatformDetection.Unix.cs | 4 ++-- .../ref/System.Runtime.InteropServices.RuntimeInformation.cs | 2 -- .../Runtime/InteropServices/RuntimeInformation/OSPlatform.cs | 4 ---- 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.Unix.cs b/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.Unix.cs index 04d5b4ea8cd756..bb5bb4bc370b26 100644 --- a/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.Unix.cs +++ b/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.Unix.cs @@ -46,9 +46,9 @@ public static partial class PlatformDetection public static bool IsNotFedoraOrRedHatFamily => !IsFedora && !IsRedHatFamily; public static bool IsNotDebian10 => !IsDebian10; public static bool IsNotApple => - !RuntimeInformation.IsOSPlatform(OSPlatform.iOS) && + !RuntimeInformation.IsOSPlatform(OSPlatform.Create("IOS")) && !RuntimeInformation.IsOSPlatform(OSPlatform.OSX) && - !RuntimeInformation.IsOSPlatform(OSPlatform.tvOS); + !RuntimeInformation.IsOSPlatform(OSPlatform.Create("TVOS")); public static bool IsSuperUser => !IsWindows ? libc.geteuid() == 0 : diff --git a/src/libraries/System.Runtime.InteropServices.RuntimeInformation/ref/System.Runtime.InteropServices.RuntimeInformation.cs b/src/libraries/System.Runtime.InteropServices.RuntimeInformation/ref/System.Runtime.InteropServices.RuntimeInformation.cs index cf2f2c97740e81..c350527a7a6fde 100644 --- a/src/libraries/System.Runtime.InteropServices.RuntimeInformation/ref/System.Runtime.InteropServices.RuntimeInformation.cs +++ b/src/libraries/System.Runtime.InteropServices.RuntimeInformation/ref/System.Runtime.InteropServices.RuntimeInformation.cs @@ -21,10 +21,8 @@ public enum Architecture private readonly int _dummyPrimitive; public static System.Runtime.InteropServices.OSPlatform Browser { get { throw null; } } public static System.Runtime.InteropServices.OSPlatform FreeBSD { get { throw null; } } - public static System.Runtime.InteropServices.OSPlatform iOS { get { throw null; } } public static System.Runtime.InteropServices.OSPlatform Linux { get { throw null; } } public static System.Runtime.InteropServices.OSPlatform OSX { get { throw null; } } - public static System.Runtime.InteropServices.OSPlatform tvOS { get { throw null; } } public static System.Runtime.InteropServices.OSPlatform Windows { get { throw null; } } public static System.Runtime.InteropServices.OSPlatform Create(string osPlatform) { throw null; } public override bool Equals(object? obj) { throw null; } diff --git a/src/libraries/System.Runtime.InteropServices.RuntimeInformation/src/System/Runtime/InteropServices/RuntimeInformation/OSPlatform.cs b/src/libraries/System.Runtime.InteropServices.RuntimeInformation/src/System/Runtime/InteropServices/RuntimeInformation/OSPlatform.cs index 5357f1fac18fbd..8747805f65b905 100644 --- a/src/libraries/System.Runtime.InteropServices.RuntimeInformation/src/System/Runtime/InteropServices/RuntimeInformation/OSPlatform.cs +++ b/src/libraries/System.Runtime.InteropServices.RuntimeInformation/src/System/Runtime/InteropServices/RuntimeInformation/OSPlatform.cs @@ -12,14 +12,10 @@ namespace System.Runtime.InteropServices public static OSPlatform FreeBSD { get; } = new OSPlatform("FREEBSD"); - public static OSPlatform iOS { get; } = new OSPlatform("IOS"); - public static OSPlatform Linux { get; } = new OSPlatform("LINUX"); public static OSPlatform OSX { get; } = new OSPlatform("OSX"); - public static OSPlatform tvOS { get; } = new OSPlatform("TVOS"); - public static OSPlatform Windows { get; } = new OSPlatform("WINDOWS"); private OSPlatform(string osPlatform)