From f8d38f45e1a109a8f6895a4a6f82c4d00108e1d4 Mon Sep 17 00:00:00 2001 From: Eric Erhardt Date: Tue, 7 Apr 2020 13:57:31 -0500 Subject: [PATCH] Enable RuntimeIdentifierTests (#34595) * Enable RuntimeIdentifierTests Now that we have an updated test host, we can enable the RuntimeInformation.RuntimeIdentifier tests that are disabled. Fix #26780 * Trim quotes from ID in /etc/os-release --- .../tests/DescriptionNameTests.cs | 4 ++-- .../tests/RuntimeIdentifierTests.cs | 8 +------- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/src/libraries/System.Runtime.InteropServices.RuntimeInformation/tests/DescriptionNameTests.cs b/src/libraries/System.Runtime.InteropServices.RuntimeInformation/tests/DescriptionNameTests.cs index bbc28bc..d65f92e 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 @@ namespace System.Runtime.InteropServices.RuntimeInformationTests 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 ac7a0b7..f9070250 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 @@ namespace System.Runtime.InteropServices.RuntimeInformationTests } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/26780")] // need a new testhost public void VerifyEnvironmentVariable() { RemoteInvokeOptions options = new RemoteInvokeOptions(); @@ -63,33 +61,29 @@ namespace System.Runtime.InteropServices.RuntimeInformationTests } [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") .First(line => line.StartsWith("ID=", StringComparison.OrdinalIgnoreCase)) .Substring("ID=".Length) - .Trim(); + .Trim('\"', '\''); Assert.StartsWith(expectedOSName, RuntimeInformation.RuntimeIdentifier, StringComparison.OrdinalIgnoreCase); } [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); -- 2.7.4