From: Stephen Toub Date: Wed, 19 Jun 2019 02:25:24 +0000 (-0400) Subject: Disable InvokeOnEventsThreadRunsAsynchronously test on netfx (dotnet/corefx#38662) X-Git-Tag: submit/tizen/20210909.063632~11031^2~1250 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=097778820316b8e606293aa4c6c942875ed7c909;p=platform%2Fupstream%2Fdotnet%2Fruntime.git Disable InvokeOnEventsThreadRunsAsynchronously test on netfx (dotnet/corefx#38662) And avoid the whole suite from hanging by changing an ~3hr timeout to a 30s timeout. Commit migrated from https://github.com/dotnet/corefx/commit/818465ad8624c0231262dba6e7c3a0fc4ca42a7a --- diff --git a/src/libraries/Microsoft.Win32.SystemEvents/tests/SystemEvents.InvokeOnEventsThread.cs b/src/libraries/Microsoft.Win32.SystemEvents/tests/SystemEvents.InvokeOnEventsThread.cs index 82e7087..38bc53f 100644 --- a/src/libraries/Microsoft.Win32.SystemEvents/tests/SystemEvents.InvokeOnEventsThread.cs +++ b/src/libraries/Microsoft.Win32.SystemEvents/tests/SystemEvents.InvokeOnEventsThread.cs @@ -14,12 +14,13 @@ namespace Microsoft.Win32.SystemEventsTests { public class InvokeOnEventsThreadTests : SystemEventsTest { + [ActiveIssue(38661, TargetFrameworkMonikers.NetFramework)] [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsNanoServer))] public void InvokeOnEventsThreadRunsAsynchronously() { var invoked = new AutoResetEvent(false); SystemEvents.InvokeOnEventsThread(new Action(() => invoked.Set())); - Assert.True(invoked.WaitOne(PostMessageWait * SystemEventsTest.ExpectedEventMultiplier)); + Assert.True(invoked.WaitOne(PostMessageWait)); } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsNanoServer))] @@ -44,7 +45,7 @@ namespace Microsoft.Win32.SystemEventsTests actualThreadId = Thread.CurrentThread.ManagedThreadId; invoked.Set(); })); - Assert.True(invoked.WaitOne(PostMessageWait * SystemEventsTest.ExpectedEventMultiplier)); + Assert.True(invoked.WaitOne(PostMessageWait)); Assert.Equal(expectedThreadId, actualThreadId); } finally diff --git a/src/libraries/Microsoft.Win32.SystemEvents/tests/SystemEventsTest.cs b/src/libraries/Microsoft.Win32.SystemEvents/tests/SystemEventsTest.cs index f3df79a..c9c9d60 100644 --- a/src/libraries/Microsoft.Win32.SystemEvents/tests/SystemEventsTest.cs +++ b/src/libraries/Microsoft.Win32.SystemEvents/tests/SystemEventsTest.cs @@ -13,7 +13,7 @@ namespace Microsoft.Win32.SystemEventsTests { IntPtr s_hwnd = IntPtr.Zero; - public const int PostMessageWait = 10000; + public const int PostMessageWait = 30_000; public const int ExpectedEventMultiplier = 1000; public const int UnexpectedEventMultiplier = 10; @@ -56,7 +56,7 @@ namespace Microsoft.Win32.SystemEventsTests { // on an STA thread the HWND is created in the same thread synchronously when attaching to an event handler // if we're on an MTA thread, a new thread is created to handle events and that thread creates the window, wait for it to complete. - Assert.True(windowReadyEvent.WaitOne(PostMessageWait * ExpectedEventMultiplier)); + Assert.True(windowReadyEvent.WaitOne(PostMessageWait)); } } }