diff --git a/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs b/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs index 3a32912136e992..8bd3953dc82d12 100644 --- a/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs +++ b/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs @@ -29,6 +29,8 @@ public static partial class PlatformDetection public static bool IsNetCore => Environment.Version.Major >= 5 || RuntimeInformation.FrameworkDescription.StartsWith(".NET Core", StringComparison.OrdinalIgnoreCase); public static bool IsMonoRuntime => Type.GetType("Mono.RuntimeStructs") != null; public static bool IsNotMonoRuntime => !IsMonoRuntime; + public static bool IsInterpreter => IsMonoInterpreter || IsCoreClrInterpreter; + public static bool IsNotInterpreter => !IsInterpreter; public static bool IsMonoInterpreter => GetIsRunningOnMonoInterpreter(); public static bool IsNotMonoInterpreter => !IsMonoInterpreter; public static bool IsMonoAOT => Environment.GetEnvironmentVariable("MONO_AOT_MODE") == "aot"; diff --git a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Runtime/JitInfoTests.cs b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Runtime/JitInfoTests.cs index e4243b4ab4d422..a336c0ff3bbc89 100644 --- a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Runtime/JitInfoTests.cs +++ b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Runtime/JitInfoTests.cs @@ -65,16 +65,26 @@ public void JitInfoIsPopulated() Assert.True(beforeCompiledMethodCount > 0, $"Compiled method count not greater than 0! ({beforeCompiledMethodCount})"); } - if (PlatformDetection.IsMonoInterpreter) + // + // Mono does not include compilation of IL into interpreter byte code in these counters + // + if (PlatformDetection.IsMonoInterpreter || PlatformDetection.IsBrowser) { - // Before and after will most likely be the same with the interpreter + // Before and after can be same in browser because of low precision timers Assert.True(afterCompilationTime >= beforeCompilationTime, $"CompilationTime: after not greater than before! (after: {afterCompilationTime}, before: {beforeCompilationTime})"); + } + else + { + Assert.True(afterCompilationTime > beforeCompilationTime, $"CompilationTime: after not greater than before! (after: {afterCompilationTime}, before: {beforeCompilationTime})"); + } + + if (PlatformDetection.IsMonoInterpreter) + { Assert.True(afterCompiledILBytes >= beforeCompiledILBytes, $"Compiled IL bytes: after not greater than before! (after: {afterCompiledILBytes}, before: {beforeCompiledILBytes})"); Assert.True(afterCompiledMethodCount >= beforeCompiledMethodCount, $"Compiled method count: after not greater than before! (after: {afterCompiledMethodCount}, before: {beforeCompiledMethodCount})"); } else { - Assert.True(afterCompilationTime > beforeCompilationTime, $"CompilationTime: after not greater than before! (after: {afterCompilationTime}, before: {beforeCompilationTime})"); Assert.True(afterCompiledILBytes > beforeCompiledILBytes, $"Compiled IL bytes: after not greater than before! (after: {afterCompiledILBytes}, before: {beforeCompiledILBytes})"); Assert.True(afterCompiledMethodCount > beforeCompiledMethodCount, $"Compiled method count: after not greater than before! (after: {afterCompiledMethodCount}, before: {beforeCompiledMethodCount})"); } diff --git a/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/AssemblyInfo.cs b/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/AssemblyInfo.cs index 68af8051230a6d..fd1a3951000c4a 100644 --- a/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/AssemblyInfo.cs +++ b/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/AssemblyInfo.cs @@ -4,4 +4,4 @@ using System; using Xunit; -[assembly: ActiveIssue("Interpreter with debug runtime can be very slow", typeof(PlatformDetection), nameof(PlatformDetection.IsMonoInterpreter), nameof(PlatformDetection.IsDebugRuntime))] +[assembly: ActiveIssue("Interpreter with debug runtime can be very slow", typeof(PlatformDetection), nameof(PlatformDetection.IsInterpreter), nameof(PlatformDetection.IsDebugRuntime))] diff --git a/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Utf8JsonReaderTests.cs b/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Utf8JsonReaderTests.cs index 8e3f68618e3eb9..3ebe23682c443d 100644 --- a/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Utf8JsonReaderTests.cs +++ b/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Utf8JsonReaderTests.cs @@ -1649,7 +1649,7 @@ public static void TestPartialJsonReaderSlicesSpecialNumbers(TestCaseType type, [InlineData(512)] public static void TestDepth(int depth) { - if (PlatformDetection.IsMonoInterpreter && depth >= 256) + if (PlatformDetection.IsInterpreter && depth >= 256) { throw new SkipTestException("Takes very long to run on interpreter."); }