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/opt to a merged test group #85850

Merged
merged 19 commits into from
May 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
77a8d4e
Manual removal of C# Main args
markples Apr 26, 2023
e29aafa
Mark async Main test as RPI
markples Apr 26, 2023
1bc8537
Manual removal of IL Main arg
markples Apr 26, 2023
ce7c700
Manual fix for badcallee
markples Apr 27, 2023
8a1a235
[ILTransform -p] Remove _il from project name
markples Apr 27, 2023
a18f790
[ILTransform -n] Unique project names
markples Apr 29, 2023
f65c3d1
[ILTransform -m] Remove .module from IL tests
markples Apr 28, 2023
b59c53a
Rename GitHub_42719: _r means not DebugType=Full, _o for optimize
markples Apr 28, 2023
b813642
[ILTransform -a] Match IL .assembly names to project names
markples Apr 28, 2023
d93d4e3
[ILTransform -prociso] Set RequiresProcessIsolation when needed by ot…
markples Apr 28, 2023
3534bd0
[ILTransform -sr] Use canonical form for .assembly extern System.Runtime
markples Apr 29, 2023
01006e2
[ILTransform -ilfact] Main->TestEntryPoint, [Fact], remove OutputType…
markples Apr 29, 2023
38f1b40
[ILTransform -public] Make test entrypoints accessible
markples Apr 29, 2023
cba429c
Manual fixes for [ILTransform -public] - internal methods to handle i…
markples Apr 29, 2023
9cb6e94
Handle float constants for InlineData in XUnitWrapperGenerator
markples Apr 29, 2023
409b843
Manual fixes for xUnit1013 - internal methods, convert to [Theory]
markples Apr 29, 2023
6d2adb0
Manual fixes for xUnit1013 - internal methods, disable region
markples May 2, 2023
bd23df3
Add merged group
markples May 5, 2023
203254a
Fix mismatch{32,64} by putting the test methods in classes
markples May 5, 2023
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
  •  
  •  
  •  
Original file line number Diff line number Diff line change
Expand Up @@ -753,7 +753,7 @@ private static ImmutableArray<ITestInfo> CreateTestCases(IMethodSymbol method, L
// Emit diagnostic
continue;
}
var argsAsCode = ImmutableArray.CreateRange(args.Select(a => a.ToCSharpString()));
var argsAsCode = ImmutableArray.CreateRange(args.Select(a => a.ToCSharpString() + (a.Type!.SpecialType == SpecialType.System_Single ? "F" : "")));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without this change, a float constant in [InlineData] leads to a build failure when trying to pass a double constant for a float parameter. This isn't a great or complete solution, but I couldn't find a good public entry point in Roslyn to do this correctly, and float cases do not work at all currently.

testCasesBuilder.Add(new BasicTestMethod(method, alias, arguments: argsAsCode));
break;
}
Expand Down
6 changes: 4 additions & 2 deletions src/tests/JIT/opt/Add/IntAdd.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@

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

