From c13b0a6e211d2dfa40f45a9482ffc425a9ab78d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20K=C3=B6plinger?= Date: Mon, 15 May 2023 20:47:44 +0200 Subject: [PATCH 1/6] Disable DllImportSearchPathsTest and StartupHookTests on mobile Also try to fix the StartupHookTests on LLVM FullAOT by making sure we also AOT dlls in subdirectories. --- .../DllImportSearchPaths/DllImportSearchPathsTest.cs | 8 +++++++- src/tests/Loader/StartupHooks/StartupHookTests.cs | 10 +++++++++- src/tests/build.proj | 2 +- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/tests/Interop/DllImportSearchPaths/DllImportSearchPathsTest.cs b/src/tests/Interop/DllImportSearchPaths/DllImportSearchPathsTest.cs index 31e69aeab90f72..d3837adbab4a70 100644 --- a/src/tests/Interop/DllImportSearchPaths/DllImportSearchPathsTest.cs +++ b/src/tests/Interop/DllImportSearchPaths/DllImportSearchPathsTest.cs @@ -19,7 +19,13 @@ public static void AssemblyDirectory_NotFound() } public static bool CanLoadAssemblyInSubdirectory => - !TestLibrary.Utilities.IsNativeAot && !TestLibrary.PlatformDetection.IsMonoLLVMFULLAOT; + !TestLibrary.Utilities.IsNativeAot && + !TestLibrary.PlatformDetection.IsMonoLLVMFULLAOT && + !OperatingSystem.IsAndroid() && + !OperatingSystem.IsIOS() && + !OperatingSystem.IsTvOS() && + !OperatingSystem.IsBrowser() && + !OperatingSystem.IsWasi(); [ConditionalFact(nameof(CanLoadAssemblyInSubdirectory))] public static void AssemblyDirectory_Found() diff --git a/src/tests/Loader/StartupHooks/StartupHookTests.cs b/src/tests/Loader/StartupHooks/StartupHookTests.cs index 2f188bd43e188f..9bab54da74b162 100644 --- a/src/tests/Loader/StartupHooks/StartupHookTests.cs +++ b/src/tests/Loader/StartupHooks/StartupHookTests.cs @@ -16,7 +16,15 @@ public unsafe class StartupHookTests private static delegate* ProcessStartupHooks = (delegate*)s_startupHookProvider.GetMethod("ProcessStartupHooks", BindingFlags.NonPublic | BindingFlags.Static).MethodHandle.GetFunctionPointer(); - public static bool IsSupported = ((delegate*)s_startupHookProvider.GetProperty(nameof(IsSupported), BindingFlags.NonPublic | BindingFlags.Static).GetMethod.MethodHandle.GetFunctionPointer())(); + private static bool IsUnsupportedPlatform = + // these platforms need special setup for startup hooks + OperatingSystem.IsAndroid() || + OperatingSystem.IsIOS() || + OperatingSystem.IsTvOS() || + OperatingSystem.IsBrowser() || + OperatingSystem.IsWasi(); + + public static bool IsSupported = !IsUnsupportedPlatform && ((delegate*)s_startupHookProvider.GetProperty(nameof(IsSupported), BindingFlags.NonPublic | BindingFlags.Static).GetMethod.MethodHandle.GetFunctionPointer())(); [Fact] public static void ValidHookName() diff --git a/src/tests/build.proj b/src/tests/build.proj index 3a8a0d3abcb564..175e4750b98b89 100644 --- a/src/tests/build.proj +++ b/src/tests/build.proj @@ -114,7 +114,7 @@ - + From 52662957db0f20d3bf84ee3d85051ac28413b9f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20K=C3=B6plinger?= Date: Tue, 16 May 2023 15:30:45 +0200 Subject: [PATCH 2/6] Ensure infinite loop is exited in NativeRuntimeEventSourceTest This could be a problem once we run the test in-proc. --- .../runtimeeventsource/NativeRuntimeEventSourceTest.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/tests/tracing/runtimeeventsource/NativeRuntimeEventSourceTest.cs b/src/tests/tracing/runtimeeventsource/NativeRuntimeEventSourceTest.cs index 4f2c98545f5ea3..48bd6183e3a5b2 100644 --- a/src/tests/tracing/runtimeeventsource/NativeRuntimeEventSourceTest.cs +++ b/src/tests/tracing/runtimeeventsource/NativeRuntimeEventSourceTest.cs @@ -40,10 +40,12 @@ private static int Main() using (Listener listener = new()) { + CancellationTokenSource cts = new(); + // Trigger the allocator task. Task.Run(() => { - while (true) + while (!cts.IsCancellationRequested) { for (int i = 0; i < 1000; i++) { @@ -75,6 +77,8 @@ private static int Main() } } + cts.Cancel(); + Assert2.True("listener.EventCount > 0", listener.EventCount > 0); if (OperatingSystem.IsWindows()) From 71ac9193681375739d9aaeef26c1fee04486e308 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20K=C3=B6plinger?= Date: Wed, 17 May 2023 12:51:42 +0200 Subject: [PATCH 3/6] Fix version of Microsoft.CodeAnalysis.Compilers in external.csproj It needs to match with what the rest of the repo is using. --- .../XUnitWrapperGenerator/XUnitWrapperGenerator.csproj | 6 +++--- src/tests/Common/external/external.csproj | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/tests/Common/XUnitWrapperGenerator/XUnitWrapperGenerator.csproj b/src/tests/Common/XUnitWrapperGenerator/XUnitWrapperGenerator.csproj index de137ac35ca40a..5b0ca2563a7746 100644 --- a/src/tests/Common/XUnitWrapperGenerator/XUnitWrapperGenerator.csproj +++ b/src/tests/Common/XUnitWrapperGenerator/XUnitWrapperGenerator.csproj @@ -8,9 +8,9 @@ - - - + + + diff --git a/src/tests/Common/external/external.csproj b/src/tests/Common/external/external.csproj index bc749d9d6e5a35..d2541b5ae4835b 100644 --- a/src/tests/Common/external/external.csproj +++ b/src/tests/Common/external/external.csproj @@ -64,7 +64,7 @@ - + From c5036d8731ca94e3e2744ff2614ebd6e8f381d1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20K=C3=B6plinger?= Date: Wed, 17 May 2023 14:56:16 +0200 Subject: [PATCH 4/6] Remove Microsoft.CodeAnalysis completely --- src/tests/Common/external/external.csproj | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/tests/Common/external/external.csproj b/src/tests/Common/external/external.csproj index d2541b5ae4835b..17e1947e029d24 100644 --- a/src/tests/Common/external/external.csproj +++ b/src/tests/Common/external/external.csproj @@ -56,15 +56,9 @@ - - - - - - From 9417d238880846aab24e47d04470438ec7b02f23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20K=C3=B6plinger?= Date: Wed, 17 May 2023 15:35:50 +0200 Subject: [PATCH 5/6] Revert "Remove Microsoft.CodeAnalysis completely" This reverts commit c5036d8731ca94e3e2744ff2614ebd6e8f381d1e. --- src/tests/Common/external/external.csproj | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/tests/Common/external/external.csproj b/src/tests/Common/external/external.csproj index 17e1947e029d24..d2541b5ae4835b 100644 --- a/src/tests/Common/external/external.csproj +++ b/src/tests/Common/external/external.csproj @@ -56,9 +56,15 @@ + + + + + + From 324f21b2665cdab3639487d5e5a3fd63e1e367c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20K=C3=B6plinger?= Date: Wed, 17 May 2023 15:46:42 +0200 Subject: [PATCH 6/6] Don't AOT Microsoft.CodeAnalysis.VisualBasic.dll, it fails for some reason --- src/tests/build.proj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tests/build.proj b/src/tests/build.proj index 175e4750b98b89..3be95646139cf3 100644 --- a/src/tests/build.proj +++ b/src/tests/build.proj @@ -115,7 +115,7 @@ - +