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 @@ - + 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..3be95646139cf3 100644 --- a/src/tests/build.proj +++ b/src/tests/build.proj @@ -114,8 +114,8 @@ - - + + 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())