Skip to content

Commit

Permalink
Add stress test
Browse files Browse the repository at this point in the history
  • Loading branch information
smoogipoo committed Oct 4, 2023
1 parent bd42383 commit 318025e
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions osu.Framework.Tests/Threading/ThreadedTaskSchedulerTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,5 +83,28 @@ public void EnsureScheduledTaskReturnsOnDisposal()
Assert.That(run.Wait(30000));
Assert.That(exited.Wait(30000));
}

[Test]
[Repeat(1000)]
public void QueueAndDisposeStressTest()
{
ThreadedTaskScheduler scheduler = new ThreadedTaskScheduler(1, string.Empty);

Thread disposeThread = new Thread(() =>
{
scheduler.Dispose();
}) { IsBackground = true };

Check failure on line 96 in osu.Framework.Tests/Threading/ThreadedTaskSchedulerTest.cs

View workflow job for this annotation

GitHub Actions / Code Quality

Fix formatting

Check failure on line 96 in osu.Framework.Tests/Threading/ThreadedTaskSchedulerTest.cs

View workflow job for this annotation

GitHub Actions / Code Quality

Fix formatting

Thread queueThread = new Thread(() =>
{
Task.Factory.StartNew(() => { }, CancellationToken.None, TaskCreationOptions.HideScheduler, scheduler);
}) { IsBackground = true };

Check failure on line 101 in osu.Framework.Tests/Threading/ThreadedTaskSchedulerTest.cs

View workflow job for this annotation

GitHub Actions / Code Quality

Fix formatting

Check failure on line 101 in osu.Framework.Tests/Threading/ThreadedTaskSchedulerTest.cs

View workflow job for this annotation

GitHub Actions / Code Quality

Fix formatting

disposeThread.Start();
queueThread.Start();

disposeThread.Join();
queueThread.Join();
}
}
}

0 comments on commit 318025e

Please sign in to comment.