Skip to content

Commit

Permalink
Enable RuntimeIdentifierTests (#34595)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
eerhardt committed Apr 7, 2020
1 parent 39cde70 commit f8d38f4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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();
Expand Down Expand Up @@ -63,33 +61,29 @@ 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")
.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);
Expand Down

0 comments on commit f8d38f4

Please sign in to comment.