namespace CodeGenTests
{
static class IntAdd
public static class IntAdd
{
[MethodImpl(MethodImplOptions.NoInlining)]
static sbyte Int8_Add(sbyte x, sbyte y)
Expand Down Expand Up @@ -86,7 +87,8 @@ static ulong UInt64_Add(ulong x, ulong y)
return x + y;
}

static int Main()
[Fact]
public static int TestEntryPoint()
{
// Int8
if (Int8_Add(SByte.MaxValue, 15) != -114)
Expand Down
3 changes: 2 additions & 1 deletion src/tests/JIT/opt/Add/IntAdd.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<!-- Needed for CLRTestEnvironmentVariable -->
<RequiresProcessIsolation>true</RequiresProcessIsolation>
</PropertyGroup>
<PropertyGroup>
<DebugType>None</DebugType>
Expand Down
6 changes: 4 additions & 2 deletions src/tests/JIT/opt/And/IntAnd.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@

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

namespace CodeGenTests
{
class IntAnd
public class IntAnd
{
[MethodImpl(MethodImplOptions.NoInlining)]
static void SideEffect()
Expand Down Expand Up @@ -70,7 +71,8 @@ static uint Test_And_UInt32_MaxValue(uint i)
return i & UInt32.MaxValue;
}

static int Main()
[Fact]
public static int TestEntryPoint()
{
// No CastByte
if (!Test_UInt32_UInt32_And(0b1000_0000_0000_0000_0000_0000_0000_0000, 0b0000_0000_0000_0000_0000_0000_0000_0001))
Expand Down
3 changes: 2 additions & 1 deletion src/tests/JIT/opt/And/IntAnd.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<!-- Needed for CLRTestEnvironmentVariable -->
<RequiresProcessIsolation>true</RequiresProcessIsolation>
</PropertyGroup>
<PropertyGroup>
<DebugType>None</DebugType>
Expand Down
12 changes: 0 additions & 12 deletions src/tests/JIT/opt/And/Regressions/Regression1.csproj

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@
//
// File: D:\a\_work\1\s\src\coreclr\jit\lowerxarch.cpp Line: 5118
//
using Xunit;
public class Program
{
public static bool s_26;
public static int Main()
[Fact]
public static int TestEntryPoint()
{
var vr2 = new uint[,] { { 0 } };
int vr7 = default(int);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<DebugType>None</DebugType>
<Optimize>True</Optimize>
</PropertyGroup>
<ItemGroup>
Expand Down
6 changes: 4 additions & 2 deletions src/tests/JIT/opt/AssertionPropagation/ArrBoundBinaryOp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using Xunit;

class Program
public class Program
{
private static int returnCode = 100;

public static int Main()
[Fact]
public static int TestEntryPoint()
{
int[] testIndices = Enumerable.Range(-50, 50)
// also add some corner case values
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<!-- Needed for GCStressIncompatible -->
<RequiresProcessIsolation>true</RequiresProcessIsolation>
<!-- Disabled for GCStress due to test failure tracked by https://github.com/dotnet/runtime/issues/66279 -->
<GCStressIncompatible>true</GCStressIncompatible>
</PropertyGroup>
Expand Down
6 changes: 4 additions & 2 deletions src/tests/JIT/opt/AssertionPropagation/ArrBoundElim.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@

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

class Program
public class Program
{
private static int returnCode = 100;

public static int Main()
[Fact]
public static int TestEntryPoint()
{
RunTestThrows(Tests.MulOutsideRange);
RunTestThrows(Tests.MulOverflow);
Expand Down
3 changes: 0 additions & 3 deletions src/tests/JIT/opt/AssertionPropagation/ArrBoundElim.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
</PropertyGroup>
<PropertyGroup>
<DebugType>None</DebugType>
<Optimize>True</Optimize>
Expand Down
6 changes: 4 additions & 2 deletions src/tests/JIT/opt/AssertionPropagation/ArrBoundMinLength.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@

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

class Program
public class Program
{
private static int returnCode = 100;

private static int[] arr = new int[6];

public static int Main()
[Fact]
public static int TestEntryPoint()
{
RunTestThrows(Tests.GreaterOutOfBound);
RunTestThrows(Tests.GreaterEqualOutOfBound);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
</PropertyGroup>
<PropertyGroup>
<DebugType>None</DebugType>
<Optimize>True</Optimize>
Expand Down
6 changes: 4 additions & 2 deletions src/tests/JIT/opt/AssertionPropagation/ArrBoundUnsigned.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@

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

class ArrBoundUnsigned
public class ArrBoundUnsigned
{
// The method names indicate when the array access takes place e.g i_LT_UN_len executes a[i] if (uint)i < (uint)a.len.
// If the condition is true and the array index is invalid then an IndexOutOfRangeException is expected.
Expand Down Expand Up @@ -300,7 +301,8 @@ static int i_GE_UN_len_next_edge(int[] a, int i, int lenTest)
return a[i];
}

static int Main()
[Fact]
public static int TestEntryPoint()
{
const int Pass = 100;
const int Fail = -1;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
</PropertyGroup>
<PropertyGroup>
<!-- Set to 'Full' if the Debug? column is marked in the spreadsheet. Leave blank otherwise. -->
<DebugType>None</DebugType>
Expand Down
4 changes: 2 additions & 2 deletions src/tests/JIT/opt/AssertionPropagation/CPropOverflow.il
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

// =============== CLASS MEMBERS DECLARATION ===================

.class private auto ansi beforefieldinit Sample1
.class public auto ansi beforefieldinit Sample1
extends [mscorlib]System.Object
{
.method private hidebysig static int32
Expand All @@ -63,7 +63,7 @@
IL_0018: ret
} // end of method Sample1::OverflowTest

.method private hidebysig static int32
.method public hidebysig static int32
Main() cil managed
{
.custom instance void [xunit.core]Xunit.FactAttribute::.ctor() = (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk.IL">
<PropertyGroup>
<OutputType>Exe</OutputType>
<CLRTestPriority>1</CLRTestPriority>
</PropertyGroup>
<PropertyGroup>
Expand Down
6 changes: 4 additions & 2 deletions src/tests/JIT/opt/AssertionPropagation/ConstantProp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
//Simple dev unit test for constant propagation assertion.

using System;
using Xunit;

internal class Sample1
public class Sample1
{
[System.Runtime.CompilerServices.MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
private static int func(int a)
Expand All @@ -18,7 +19,8 @@ private static int func(int a)
else
return y;
}
private static int Main()
[Fact]
public static int TestEntryPoint()
{
bool failed = false;
if (func(0) != 5)
Expand Down
1 change: 0 additions & 1 deletion src/tests/JIT/opt/AssertionPropagation/ConstantProp.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/opt/AssertionPropagation/CopyProp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
//Unit test for copy propagation assertion.

using System;
using Xunit;

internal class Sample2
public class Sample2
{
[System.Runtime.CompilerServices.MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
private static sbyte func(int a, int b)
Expand All @@ -21,7 +22,8 @@ private static sbyte func(int a, int b)
return (sbyte)res;
}

private static int Main()
[Fact]
public static int TestEntryPoint()
{
bool failed = false;
if (func(1, 2) != -1)
Expand Down
1 change: 0 additions & 1 deletion src/tests/JIT/opt/AssertionPropagation/CopyProp.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
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@

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

public class DynBlkNullAssertions
{
public static int Main()
[Fact]
public static int TestEntryPoint()
{
if (!TestCpBlk(ref Unsafe.NullRef<byte>(), ref Unsafe.NullRef<byte>(), 0))
{
Expand Down
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/opt/AssertionPropagation/NullCheckAssertion1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
//Unit test for null check assertion.

using System;
using Xunit;

internal class Sample3
public class Sample3
{
[System.Runtime.CompilerServices.MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
private static void func(object o)
Expand All @@ -15,7 +16,8 @@ private static void func(object o)
o.GetType();
}

private static int Main()
[Fact]
public static int TestEntryPoint()
{
try
{
Expand Down
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/opt/AssertionPropagation/NullCheckAssertion2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
// The .NET Foundation licenses this file to you under the MIT license.

using System;
using Xunit;

internal class Sample4
public class Sample4
{
private static int s_s = 1;

Expand All @@ -19,7 +20,8 @@ private static void func(object o1, object o2)
}
}

private static int Main()
[Fact]
public static int TestEntryPoint()
{
try
{
Expand Down
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/opt/AssertionPropagation/NullCheckAssertion3.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
//Unit test for Null check assertion propagation.

using System;
using Xunit;

internal class Point
{
Expand All @@ -16,7 +17,7 @@ internal class Point
public int Distance() { return x * x + y * y; }
}

internal class Sample5
public class Sample5
{
[System.Runtime.CompilerServices.MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
private static int func(Point p1, Point p2, Point p3)
Expand All @@ -36,7 +37,8 @@ private static int func(Point p1, Point p2, Point p3)
return h;
}

private static int Main()
[Fact]
public static int TestEntryPoint()
{
try
{
Expand Down
Loading