Skip to content

Commit

Permalink
GC test cleanup (#107000)
Browse files Browse the repository at this point in the history
- Restore InducedGen<N>GC tests.  Remove test interface used by those 3 tests.
- Delete tests that were appropriate combinations of not running, not interesting, and duplicates.
  • Loading branch information
markples authored Sep 19, 2024
1 parent 58f431b commit d6094d2
Show file tree
Hide file tree
Showing 16 changed files with 33 additions and 254 deletions.
15 changes: 0 additions & 15 deletions src/tests/GC/API/GCSettings/ILatencyTest.cs

This file was deleted.

9 changes: 0 additions & 9 deletions src/tests/GC/API/GCSettings/ILatencyTest.csproj

This file was deleted.

21 changes: 7 additions & 14 deletions src/tests/GC/API/GCSettings/InducedGen0GC.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,19 @@

using System;
using System.Runtime;
using Xunit;

namespace GCLatencyTest
{
public class InducedGen0GC : ILatencyTest
public class InducedGen0GC
{
private int _numGen0Collections = 0;
public void Test()
[Fact]
public static void Test()
{
_numGen0Collections = GC.CollectionCount(0);
int _numCollections = GC.CollectionCount(0);
GC.Collect(0);
_numGen0Collections = GC.CollectionCount(0) - _numGen0Collections;
}

public void Cleanup()
{
}

public bool Pass(GCLatencyMode gcMode, int numCollections)
{
return (_numGen0Collections > 0);
_numCollections = GC.CollectionCount(0) - _numCollections;
Assert.True(_numCollections > 0);
}
}
}
10 changes: 4 additions & 6 deletions src/tests/GC/API/GCSettings/InducedGen0GC.csproj
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Library</OutputType>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<!-- Some GC testing still requires this for all tests -->
<RequiresProcessIsolation>true</RequiresProcessIsolation>
<CLRTestPriority>1</CLRTestPriority>
</PropertyGroup>
<ItemGroup>
<Compile Include="InducedGen0GC.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="ILatencyTest.csproj" />
<Compile Include="$(MSBuildProjectName).cs" />
</ItemGroup>
</Project>
21 changes: 7 additions & 14 deletions src/tests/GC/API/GCSettings/InducedGen1GC.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,19 @@

using System;
using System.Runtime;
using Xunit;

namespace GCLatencyTest
{
public class InducedGen1GC : ILatencyTest
public class InducedGen1GC
{
private int _numGen1Collections = 0;
public void Test()
[Fact]
public static void Test()
{
_numGen1Collections = GC.CollectionCount(1);
int _numCollections = GC.CollectionCount(1);
GC.Collect(1);
_numGen1Collections = GC.CollectionCount(1) - _numGen1Collections;
}

public void Cleanup()
{
}

public bool Pass(GCLatencyMode gcMode, int numCollections)
{
return (_numGen1Collections > 0);
_numCollections = GC.CollectionCount(1) - _numCollections;
Assert.True(_numCollections > 0);
}
}
}
10 changes: 4 additions & 6 deletions src/tests/GC/API/GCSettings/InducedGen1GC.csproj
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Library</OutputType>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<!-- Some GC testing still requires this for all tests -->
<RequiresProcessIsolation>true</RequiresProcessIsolation>
<CLRTestPriority>1</CLRTestPriority>
</PropertyGroup>
<ItemGroup>
<Compile Include="InducedGen1GC.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="ILatencyTest.csproj" />
<Compile Include="$(MSBuildProjectName).cs" />
</ItemGroup>
</Project>
18 changes: 7 additions & 11 deletions src/tests/GC/API/GCSettings/InducedGen2GC.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,19 @@

using System;
using System.Runtime;
using Xunit;

namespace GCLatencyTest
{
public class InducedGen2GC : ILatencyTest
public class InducedGen2GC
{
public void Test()
[Fact]
public static void Test()
{
int _numCollections = GC.CollectionCount(2);
GC.Collect();
}

public void Cleanup()
{
}

public bool Pass(GCLatencyMode gcMode, int numCollections)
{
return (numCollections > 0);
_numCollections = GC.CollectionCount(2) - _numCollections;
Assert.True(_numCollections > 0);
}
}
}
10 changes: 4 additions & 6 deletions src/tests/GC/API/GCSettings/InducedGen2GC.csproj
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Library</OutputType>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<!-- Some GC testing still requires this for all tests -->
<RequiresProcessIsolation>true</RequiresProcessIsolation>
<CLRTestPriority>1</CLRTestPriority>
</PropertyGroup>
<ItemGroup>
<Compile Include="InducedGen2GC.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="ILatencyTest.csproj" />
<Compile Include="$(MSBuildProjectName).cs" />
</ItemGroup>
</Project>
22 changes: 0 additions & 22 deletions src/tests/GC/Regressions/v2.0-beta2/476725/ManagedTest.cs

This file was deleted.

10 changes: 0 additions & 10 deletions src/tests/GC/Regressions/v2.0-beta2/476725/ManagedTest.csproj

This file was deleted.

17 changes: 0 additions & 17 deletions src/tests/GC/Regressions/v2.0-beta2/485617/Managed.cs

This file was deleted.

10 changes: 0 additions & 10 deletions src/tests/GC/Regressions/v2.0-beta2/485617/Managed.csproj

This file was deleted.

76 changes: 0 additions & 76 deletions src/tests/GC/Scenarios/Boxing/doubLink.cs

This file was deleted.

10 changes: 0 additions & 10 deletions src/tests/GC/Scenarios/Boxing/doubLink.csproj

This file was deleted.

10 changes: 0 additions & 10 deletions src/tests/GC/Scenarios/DoublinkList/DoubLink_V2.csproj

This file was deleted.

18 changes: 0 additions & 18 deletions src/tests/GC/Scenarios/DoublinkList/dlbigleakthd_v2.csproj

This file was deleted.

0 comments on commit d6094d2

Please sign in to comment.