diff --git a/eng/testing/tests.ioslike.targets b/eng/testing/tests.ioslike.targets index 35a39ab6a120e5..858bd37011cdd0 100644 --- a/eng/testing/tests.ioslike.targets +++ b/eng/testing/tests.ioslike.targets @@ -24,6 +24,10 @@ + + + + helix helix diff --git a/src/libraries/System.Runtime/tests/System.Reflection.Tests/AssemblyTests.cs b/src/libraries/System.Runtime/tests/System.Reflection.Tests/AssemblyTests.cs index ff9a5d3a1613a9..fdaffdf8383d3d 100644 --- a/src/libraries/System.Runtime/tests/System.Reflection.Tests/AssemblyTests.cs +++ b/src/libraries/System.Runtime/tests/System.Reflection.Tests/AssemblyTests.cs @@ -158,7 +158,7 @@ public void GetEntryAssembly() { correct = assembly.IndexOf("WasmTestRunner", StringComparison.OrdinalIgnoreCase) != -1; } - else if (PlatformDetection.IsNativeAot || PlatformDetection.IsReadyToRunCompiled) + else if (PlatformDetection.IsNativeAot || (PlatformDetection.IsReadyToRunCompiled && !PlatformDetection.IsAppleMobile)) { // The single file test runner is not 'xunit.console'. correct = assembly.IndexOf("System.Reflection.Tests", StringComparison.OrdinalIgnoreCase) != -1; diff --git a/src/tasks/AndroidAppBuilder/Templates/monodroid-coreclr.c b/src/tasks/AndroidAppBuilder/Templates/monodroid-coreclr.c index 19d11ad3fb62fb..50b57ea630e47a 100644 --- a/src/tasks/AndroidAppBuilder/Templates/monodroid-coreclr.c +++ b/src/tasks/AndroidAppBuilder/Templates/monodroid-coreclr.c @@ -277,27 +277,26 @@ Java_net_dot_MonoRunner_execEntryPoint (JNIEnv* env, jobject thiz, jstring j_ent } int args_len = (*env)->GetArrayLength (env, j_args); - int managed_argc = args_len + 1; - const char** managed_argv = (const char**)malloc (managed_argc * sizeof(char*)); + // Managed Main receives only the app arguments, not the bundle path. + const char** managed_argv = (const char**)malloc ((args_len > 0 ? args_len : 1) * sizeof(char*)); if (managed_argv == NULL) { LOG_ERROR("Failed to allocate memory for managed_argv"); return -1; } - managed_argv[0] = g_bundle_path; for (int i = 0; i < args_len; ++i) { jstring j_arg = (*env)->GetObjectArrayElement(env, j_args, i); - managed_argv[i + 1] = (char*)((*env)->GetStringUTFChars(env, j_arg, NULL)); + managed_argv[i] = (char*)((*env)->GetStringUTFChars(env, j_arg, NULL)); } - int rv = mono_droid_execute_assembly (g_executable_path, g_coreclr_handle, g_coreclr_domainId, managed_argc, managed_argv); + int rv = mono_droid_execute_assembly (g_executable_path, g_coreclr_handle, g_coreclr_domainId, args_len, managed_argv); for (int i = 0; i < args_len; ++i) { jstring j_arg = (*env)->GetObjectArrayElement(env, j_args, i); - (*env)->ReleaseStringUTFChars(env, j_arg, managed_argv[i + 1]); + (*env)->ReleaseStringUTFChars(env, j_arg, managed_argv[i]); } free(managed_argv); diff --git a/src/tasks/AppleAppBuilder/Templates/runtime-coreclr.m b/src/tasks/AppleAppBuilder/Templates/runtime-coreclr.m index a651718b567b69..4c4c35b10a111f 100644 --- a/src/tasks/AppleAppBuilder/Templates/runtime-coreclr.m +++ b/src/tasks/AppleAppBuilder/Templates/runtime-coreclr.m @@ -216,7 +216,8 @@ bool get_native_code_data(const struct host_runtime_contract_native_code_context &coreclr_handle, &coreclr_domainId); assert (res == 0); - coreclr_execute_assembly (coreclr_handle, coreclr_domainId, argi, managed_argv, path, &res); + // managed_argv[0] is the executable path; managed Main expects only the arguments after it. + coreclr_execute_assembly (coreclr_handle, coreclr_domainId, argi - 1, managed_argv + 1, path, &res); // Print this so apps parsing logs can detect when we exited os_log_info (OS_LOG_DEFAULT, EXIT_CODE_TAG ": %d", res); diff --git a/src/tests/Common/CoreCLRTestLibrary/CoreClrConfigurationDetection.cs b/src/tests/Common/CoreCLRTestLibrary/CoreClrConfigurationDetection.cs index e49c9d4dc758ca..81bf98ee8ca577 100644 --- a/src/tests/Common/CoreCLRTestLibrary/CoreClrConfigurationDetection.cs +++ b/src/tests/Common/CoreCLRTestLibrary/CoreClrConfigurationDetection.cs @@ -5,6 +5,7 @@ using System; using System.Globalization; using System.Reflection; +using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Security; using System.Text; @@ -27,8 +28,8 @@ public static bool IsCoreClrInterpreter { get { - // WASM-TODO: update when codegen is in place - if (PlatformDetection.IsWasm) + // Without a JIT (e.g. WebAssembly, Apple mobile), code that isn't precompiled runs in the interpreter. + if (RuntimeFeature.IsDynamicCodeSupported && !RuntimeFeature.IsDynamicCodeCompiled) return true; if (!string.IsNullOrWhiteSpace(GetEnvironmentVariableValue("Interpreter", ""))) return true; diff --git a/src/tests/Common/XUnitWrapperGenerator/RuntimeTestModes.cs b/src/tests/Common/XUnitWrapperGenerator/RuntimeTestModes.cs index d2c3edc20e17e6..ba82ef093d113d 100644 --- a/src/tests/Common/XUnitWrapperGenerator/RuntimeTestModes.cs +++ b/src/tests/Common/XUnitWrapperGenerator/RuntimeTestModes.cs @@ -44,6 +44,6 @@ public enum RuntimeTestModes HeapVerify = 1 << 9, // DOTNET_HeapVerify (or COMPlus_HeapVerify) is set. - InterpreterActive = 1 << 10, // DOTNET_Interpreter != "" or DOTNET_InterpMode != 0 + InterpreterActive = 1 << 10, // DOTNET_Interpreter != "", DOTNET_InterpMode != 0, or no JIT (some code may be interpreted) } } diff --git a/src/tests/Common/mergedrunnermobile.targets b/src/tests/Common/mergedrunnermobile.targets index 4ee3dcf2246b7b..b79853443f09e7 100644 --- a/src/tests/Common/mergedrunnermobile.targets +++ b/src/tests/Common/mergedrunnermobile.targets @@ -31,6 +31,20 @@ + + + + + + + + + + diff --git a/src/tests/Common/test_dependencies_fs/test_dependencies.fsproj b/src/tests/Common/test_dependencies_fs/test_dependencies.fsproj index d5db8298bb7d74..2bd9290e4031be 100644 --- a/src/tests/Common/test_dependencies_fs/test_dependencies.fsproj +++ b/src/tests/Common/test_dependencies_fs/test_dependencies.fsproj @@ -16,4 +16,11 @@ + + + + + + + diff --git a/src/tests/GC/API/GC/GetGeneration.cs b/src/tests/GC/API/GC/GetGeneration.cs index cd2ebd6d5b0357..245d8b36b2b488 100644 --- a/src/tests/GC/API/GC/GetGeneration.cs +++ b/src/tests/GC/API/GC/GetGeneration.cs @@ -119,10 +119,13 @@ public bool RunTests() + // Interpreted frames report their locals as pinned, causing generation demotion that this test does not expect. + public static bool IsTestCodeCompiled => !Utilities.IsCoreClrInterpreter || PlatformDetection.IsReadyToRunCompiled; + [ActiveIssue("needs triage", TestRuntimes.Mono)] [SkipOnCoreClr("This test is not compatible with GC stress.", RuntimeTestModes.AnyGCStress)] - [SkipOnCoreClr("Interpreter reports locals as pinned, causing generation demotion that this test does not expect.", RuntimeTestModes.InterpreterActive)] - [Fact] + [SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.Wasi, "WebAssembly reports stack roots as pinned, causing generation demotion that this test does not expect. See https://github.com/dotnet/runtime/issues/134803.")] + [ConditionalFact(typeof(GetGenerationTest), nameof(IsTestCodeCompiled))] public static int TestEntryPoint() { GetGenerationTest t = new GetGenerationTest(); diff --git a/src/tests/JIT/Directed/tailcall/mutual_recursion.fs b/src/tests/JIT/Directed/tailcall/mutual_recursion.fs index 413f79b8c1e2c8..172ceae56f0515 100644 --- a/src/tests/JIT/Directed/tailcall/mutual_recursion.fs +++ b/src/tests/JIT/Directed/tailcall/mutual_recursion.fs @@ -559,6 +559,7 @@ type Driver() = [] [] [, [| "IsWasmReadyToRun" |])>] +[, [| "IsAppleMobile"; "IsCoreCLR" |])>] [, [| "IsNotNativeAot" |])>] let main () = let driver = Driver() diff --git a/src/tests/JIT/Regression/CLR-x86-JIT/V2.0-Beta2/b425314/b425314.cs b/src/tests/JIT/Regression/CLR-x86-JIT/V2.0-Beta2/b425314/b425314.cs index ea19f3e4652644..d73e36bf302e16 100644 --- a/src/tests/JIT/Regression/CLR-x86-JIT/V2.0-Beta2/b425314/b425314.cs +++ b/src/tests/JIT/Regression/CLR-x86-JIT/V2.0-Beta2/b425314/b425314.cs @@ -936,6 +936,7 @@ internal static void RecordFailure(Exception ex) [Fact] [ActiveIssue("https://github.com/dotnet/runtime/issues/41472", typeof(PlatformDetection), nameof(PlatformDetection.IsNotMultithreadingSupported))] + [ActiveIssue("https://github.com/dotnet/runtime/issues/134770", typeof(PlatformDetection), nameof(PlatformDetection.IsAppleMobile), nameof(PlatformDetection.IsCoreCLR))] [SkipOnCoreClr("This test takes too long and internally times out under GCStress/heap verify. It is not fundamentally incompatible if stress testing is fast enough.", RuntimeTestModes.AnyGCStress | RuntimeTestModes.HeapVerify)] public static int TestEntryPoint() { diff --git a/src/tests/JIT/Regression/CLR-x86-JIT/V2.0-Beta2/b426654/b426654.il b/src/tests/JIT/Regression/CLR-x86-JIT/V2.0-Beta2/b426654/b426654.il index 39a46cf0f39d5c..866dd6d2e811c0 100644 --- a/src/tests/JIT/Regression/CLR-x86-JIT/V2.0-Beta2/b426654/b426654.il +++ b/src/tests/JIT/Regression/CLR-x86-JIT/V2.0-Beta2/b426654/b426654.il @@ -217,6 +217,11 @@ string('This test is too slow under GCStress=3. See https://github.com/dotnet/runtime/issues/50615.') int32(0xC0) // AnyGCStress } + .custom instance void [Microsoft.DotNet.XUnitExtensions]Xunit.ActiveIssueAttribute::.ctor(string, class [System.Runtime]System.Type, string[]) = { + string('https://github.com/dotnet/runtime/issues/134770') + type([TestLibrary]TestLibrary.PlatformDetection) + string[2] ('IsAppleMobile' 'IsCoreCLR') + } .entrypoint .maxstack 5 .locals init (class cs1 V_0, diff --git a/src/tests/JIT/Regression_o_3/Runtime_90219.cs b/src/tests/JIT/Regression_o_3/Runtime_90219.cs index 84ab3a70db0e8e..33bde17ad44925 100644 --- a/src/tests/JIT/Regression_o_3/Runtime_90219.cs +++ b/src/tests/JIT/Regression_o_3/Runtime_90219.cs @@ -37,10 +37,9 @@ public class Runtime_90219 public static byte Result; [ActiveIssue("https://github.com/dotnet/runtimelab/issues/155: Assembly.Load", typeof(Utilities), nameof(Utilities.IsNativeAot))] - [Fact] + [ConditionalFact(typeof(Utilities), nameof(Utilities.HasAssemblyFiles))] [ActiveIssue("https://github.com/dotnet/runtimelab/issues/155: Assembly.Load", typeof(TestLibrary.Utilities), nameof(TestLibrary.Utilities.IsNativeAot))] [ActiveIssue("https://github.com/dotnet/runtime/issues/90374", TestRuntimes.Mono)] - [SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.Wasi | TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst, "Loads assembly from file.")] public static int TestEntryPoint() { CollectibleALC alc = new CollectibleALC();