Skip to content

Commit d6094d2

Browse files
authored
GC test cleanup (dotnet#107000)
- 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.
1 parent 58f431b commit d6094d2

16 files changed

+33
-254
lines changed

src/tests/GC/API/GCSettings/ILatencyTest.cs

-15
This file was deleted.

src/tests/GC/API/GCSettings/ILatencyTest.csproj

-9
This file was deleted.

src/tests/GC/API/GCSettings/InducedGen0GC.cs

+7-14
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,19 @@
33

44
using System;
55
using System.Runtime;
6+
using Xunit;
67

78
namespace GCLatencyTest
89
{
9-
public class InducedGen0GC : ILatencyTest
10+
public class InducedGen0GC
1011
{
11-
private int _numGen0Collections = 0;
12-
public void Test()
12+
[Fact]
13+
public static void Test()
1314
{
14-
_numGen0Collections = GC.CollectionCount(0);
15+
int _numCollections = GC.CollectionCount(0);
1516
GC.Collect(0);
16-
_numGen0Collections = GC.CollectionCount(0) - _numGen0Collections;
17-
}
18-
19-
public void Cleanup()
20-
{
21-
}
22-
23-
public bool Pass(GCLatencyMode gcMode, int numCollections)
24-
{
25-
return (_numGen0Collections > 0);
17+
_numCollections = GC.CollectionCount(0) - _numCollections;
18+
Assert.True(_numCollections > 0);
2619
}
2720
}
2821
}
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<OutputType>Library</OutputType>
4-
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
3+
<!-- Some GC testing still requires this for all tests -->
4+
<RequiresProcessIsolation>true</RequiresProcessIsolation>
5+
<CLRTestPriority>1</CLRTestPriority>
56
</PropertyGroup>
67
<ItemGroup>
7-
<Compile Include="InducedGen0GC.cs" />
8-
</ItemGroup>
9-
<ItemGroup>
10-
<ProjectReference Include="ILatencyTest.csproj" />
8+
<Compile Include="$(MSBuildProjectName).cs" />
119
</ItemGroup>
1210
</Project>

src/tests/GC/API/GCSettings/InducedGen1GC.cs

+7-14
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,19 @@
33

44
using System;
55
using System.Runtime;
6+
using Xunit;
67

78
namespace GCLatencyTest
89
{
9-
public class InducedGen1GC : ILatencyTest
10+
public class InducedGen1GC
1011
{
11-
private int _numGen1Collections = 0;
12-
public void Test()
12+
[Fact]
13+
public static void Test()
1314
{
14-
_numGen1Collections = GC.CollectionCount(1);
15+
int _numCollections = GC.CollectionCount(1);
1516
GC.Collect(1);
16-
_numGen1Collections = GC.CollectionCount(1) - _numGen1Collections;
17-
}
18-
19-
public void Cleanup()
20-
{
21-
}
22-
23-
public bool Pass(GCLatencyMode gcMode, int numCollections)
24-
{
25-
return (_numGen1Collections > 0);
17+
_numCollections = GC.CollectionCount(1) - _numCollections;
18+
Assert.True(_numCollections > 0);
2619
}
2720
}
2821
}
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<OutputType>Library</OutputType>
4-
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
3+
<!-- Some GC testing still requires this for all tests -->
4+
<RequiresProcessIsolation>true</RequiresProcessIsolation>
5+
<CLRTestPriority>1</CLRTestPriority>
56
</PropertyGroup>
67
<ItemGroup>
7-
<Compile Include="InducedGen1GC.cs" />
8-
</ItemGroup>
9-
<ItemGroup>
10-
<ProjectReference Include="ILatencyTest.csproj" />
8+
<Compile Include="$(MSBuildProjectName).cs" />
119
</ItemGroup>
1210
</Project>

src/tests/GC/API/GCSettings/InducedGen2GC.cs

+7-11
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,19 @@
33

44
using System;
55
using System.Runtime;
6+
using Xunit;
67

78
namespace GCLatencyTest
89
{
9-
public class InducedGen2GC : ILatencyTest
10+
public class InducedGen2GC
1011
{
11-
public void Test()
12+
[Fact]
13+
public static void Test()
1214
{
15+
int _numCollections = GC.CollectionCount(2);
1316
GC.Collect();
14-
}
15-
16-
public void Cleanup()
17-
{
18-
}
19-
20-
public bool Pass(GCLatencyMode gcMode, int numCollections)
21-
{
22-
return (numCollections > 0);
17+
_numCollections = GC.CollectionCount(2) - _numCollections;
18+
Assert.True(_numCollections > 0);
2319
}
2420
}
2521
}
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<OutputType>Library</OutputType>
4-
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
3+
<!-- Some GC testing still requires this for all tests -->
4+
<RequiresProcessIsolation>true</RequiresProcessIsolation>
5+
<CLRTestPriority>1</CLRTestPriority>
56
</PropertyGroup>
67
<ItemGroup>
7-
<Compile Include="InducedGen2GC.cs" />
8-
</ItemGroup>
9-
<ItemGroup>
10-
<ProjectReference Include="ILatencyTest.csproj" />
8+
<Compile Include="$(MSBuildProjectName).cs" />
119
</ItemGroup>
1210
</Project>

src/tests/GC/Regressions/v2.0-beta2/476725/ManagedTest.cs

-22
This file was deleted.

src/tests/GC/Regressions/v2.0-beta2/476725/ManagedTest.csproj

-10
This file was deleted.

src/tests/GC/Regressions/v2.0-beta2/485617/Managed.cs

-17
This file was deleted.

src/tests/GC/Regressions/v2.0-beta2/485617/Managed.csproj

-10
This file was deleted.

src/tests/GC/Scenarios/Boxing/doubLink.cs

-76
This file was deleted.

src/tests/GC/Scenarios/Boxing/doubLink.csproj

-10
This file was deleted.

src/tests/GC/Scenarios/DoublinkList/DoubLink_V2.csproj

-10
This file was deleted.

src/tests/GC/Scenarios/DoublinkList/dlbigleakthd_v2.csproj

-18
This file was deleted.

0 commit comments

Comments
 (0)