Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert JIT/CodeGenBringUpTests to a merged test group #85847

Merged
merged 5 commits into from
May 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
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