Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[browser][MT] enable timer tests #94217

Merged
merged 3 commits into from
Nov 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ public static bool IsPrivilegedProcess

public static bool IsThreadingSupported => (!IsWasi && !IsBrowser) || IsWasmThreadingSupported;
public static bool IsWasmThreadingSupported => IsBrowser && IsEnvironmentVariableTrue("IsBrowserThreadingSupported");
public static bool IsNotWasmThreadingSupported => !IsWasmThreadingSupported;
pavelsavara marked this conversation as resolved.
Show resolved Hide resolved
public static bool IsBinaryFormatterSupported => IsNotMobile && !IsNativeAot;

public static bool IsStartingProcessesSupported => !IsiOS && !IstvOS;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ public static IEnumerable<object[]> TestCases()
yield return new object[] { new[] { 800, 600, 400, 200, 100 }, 5, 13, 9 };
}

[Theory]
[MemberData(nameof(TestCases))]
[ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWasmThreadingSupported))] // this test only makes sense with ST TimerQueue
public async Task TestTimers(int[] timeouts, int? expectedSetCounter, int? expectedSetCounterAfterCleanUp, int? expectedHitCount)
{
int wasCalled = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ public void Timer_Change_AfterDispose_Test()
}

[ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/91545", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))]
[InlineData(0)]
[InlineData(1)]
[InlineData(2)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ public void DisposeAsync_SignalsImmediatelyWhenTaskNotRunning()
}

[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/91545", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))]
public async Task DisposeAsync_DisposeDelayedUntilCallbacksComplete()
{
using (var b = new Barrier(2))
Expand All @@ -73,7 +72,6 @@ public async Task DisposeAsync_DisposeDelayedUntilCallbacksComplete()
}

[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/91545", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))]
public async Task DisposeAsync_MultipleDisposesBeforeCompletionReturnSameTask()
{
using (var b = new Barrier(2))
Expand All @@ -99,7 +97,6 @@ public async Task DisposeAsync_MultipleDisposesBeforeCompletionReturnSameTask()
}

[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/91545", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))]
public async Task DisposeAsync_AfterDisposeWorks()
{
using (var b = new Barrier(2))
Expand All @@ -123,7 +120,6 @@ public async Task DisposeAsync_AfterDisposeWorks()
}

[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/91545", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))]
public async Task DisposeAsync_AfterDisposeWaitHandleThrows()
{
using (var b = new Barrier(2))
Expand All @@ -146,7 +142,6 @@ public async Task DisposeAsync_AfterDisposeWaitHandleThrows()
}

[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/91545", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))]
public async Task DisposeAsync_ThenDisposeWaitHandleReturnsFalse()
{
using (var b = new Barrier(2))
Expand Down
10 changes: 0 additions & 10 deletions src/libraries/System.Threading.Timer/tests/TimerFiringTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ public class TimerFiringTests
internal const int MaxPositiveTimeoutInMs = 30000;

[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/91545", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))]
public void Timer_Fires_After_DueTime_Ellapses()
{
AutoResetEvent are = new AutoResetEvent(false);
Expand All @@ -32,7 +31,6 @@ public void Timer_Fires_After_DueTime_Ellapses()
}

[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/91545", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))]
public void Timer_Fires_AndPassesStateThroughCallback()
{
AutoResetEvent are = new AutoResetEvent(false);
Expand All @@ -49,7 +47,6 @@ public void Timer_Fires_AndPassesStateThroughCallback()
}

[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/91545", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))]
public void Timer_Fires_AndPassesNullStateThroughCallback()
{
AutoResetEvent are = new AutoResetEvent(false);
Expand Down Expand Up @@ -125,7 +122,6 @@ public void Timer_ChangeToDelete_DoesntFire()
}

[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/91545", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))]
public void Timer_CanDisposeSelfInCallback()
{
Timer t = null;
Expand Down Expand Up @@ -153,7 +149,6 @@ public void Timer_CanBeDisposedMultipleTimes()
}

[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/91545", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))]
public void NonRepeatingTimer_ThatHasAlreadyFired_CanChangeAndFireAgain()
{
AutoResetEvent are = new AutoResetEvent(false);
Expand All @@ -168,7 +163,6 @@ public void NonRepeatingTimer_ThatHasAlreadyFired_CanChangeAndFireAgain()
}

[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/91545", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))]
public void MultpleTimers_PeriodicTimerIsntBlockedByBlockedCallback()
{
int callbacks = 2;
Expand All @@ -189,7 +183,6 @@ public void MultpleTimers_PeriodicTimerIsntBlockedByBlockedCallback()
}

[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/91545", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))]
public void ManyTimers_EachTimerDoesFire()
{
int maxTimers = 10000;
Expand All @@ -207,7 +200,6 @@ public void ManyTimers_EachTimerDoesFire()
}

[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/91545", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))]
public void Timer_Constructor_CallbackOnly_Change()
{
var e = new ManualResetEvent(false);
Expand All @@ -225,7 +217,6 @@ public void Timer_Dispose_WaitHandle_Negative()
}

[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/91545", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))]
public void Timer_Dispose_WaitHandle()
{
int tickCount = 0;
Expand Down Expand Up @@ -371,7 +362,6 @@ orderby groupedByDueTime.Key
}

[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/91545", typeof(PlatformDetection), nameof(PlatformDetection.IsWasmThreadingSupported))]
public static void TimersCreatedConcurrentlyOnDifferentThreadsAllFire()
{
int processorCount = Environment.ProcessorCount;
Expand Down
Loading