Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix PlatformUtilities methods #1209

Merged
merged 3 commits into from
Sep 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions src/MICore/PlatformUtilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,19 @@ private static RuntimePlatform GetRuntimePlatform()

private static RuntimePlatform CalculateRuntimePlatform()
{
switch (Environment.OSVersion.Platform)
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
case PlatformID.Win32NT:
return RuntimePlatform.Windows;
case PlatformID.Unix:
return RuntimePlatform.Unix;
case PlatformID.MacOSX:
return RuntimePlatform.MacOSX;
default:
return RuntimePlatform.Unknown;
return RuntimePlatform.Windows;
}
else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
return RuntimePlatform.MacOSX;
}
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
{
return RuntimePlatform.Unix;
}
return RuntimePlatform.Unknown;
}


Expand Down
9 changes: 6 additions & 3 deletions test/CppTests/Tests/EnvironmentTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ public void EnvironmentVariablesBasic(ITestSettings settings)
[DependsOnTest(nameof(CompileKitchenSinkForEnvironmentTests))]
[RequiresTestSettings]
// Need to support 'runInTerminal' request.
[UnsupportedDebugger(SupportedDebugger.VsDbg, SupportedArchitecture.x86 | SupportedArchitecture.x64)]
// Re-enable lldb for test machines
[UnsupportedDebugger(SupportedDebugger.VsDbg | SupportedDebugger.Lldb, SupportedArchitecture.x86 | SupportedArchitecture.x64)]
public void EnvironmentVariablesBasicNewTerminal(ITestSettings settings)
{
this.TestPurpose("Tests basic operation of environment variables using a new terminal window");
Expand All @@ -72,7 +73,8 @@ public void EnvironmentVariablesUndefined(ITestSettings settings)
[DependsOnTest(nameof(CompileKitchenSinkForEnvironmentTests))]
[RequiresTestSettings]
// Need to support 'runInTerminal' request.
[UnsupportedDebugger(SupportedDebugger.VsDbg, SupportedArchitecture.x86 | SupportedArchitecture.x64)]
// Re-enable lldb for test machines
[UnsupportedDebugger(SupportedDebugger.VsDbg | SupportedDebugger.Lldb, SupportedArchitecture.x86 | SupportedArchitecture.x64)]
public void EnvironmentVariablesUndefinedNewTerminal(ITestSettings settings)
{
this.TestPurpose("Tests environment variables that are undefined using a new terminal window");
Expand Down Expand Up @@ -136,7 +138,8 @@ public void EnvironmentVariablesSpaces(ITestSettings settings)
[DependsOnTest(nameof(CompileKitchenSinkForEnvironmentTests))]
[RequiresTestSettings]
// Need to support 'runInTerminal' request.
[UnsupportedDebugger(SupportedDebugger.VsDbg, SupportedArchitecture.x86 | SupportedArchitecture.x64)]
// darwin-debug does not support spaces in environment variables
[UnsupportedDebugger(SupportedDebugger.VsDbg | SupportedDebugger.Lldb, SupportedArchitecture.x86 | SupportedArchitecture.x64)]
public void EnvironmentVariablesSpacesNewTerminal(ITestSettings settings)
{
this.TestPurpose("Tests environment variables that include a space in a new terminal window");
Expand Down