From 70774217a9e8e1f09ad1c97d0e37de00a6f7b2ea Mon Sep 17 00:00:00 2001 From: Aleksey Kliger Date: Fri, 24 Sep 2021 16:29:00 -0400 Subject: [PATCH 1/3] [tests] Correctly detect the Mono interpreter Checking for MONO_ENV_OPTIONS is not reliable for the mobile test runners because they use the embedding API to enable the interpreter, rather than setting an environment option. Instead detect the interpreter by checking the values of the IsDynamicCodeSupported and IsDynamicCodeCompiled runtime features. --- .../tests/TestUtilities/System/PlatformDetection.cs | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs b/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs index fbd5df9afdde75..d870740a8a343a 100644 --- a/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs +++ b/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs @@ -464,17 +464,7 @@ private static bool GetTls13Support() return false; } - private static bool GetIsRunningOnMonoInterpreter() - { -#if NETCOREAPP - if (IsBrowser) - return RuntimeFeature.IsDynamicCodeSupported; -#endif - // This is a temporary solution because mono does not support interpreter detection - // within the runtime. - var val = Environment.GetEnvironmentVariable("MONO_ENV_OPTIONS"); - return (val != null && val.Contains("--interpreter")); - } + private static bool GetIsRunningOnMonoInterpreter() => IsMonoRuntime && RuntimeFeature.IsDynamicCodeSupported && !RuntimeFeature.IsDynamicCodeCompiled; private static bool GetIsBrowserDomSupported() { From f267a8a72a163a8db574113217b788fb873bac50 Mon Sep 17 00:00:00 2001 From: Aleksey Kliger Date: Fri, 24 Sep 2021 16:30:28 -0400 Subject: [PATCH 2/3] [tests] Run System.Threading.Tasks.Dataflow.Tests on Apple platforms --- src/libraries/tests.proj | 1 - 1 file changed, 1 deletion(-) diff --git a/src/libraries/tests.proj b/src/libraries/tests.proj index 3288e59a9e1b5f..c4f5c48734ebf5 100644 --- a/src/libraries/tests.proj +++ b/src/libraries/tests.proj @@ -170,7 +170,6 @@ - From c0fd8a3e04907dd8d62687b905bc80e915ab45a0 Mon Sep 17 00:00:00 2001 From: Aleksey Kliger Date: Fri, 24 Sep 2021 17:49:56 -0400 Subject: [PATCH 3/3] Only check RuntimeFeature on netcoreapp. Otherwise return false these tests are not running on mono if they're running on .NET Framework --- .../tests/TestUtilities/System/PlatformDetection.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs b/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs index d870740a8a343a..77496e80d24c7c 100644 --- a/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs +++ b/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs @@ -464,7 +464,14 @@ private static bool GetTls13Support() return false; } - private static bool GetIsRunningOnMonoInterpreter() => IsMonoRuntime && RuntimeFeature.IsDynamicCodeSupported && !RuntimeFeature.IsDynamicCodeCompiled; + private static bool GetIsRunningOnMonoInterpreter() + { +#if NETCOREAPP + return IsMonoRuntime && RuntimeFeature.IsDynamicCodeSupported && !RuntimeFeature.IsDynamicCodeCompiled; +#else + return false; +#endif + } private static bool GetIsBrowserDomSupported() {