added timeout

This commit is contained in:
2026-05-02 18:10:08 +09:00
parent 1807559487
commit 254cfa5c43
3 changed files with 12 additions and 5 deletions

View File

@@ -7,6 +7,7 @@ namespace Misaki.HighPerformance.Test.UnitTest.Buffer;
public class TestAllocationManager
{
[TestMethod]
[Timeout(1000, CooperativeCancellation = true)]
public void PersistentAllocationTest()
{
var ptr1 = new MemoryBlock(1024, 8, AllocationHandle.Persistent);
@@ -23,6 +24,7 @@ public class TestAllocationManager
}
[TestMethod]
[Timeout(1000, CooperativeCancellation = true)]
public void TempAllocationTest()
{
var ptr1 = new MemoryBlock(1024, 8, AllocationHandle.Temp);
@@ -41,6 +43,7 @@ public class TestAllocationManager
}
[TestMethod]
[Timeout(1000, CooperativeCancellation = true)]
public void FreeListAllocationTest()
{
var ptr1 = new MemoryBlock(1024, 8, AllocationHandle.FreeList);
@@ -57,6 +60,7 @@ public class TestAllocationManager
}
[TestMethod]
[Timeout(1000, CooperativeCancellation = true)]
public void StackAllocationTest()
{
var thread = new Thread(() =>

View File

@@ -6,6 +6,7 @@ namespace Misaki.HighPerformance.Test.UnitTest.Buffer;
public unsafe class TestFreeList
{
[TestMethod]
[Timeout(1000, CooperativeCancellation = true)]
public void SingleThreadedAllocFreeTest()
{
using var freeList = new FreeList(8, 1024);
@@ -36,6 +37,7 @@ public unsafe class TestFreeList
}
[TestMethod]
[Timeout(1000, CooperativeCancellation = true)]
public void MultiThreadedAllocSameThreadFreeTest()
{
const int threadCount = 8;
@@ -63,6 +65,7 @@ public unsafe class TestFreeList
}
[TestMethod]
[Timeout(1000, CooperativeCancellation = true)]
public void MultiThreadedCrossThreadFreeTest()
{
const int producerCount = 4;
@@ -120,6 +123,7 @@ public unsafe class TestFreeList
}
[TestMethod]
[Timeout(1000, CooperativeCancellation = true)]
public void OverflowCacheTest()
{
// Set maxConcurrencyLevel to 1, but use more threads
@@ -144,6 +148,7 @@ public unsafe class TestFreeList
}
[TestMethod]
[Timeout(1000, CooperativeCancellation = true)]
public void LargeAllocationTest()
{
using var freeList = new FreeList(8, 1024);
@@ -157,6 +162,7 @@ public unsafe class TestFreeList
}
[TestMethod]
[Timeout(1000, CooperativeCancellation = true)]
public void ZeroSizeAllocation_ReturnsNull()
{
using var freeList = new FreeList(8, 1024);
@@ -164,6 +170,7 @@ public unsafe class TestFreeList
}
[TestMethod]
[Timeout(1000, CooperativeCancellation = true)]
public void InvalidAlignment_Throws()
{
using var freeList = new FreeList(8, 1024);
@@ -171,6 +178,7 @@ public unsafe class TestFreeList
}
[TestMethod]
[Timeout(1000, CooperativeCancellation = true)]
public void DoubleDispose_IsSafe()
{
var freeList = new FreeList(8, 1024);