Skip to content
Open
2 changes: 2 additions & 0 deletions src/tests/Common/CoreCLRTestLibrary/PlatformDetection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ public static bool IsNonZeroLowerBoundArraySupported
public static bool IsExceptionInteropSupported => IsWindows && !Utilities.IsNativeAot && !Utilities.IsMonoRuntime && !Utilities.IsCoreClrInterpreter;

public static bool IsMonoRuntime => Type.GetType("Mono.RuntimeStructs") != null;
public static bool IsCoreCLR => !IsMonoRuntime && Utilities.IsNotNativeAot;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this how we treat CoreCLR vs NativeAOT in other places as well (that NativeAOT is not CoreCLR)? Or should we be more explicit in the naming?

public static bool IsNotCoreCLR => !IsCoreCLR;

static string _variant = Environment.GetEnvironmentVariable("DOTNET_RUNTIME_VARIANT");

Expand Down
6 changes: 5 additions & 1 deletion src/tests/GC/Coverage/271010.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@

public class Test_271010 {

[ActiveIssue("https://github.com/dotnet/runtime/issues/5933", TestRuntimes.CoreCLR)]
public static bool IsCoreClrOnNonBrowser =>
TestLibrary.PlatformDetection.IsCoreCLR &&
!TestLibrary.PlatformDetection.IsBrowser;

[ActiveIssue("https://github.com/dotnet/runtime/issues/5933", typeof(Test_271010), nameof(IsCoreClrOnNonBrowser))]
[Fact]
public static int TestEntryPoint() {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ private static uint ProblemWithInterferenceChecks(uint a)
}

[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/114250", TestPlatforms.Browser)]
[ActiveIssue("https://github.com/dotnet/runtime/issues/114250", typeof(TestLibrary.PlatformDetection), nameof(TestLibrary.PlatformDetection.IsBrowser), nameof(TestLibrary.PlatformDetection.IsMonoRuntime))]
public static void TestProblemWithThrowingLoads()
{
Assert.True(ProblemWithThrowingLoads(null));
Expand Down
3 changes: 2 additions & 1 deletion src/tests/JIT/Methodical/eh/interactions/switchinfinally.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ static Class1()
/// The main entry point for the application.
/// </summary>
[Fact]
[ActiveIssue("needs triage", TestPlatforms.Browser | TestPlatforms.Wasi | TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)]
[ActiveIssue("needs triage", TestPlatforms.Wasi | TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)]
[ActiveIssue("needs triage", typeof(TestLibrary.PlatformDetection), nameof(TestLibrary.PlatformDetection.IsBrowser), nameof(TestLibrary.PlatformDetection.IsMonoRuntime))]
public static int TestEntryPoint()
{
//Start recording
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6934,8 +6934,8 @@ static unsafe bool MemoryCompare(byte* left, byte* right, int byteCount)
return true;
}

[ActiveIssue("needs triage", TestPlatforms.Browser | TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)]
[ActiveIssue("needs triage", typeof(PlatformDetection), nameof(PlatformDetection.IsMonoInterpreter))]
[ActiveIssue("needs triage", typeof(PlatformDetection), nameof(PlatformDetection.IsBrowser), nameof(PlatformDetection.IsMonoRuntime))]
[ActiveIssue("needs triage", typeof(PlatformDetection), nameof(PlatformDetection.IsMonoInterpreter), nameof(PlatformDetection.IsMonoRuntime))]
[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/91923", typeof(PlatformDetection), nameof(PlatformDetection.IsAppleMobile))]
public static unsafe int TestEntryPoint()
Expand Down
10 changes: 8 additions & 2 deletions src/tests/JIT/Regression/JitBlue/Runtime_64125/Runtime_64125.tt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using TestLibrary;
using Xunit;

namespace Runtime_64125
{
Expand Down Expand Up @@ -67,7 +69,7 @@ namespace Runtime_64125
#>
}

class Program
public class Program
{
static unsafe void Init(byte* bytes, int byteCount)
{
Expand All @@ -87,7 +89,11 @@ namespace Runtime_64125
return true;
}

static unsafe int Main()
[ActiveIssue("needs triage", typeof(PlatformDetection), nameof(PlatformDetection.IsBrowser), nameof(PlatformDetection.IsMonoRuntime))]
[ActiveIssue("needs triage", typeof(PlatformDetection), nameof(PlatformDetection.IsMonoInterpreter), nameof(PlatformDetection.IsMonoRuntime))]
[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/91923", typeof(PlatformDetection), nameof(PlatformDetection.IsAppleMobile))]
public static unsafe int TestEntryPoint()
{
var anyLocation = new AnyLocation();

Expand Down
8 changes: 7 additions & 1 deletion src/tests/JIT/SIMD/Matrix4x4.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ public class Matrix4x4Test
private const int Pass = 100;
private const int Fail = -1;

public static bool IsInterpreterExceptCoreClrBrowser =>
TestLibrary.Utilities.IsCoreClrInterpreter &&
(!OperatingSystem.IsBrowser() ||
TestLibrary.Utilities.IsMonoRuntime ||
TestLibrary.Utilities.IsNativeAot);

public static int Matrix4x4CreateScaleCenterTest3()
{
int returnVal = Pass;
Expand All @@ -31,7 +37,7 @@ public static int Matrix4x4CreateScaleCenterTest3()
return returnVal;
}

[ActiveIssue("https://github.com/dotnet/runtime/issues/123104", typeof(TestLibrary.Utilities), nameof(TestLibrary.Utilities.IsCoreClrInterpreter))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/123104", typeof(Matrix4x4Test), nameof(IsInterpreterExceptCoreClrBrowser))]
[Fact]
public static int TestEntryPoint()
{
Expand Down
2 changes: 1 addition & 1 deletion src/tests/JIT/opt/Vectorization/StackallocBlkTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

public unsafe class StackallocTests
{
[ActiveIssue("https://github.com/dotnet/runtime/issues/84398", TestPlatforms.Windows, runtimes: TestRuntimes.Mono)]
[ActiveIssue("https://github.com/dotnet/runtime/issues/84398", typeof(PlatformDetection), nameof(PlatformDetection.IsNotCoreCLR))]
[Fact]
public static int TestEntryPoint()
{
Expand Down
9 changes: 6 additions & 3 deletions src/tests/baseservices/invalid_operations/Arrays.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ public class Arrays
{
private class TestClass { }

[ActiveIssue("Function mismatch", TestPlatforms.Browser | TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)]
[ActiveIssue("Function mismatch", TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm curious. do these also pass on apple in coreclr?

[ActiveIssue("Function mismatch", typeof(PlatformDetection), nameof(PlatformDetection.IsBrowser), nameof(PlatformDetection.IsMonoRuntime))]
[ActiveIssue("Doesn't compile with LLVM AOT.", typeof(PlatformDetection), nameof(PlatformDetection.IsMonoAnyAOT))]
[Fact]
public static void TypeMismatch_ArrayElement()
Expand All @@ -24,8 +25,9 @@ public static void TypeMismatch_ArrayElement()
Assert.IsType<ArrayTypeMismatchException>(e.InnerException);
}

[ActiveIssue("Function mismatch", TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)]
[ActiveIssue("Function mismatch", typeof(PlatformDetection), nameof(PlatformDetection.IsBrowser), nameof(PlatformDetection.IsMonoRuntime))]
[ActiveIssue("Doesn't compile with LLVM AOT.", typeof(PlatformDetection), nameof(PlatformDetection.IsMonoAnyAOT))]
[ActiveIssue("Function mismatch", TestPlatforms.Browser | TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)]
[Fact]
public static void TypeMismatch_MultidimensionalArrayElement()
{
Expand All @@ -36,8 +38,9 @@ public static void TypeMismatch_MultidimensionalArrayElement()
Assert.IsType<ArrayTypeMismatchException>(e.InnerException);
}

[ActiveIssue("Function mismatch", TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)]
[ActiveIssue("Function mismatch", typeof(PlatformDetection), nameof(PlatformDetection.IsBrowser), nameof(PlatformDetection.IsMonoRuntime))]
[ActiveIssue("Doesn't compile with LLVM AOT.", typeof(PlatformDetection), nameof(PlatformDetection.IsMonoAnyAOT))]
[ActiveIssue("Function mismatch", TestPlatforms.Browser | TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)]
[Fact]
public static void TypeMismatch_ClassElement()
{
Expand Down
9 changes: 6 additions & 3 deletions src/tests/baseservices/invalid_operations/ManagedPointers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@

public unsafe class ManagedPointers
{
[ActiveIssue("Function mismatch", TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)]
[ActiveIssue("Function mismatch", typeof(PlatformDetection), nameof(PlatformDetection.IsBrowser), nameof(PlatformDetection.IsMonoRuntime))]
[ActiveIssue("Doesn't compile with LLVM AOT.", typeof(PlatformDetection), nameof(PlatformDetection.IsMonoAnyAOT))]
[ActiveIssue("Function mismatch", TestPlatforms.Browser | TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)]
[Fact]
public static void Validate_BoxingHelpers_NullByRef()
{
Expand All @@ -31,8 +32,9 @@ public static void Validate_BoxingHelpers_NullByRef()
});
}

[ActiveIssue("Function mismatch", TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)]
[ActiveIssue("Function mismatch", typeof(PlatformDetection), nameof(PlatformDetection.IsBrowser), nameof(PlatformDetection.IsMonoRuntime))]
[ActiveIssue("Doesn't compile with LLVM AOT.", typeof(PlatformDetection), nameof(PlatformDetection.IsMonoAnyAOT))]
[ActiveIssue("Function mismatch", TestPlatforms.Browser | TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)]
[Fact]
[Xunit.SkipOnCoreClrAttribute("Depends on marshalled calli", RuntimeTestModes.InterpreterActive)]
public static void Validate_GeneratedILStubs_NullByRef()
Expand All @@ -58,8 +60,9 @@ public static void Validate_GeneratedILStubs_NullByRef()
static nint PassByRef(void* a) => (nint)a;
}

[ActiveIssue("Function mismatch", TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)]
[ActiveIssue("Function mismatch", typeof(PlatformDetection), nameof(PlatformDetection.IsBrowser), nameof(PlatformDetection.IsMonoRuntime))]
[ActiveIssue("Doesn't compile with LLVM AOT.", typeof(PlatformDetection), nameof(PlatformDetection.IsMonoAnyAOT))]
[ActiveIssue("Function mismatch", TestPlatforms.Browser | TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)]
[Fact]
public static void Validate_IntrinsicMethodsWithByRef_NullByRef()
{
Expand Down