Skip to content

Commit

Permalink
Convert JIT/CodeGenBringUpTests to a merged test group (#85847)
Browse files Browse the repository at this point in the history
See https://github.com/markples/utils/tree/for-PR-dotnet-runtime-85847-others for ILTransform tool.  As usual, I recommend viewing the commit list since it partitions the changes in a more readable way and paying more attention to manual changes.

* [ILTransform -public] Make test entrypoints accessible
* [ILTransform -ilfact] Main->TestEntryPoint, [Fact], remove OutputType=Exe
* Manual fixes for xUnit1013 - internal methods
* Add merged group
* Update porting-ryujit.md with info on merged test groups
  • Loading branch information
markples authored May 18, 2023
1 parent 16fc92f commit 0096ba5
Show file tree
Hide file tree
Showing 805 changed files with 541 additions and 893 deletions.
11 changes: 7 additions & 4 deletions docs/design/coreclr/jit/porting-ryujit.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,13 @@ There are several steps to follow to port the JIT (some of which can be be done
* Implement the basic instruction encodings. Test them using a method like `CodeGen::genArm64EmitterUnitTests()`.
* Implement the bare minimum to get the compiler building and generating code for very simple operations, like addition.
* Focus on the CodeGenBringUpTests (src\tests\JIT\CodeGenBringUpTests), starting with the simple ones.
These are designed such that for a test `XXX.cs`, there is a single interesting function named `XXX` to compile
(that is, the name of the source file is the same as the name of the interesting function. This was done to make
the scripts to invoke these tests very simple.). Set `DOTNET_AltJit=XXX` so the new JIT only attempts to
compile that one function.
* These are designed such that for a test `XXX.cs`, there is a single interesting function named `XXX` to compile
(that is, the name of the source file is the same as the name of the interesting function. This was done to make
the scripts to invoke these tests very simple.). Set `DOTNET_AltJit=XXX` so the new JIT only attempts to
compile that one function.
* Merged test groups interfere with the simplicity of these tests by removing the entry point from each individual
test and creating a single wrapper that calls all of the tests in a single process. To restore the
old behavior, build the tests with the environment variable `BuildAsStandalone` set to `true`.
* Use `DOTNET_JitDisasm` to see the generated code for functions, even if the code isn't run.

## Expand test coverage
Expand Down
4 changes: 3 additions & 1 deletion src/tests/JIT/CodeGenBringUpTests/Add1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

using System;
using System.Runtime.CompilerServices;
using Xunit;
public class BringUpTest_Add1
{
const int Pass = 100;
Expand All @@ -13,7 +14,8 @@ public class BringUpTest_Add1
[MethodImplAttribute(MethodImplOptions.NoInlining)]
public static int Add1(int x) { return x+1; }

public static int Main()
[Fact]
public static int TestEntryPoint()
{
int y = Add1(1);
if (y == 2) return Pass;
Expand Down
1 change: 0 additions & 1 deletion src/tests/JIT/CodeGenBringUpTests/Add1_d.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<CLRTestPriority>1</CLRTestPriority>
</PropertyGroup>
<PropertyGroup>
Expand Down
1 change: 0 additions & 1 deletion src/tests/JIT/CodeGenBringUpTests/Add1_do.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<CLRTestPriority>1</CLRTestPriority>
</PropertyGroup>
<PropertyGroup>
Expand Down
1 change: 0 additions & 1 deletion src/tests/JIT/CodeGenBringUpTests/Add1_r.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<CLRTestPriority>1</CLRTestPriority>
</PropertyGroup>
<PropertyGroup>
Expand Down
1 change: 0 additions & 1 deletion src/tests/JIT/CodeGenBringUpTests/Add1_ro.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<CLRTestPriority>1</CLRTestPriority>
</PropertyGroup>
<PropertyGroup>
Expand Down
4 changes: 3 additions & 1 deletion src/tests/JIT/CodeGenBringUpTests/And1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

using System;
using System.Runtime.CompilerServices;
using Xunit;
public class BringUpTest_And1
{
const int Pass = 100;
Expand All @@ -13,7 +14,8 @@ public class BringUpTest_And1
[MethodImplAttribute(MethodImplOptions.NoInlining)]
public static int And1(int x) { return x & 1; }

public static int Main()
[Fact]
public static int TestEntryPoint()
{
int y = And1(17);
if (y == 1) return Pass;
Expand Down
1 change: 0 additions & 1 deletion src/tests/JIT/CodeGenBringUpTests/And1_d.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<CLRTestPriority>1</CLRTestPriority>
</PropertyGroup>
<PropertyGroup>
Expand Down
1 change: 0 additions & 1 deletion src/tests/JIT/CodeGenBringUpTests/And1_do.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<CLRTestPriority>1</CLRTestPriority>
</PropertyGroup>
<PropertyGroup>
Expand Down
1 change: 0 additions & 1 deletion src/tests/JIT/CodeGenBringUpTests/And1_r.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<CLRTestPriority>1</CLRTestPriority>
</PropertyGroup>
<PropertyGroup>
Expand Down
1 change: 0 additions & 1 deletion src/tests/JIT/CodeGenBringUpTests/And1_ro.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<CLRTestPriority>1</CLRTestPriority>
</PropertyGroup>
<PropertyGroup>
Expand Down
6 changes: 4 additions & 2 deletions src/tests/JIT/CodeGenBringUpTests/AndRef.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@

using System;
using System.Runtime.CompilerServices;
using Xunit;

class child
public class child
{
static int Main()
[Fact]
public static int TestEntryPoint()
{
const int Pass = 100;
const int Fail = -1;
Expand Down
1 change: 0 additions & 1 deletion src/tests/JIT/CodeGenBringUpTests/AndRef_d.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<CLRTestPriority>1</CLRTestPriority>
</PropertyGroup>
<PropertyGroup>
Expand Down
1 change: 0 additions & 1 deletion src/tests/JIT/CodeGenBringUpTests/AndRef_do.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<CLRTestPriority>1</CLRTestPriority>
</PropertyGroup>
<PropertyGroup>
Expand Down
1 change: 0 additions & 1 deletion src/tests/JIT/CodeGenBringUpTests/AndRef_r.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<CLRTestPriority>1</CLRTestPriority>
</PropertyGroup>
<PropertyGroup>
Expand Down
1 change: 0 additions & 1 deletion src/tests/JIT/CodeGenBringUpTests/AndRef_ro.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<CLRTestPriority>1</CLRTestPriority>
</PropertyGroup>
<PropertyGroup>
Expand Down
4 changes: 3 additions & 1 deletion src/tests/JIT/CodeGenBringUpTests/Args4.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

using System;
using System.Runtime.CompilerServices;
using Xunit;
public class BringUpTest_Args4
{
const int Pass = 100;
Expand All @@ -16,7 +17,8 @@ public static int Args4(int a, int b, int c, int d)
return a+b+c+d;
}

public static int Main()
[Fact]
public static int TestEntryPoint()
{
int y = Args4(1,2,3,4);
if (y == 10) return Pass;
Expand Down
1 change: 0 additions & 1 deletion src/tests/JIT/CodeGenBringUpTests/Args4_d.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<CLRTestPriority>1</CLRTestPriority>
</PropertyGroup>
<PropertyGroup>
Expand Down
1 change: 0 additions & 1 deletion src/tests/JIT/CodeGenBringUpTests/Args4_do.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<CLRTestPriority>1</CLRTestPriority>
</PropertyGroup>
<PropertyGroup>
Expand Down
1 change: 0 additions & 1 deletion src/tests/JIT/CodeGenBringUpTests/Args4_r.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<CLRTestPriority>1</CLRTestPriority>
</PropertyGroup>
<PropertyGroup>
Expand Down
1 change: 0 additions & 1 deletion src/tests/JIT/CodeGenBringUpTests/Args4_ro.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<CLRTestPriority>1</CLRTestPriority>
</PropertyGroup>
<PropertyGroup>
Expand Down
4 changes: 3 additions & 1 deletion src/tests/JIT/CodeGenBringUpTests/Args5.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

using System;
using System.Runtime.CompilerServices;
using Xunit;
public class BringUpTest_Args5
{
const int Pass = 100;
Expand All @@ -16,7 +17,8 @@ public static int Args5(int a, int b, int c, int d, int e)
return a+b+c+d+e;
}

public static int Main()
[Fact]
public static int TestEntryPoint()
{
int y = Args5(1,2,3,4,5);
if (y == 15) return Pass;
Expand Down
1 change: 0 additions & 1 deletion src/tests/JIT/CodeGenBringUpTests/Args5_d.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<CLRTestPriority>1</CLRTestPriority>
</PropertyGroup>
<PropertyGroup>
Expand Down
1 change: 0 additions & 1 deletion src/tests/JIT/CodeGenBringUpTests/Args5_do.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<CLRTestPriority>1</CLRTestPriority>
</PropertyGroup>
<PropertyGroup>
Expand Down
1 change: 0 additions & 1 deletion src/tests/JIT/CodeGenBringUpTests/Args5_r.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<CLRTestPriority>1</CLRTestPriority>
</PropertyGroup>
<PropertyGroup>
Expand Down
1 change: 0 additions & 1 deletion src/tests/JIT/CodeGenBringUpTests/Args5_ro.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<CLRTestPriority>1</CLRTestPriority>
</PropertyGroup>
<PropertyGroup>
Expand Down
4 changes: 3 additions & 1 deletion src/tests/JIT/CodeGenBringUpTests/Array1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

using System;
using System.Runtime.CompilerServices;
using Xunit;

public class BringUpTest_Array1
{
Expand All @@ -16,7 +17,8 @@ static void Array1(int[] a)
a[1] = 5;
}

static int Main()
[Fact]
public static int TestEntryPoint()
{
int[] a = {1, 2, 3, 4};
Array1(a);
Expand Down
1 change: 0 additions & 1 deletion src/tests/JIT/CodeGenBringUpTests/Array1_d.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<CLRTestPriority>1</CLRTestPriority>
</PropertyGroup>
<PropertyGroup>
Expand Down
1 change: 0 additions & 1 deletion src/tests/JIT/CodeGenBringUpTests/Array1_do.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<CLRTestPriority>1</CLRTestPriority>
</PropertyGroup>
<PropertyGroup>
Expand Down
1 change: 0 additions & 1 deletion src/tests/JIT/CodeGenBringUpTests/Array1_r.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<CLRTestPriority>1</CLRTestPriority>
</PropertyGroup>
<PropertyGroup>
Expand Down
1 change: 0 additions & 1 deletion src/tests/JIT/CodeGenBringUpTests/Array1_ro.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<CLRTestPriority>1</CLRTestPriority>
</PropertyGroup>
<PropertyGroup>
Expand Down
4 changes: 3 additions & 1 deletion src/tests/JIT/CodeGenBringUpTests/Array2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

using System;
using System.Runtime.CompilerServices;
using Xunit;

public class BringUpTest_Array2
{
Expand All @@ -16,7 +17,8 @@ static int Array2(int[] a)
return a[1];
}

static int Main()
[Fact]
public static int TestEntryPoint()
{
int[] a = {1, 2, 3, 4};
if (Array2(a) != 2) return Fail;
Expand Down
1 change: 0 additions & 1 deletion src/tests/JIT/CodeGenBringUpTests/Array2_d.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<CLRTestPriority>1</CLRTestPriority>
</PropertyGroup>
<PropertyGroup>
Expand Down
1 change: 0 additions & 1 deletion src/tests/JIT/CodeGenBringUpTests/Array2_do.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<CLRTestPriority>1</CLRTestPriority>
</PropertyGroup>
<PropertyGroup>
Expand Down
1 change: 0 additions & 1 deletion src/tests/JIT/CodeGenBringUpTests/Array2_r.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<CLRTestPriority>1</CLRTestPriority>
</PropertyGroup>
<PropertyGroup>
Expand Down
1 change: 0 additions & 1 deletion src/tests/JIT/CodeGenBringUpTests/Array2_ro.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<CLRTestPriority>1</CLRTestPriority>
</PropertyGroup>
<PropertyGroup>
Expand Down
4 changes: 3 additions & 1 deletion src/tests/JIT/CodeGenBringUpTests/Array3.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

using System;
using System.Runtime.CompilerServices;
using Xunit;

public class BringUpTest_Array3
{
Expand All @@ -18,7 +19,8 @@ static int Array3()
return a[1];
}

static int Main()
[Fact]
public static int TestEntryPoint()
{
if (Array3() != 5) return Fail;
return Pass;
Expand Down
1 change: 0 additions & 1 deletion src/tests/JIT/CodeGenBringUpTests/Array3_d.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<CLRTestPriority>1</CLRTestPriority>
</PropertyGroup>
<PropertyGroup>
Expand Down
1 change: 0 additions & 1 deletion src/tests/JIT/CodeGenBringUpTests/Array3_do.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<CLRTestPriority>1</CLRTestPriority>
</PropertyGroup>
<PropertyGroup>
Expand Down
1 change: 0 additions & 1 deletion src/tests/JIT/CodeGenBringUpTests/Array3_r.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<CLRTestPriority>1</CLRTestPriority>
</PropertyGroup>
<PropertyGroup>
Expand Down
1 change: 0 additions & 1 deletion src/tests/JIT/CodeGenBringUpTests/Array3_ro.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<CLRTestPriority>1</CLRTestPriority>
</PropertyGroup>
<PropertyGroup>
Expand Down
Loading

0 comments on commit 0096ba5

Please sign in to comment.