From c4f64fec75549e5169510d5d85eeb11dc7986dd8 Mon Sep 17 00:00:00 2001 From: Eric Erhardt Date: Mon, 6 Apr 2020 11:09:42 -0500 Subject: [PATCH 1/2] Enable RuntimeIdentifierTests Now that we have an updated test host, we can enable the RuntimeInformation.RuntimeIdentifier tests that are disabled. Fix #26780 --- .../tests/RuntimeIdentifierTests.cs | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/libraries/System.Runtime.InteropServices.RuntimeInformation/tests/RuntimeIdentifierTests.cs b/src/libraries/System.Runtime.InteropServices.RuntimeInformation/tests/RuntimeIdentifierTests.cs index ac7a0b7ad9e0fe..e95954a459cfe1 100644 --- a/src/libraries/System.Runtime.InteropServices.RuntimeInformation/tests/RuntimeIdentifierTests.cs +++ b/src/libraries/System.Runtime.InteropServices.RuntimeInformation/tests/RuntimeIdentifierTests.cs @@ -12,7 +12,6 @@ namespace System.Runtime.InteropServices.RuntimeInformationTests public class RuntimeIdentifierTests { [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/26780")] // need a new testhost public void VerifyOSRid() { Assert.NotNull(RuntimeInformation.RuntimeIdentifier); @@ -21,7 +20,6 @@ public void VerifyOSRid() } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/26780")] // need a new testhost public void VerifyEnvironmentVariable() { RemoteInvokeOptions options = new RemoteInvokeOptions(); @@ -63,14 +61,12 @@ public void VerifyAppContextVariableUnknown() } [Fact, PlatformSpecific(TestPlatforms.Windows)] - [ActiveIssue("https://github.com/dotnet/runtime/issues/26780")] // need a new testhost public void VerifyWindowsRid() { Assert.StartsWith("win", RuntimeInformation.RuntimeIdentifier, StringComparison.OrdinalIgnoreCase); } [Fact, PlatformSpecific(TestPlatforms.Linux)] - [ActiveIssue("https://github.com/dotnet/runtime/issues/26780")] // need a new testhost public void VerifyLinuxRid() { string expectedOSName = File.ReadAllLines("/etc/os-release") @@ -82,14 +78,12 @@ public void VerifyLinuxRid() } [Fact, PlatformSpecific(TestPlatforms.FreeBSD)] - [ActiveIssue("https://github.com/dotnet/runtime/issues/26780")] // need a new testhost public void VerifyFreeBSDRid() { Assert.StartsWith("freebsd", RuntimeInformation.RuntimeIdentifier, StringComparison.OrdinalIgnoreCase); } [Fact, PlatformSpecific(TestPlatforms.OSX)] - [ActiveIssue("https://github.com/dotnet/runtime/issues/26780")] // need a new testhost public void VerifyOSXRid() { Assert.StartsWith("osx", RuntimeInformation.RuntimeIdentifier, StringComparison.OrdinalIgnoreCase); From ce5889c806fa28b50acfef51ec4af717ccde9d6a Mon Sep 17 00:00:00 2001 From: Eric Erhardt Date: Mon, 6 Apr 2020 14:54:35 -0500 Subject: [PATCH 2/2] Trim quotes from ID in /etc/os-release --- .../tests/DescriptionNameTests.cs | 4 ++-- .../tests/RuntimeIdentifierTests.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libraries/System.Runtime.InteropServices.RuntimeInformation/tests/DescriptionNameTests.cs b/src/libraries/System.Runtime.InteropServices.RuntimeInformation/tests/DescriptionNameTests.cs index bbc28bce1546ba..d65f92ec770f91 100644 --- a/src/libraries/System.Runtime.InteropServices.RuntimeInformation/tests/DescriptionNameTests.cs +++ b/src/libraries/System.Runtime.InteropServices.RuntimeInformation/tests/DescriptionNameTests.cs @@ -117,8 +117,8 @@ public void DumpRuntimeInformationToConsole() if (osd.Contains("Linux")) { - // Dump several procfs files - foreach (string path in new string[] { "/proc/self/mountinfo", "/proc/self/cgroup", "/proc/self/limits" }) + // Dump several procfs files and /etc/os-release + foreach (string path in new string[] { "/proc/self/mountinfo", "/proc/self/cgroup", "/proc/self/limits", "/etc/os-release" }) { Console.WriteLine($"### CONTENTS OF \"{path}\":"); try diff --git a/src/libraries/System.Runtime.InteropServices.RuntimeInformation/tests/RuntimeIdentifierTests.cs b/src/libraries/System.Runtime.InteropServices.RuntimeInformation/tests/RuntimeIdentifierTests.cs index e95954a459cfe1..f9070250697652 100644 --- a/src/libraries/System.Runtime.InteropServices.RuntimeInformation/tests/RuntimeIdentifierTests.cs +++ b/src/libraries/System.Runtime.InteropServices.RuntimeInformation/tests/RuntimeIdentifierTests.cs @@ -72,7 +72,7 @@ public void VerifyLinuxRid() string expectedOSName = File.ReadAllLines("/etc/os-release") .First(line => line.StartsWith("ID=", StringComparison.OrdinalIgnoreCase)) .Substring("ID=".Length) - .Trim(); + .Trim('\"', '\''); Assert.StartsWith(expectedOSName, RuntimeInformation.RuntimeIdentifier, StringComparison.OrdinalIgnoreCase); }