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

Merge JIT/Methodical tests into the merged runners #101317

Merged
merged 16 commits into from
May 8, 2024
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
  •  
  •  
  •  
31 changes: 21 additions & 10 deletions docs/workflow/ci/disabling-tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,26 @@ expedient to disable the test more broadly than possibly required.

## Disabling runtime tests (src/tests)

Most tests are disabled by adding the test to the appropriate place, under the appropriate configuration condition,
in the [issues.targets](../../../src/tests/issues.targets) file. All temporarily disabled tests must have a

### Disabling runtime tests (src/tests) with xunit attributes

The runtime tests use an XUnit-based model for test execution. There are [a number of attributes provided for filtering](../testing/libraries/filtering-tests.md)
based on different test modes. Here are some examples of attributes that can be applied to tests to prevent them from running in certain configurations:

- Prevent a test from running on Mono: `[SkipOnMono]`
- Prevent a test from running on CoreCLR: `[SkipOnCoreClr]`
- Prevent a test from running under GCStress: `[SkipOnCoreClr("Reason", RuntimeTestModes.AnyGCStress)]`
- Prevent a test from running under HeapVerify: `[SkipOnCoreClr("Reason", RuntimeTestModes.HeapVerify)]`
- Prevent a test from running under JIT stress modes: `[SkipOnCoreClr("Reason", RuntimeTestModes.AnyJitStress)]`

Additionally, the `ConditionalFact`, `ConditionalTheory`, `PlatformSpecific`, and `ActiveIssue` attributes are available for usage to disable or enable tests only on specific platforms or configurations.

Some test modes are processed at the assembly level. For these tests, you should mark the tests as `<RequiresProcessIsolation>true</RequiresProcessIsolation>` and set one of the attributes in the following section.

### Disabling runtime tests (src/tests) with issues.targets

Out-of-process tests are disabled by adding the test to the appropriate place, under the appropriate configuration condition,
in the [issues.targets](../../../src/tests/issues.targets) file. Additionally, tests that are the only `[Fact]`-attributed method in their assembly may be disabled through issues.targets. All temporarily disabled tests must have a
link to a GitHub issue in the `<Issue>` element. Disabling a test here can be conditioned on processor
architecture, runtime, and operating system.

Expand All @@ -64,15 +82,8 @@ Note that these properties can be conditional, e.g.:

More information about writing/adding tests to src/tests can be found [here](../testing/coreclr/test-configuration.md).

## Disabling runtime tests (src/tests) with xunit attributes

When this document was written, the src/tests tree was in the process of being converted to a new
execution model (see [dotnet/runtime#54512](https://github.com/dotnet/runtime/issues/54512)). This model annotates tests with xunit-style
`[Fact]` attributes. For tests which have been converted to this form, all the xunit attributes related to test disabling
described in the "src/libraries" section below are also applicable.

## Disabling libraries tests (src/libraries)

Information on disabling libraries tests is found [here](../testing/libraries/filtering-tests.md).

In particular, look at `ActiveIssueAttribute`, `SkipOnCoreClrAttribute`, and `SkipOnMonoAttribute`.
In particular, look at `ActiveIssueAttribute`, `SkipOnCoreClrAttribute`, and `SkipOnMonoAttribute`.
5 changes: 5 additions & 0 deletions src/tests/Common/CoreCLRTestLibrary/PlatformDetection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public static class PlatformDetection

public static bool IsX86Process => RuntimeInformation.ProcessArchitecture == Architecture.X86;
public static bool IsNotX86Process => !IsX86Process;
public static bool IsArm64Process => RuntimeInformation.ProcessArchitecture == Architecture.Arm64;

public static bool IsWindows => OperatingSystem.IsWindows();

Expand Down Expand Up @@ -46,6 +47,10 @@ public static bool IsNonZeroLowerBoundArraySupported
}
}

public static bool IsNonZeroLowerBoundArrayNotSupported => !IsNonZeroLowerBoundArraySupported;

public static bool IsMonoRuntime => Type.GetType("Mono.RuntimeStructs") != null;

static string _variant = Environment.GetEnvironmentVariable("DOTNET_RUNTIME_VARIANT");

public static bool IsMonoLLVMAOT => _variant == "llvmaot";
Expand Down
10 changes: 5 additions & 5 deletions src/tests/Common/XUnitWrapperGenerator/XUnitWrapperGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -832,15 +832,15 @@ private static IEnumerable<ITestInfo> GetTestMethodInfosForMethod(IMethodSymbol
Xunit.RuntimeConfiguration skippedConfigurations = 0;
Xunit.RuntimeTestModes skippedTestModes = 0;

for (int i = 1; i < filterAttribute.AttributeConstructor!.Parameters.Length; i++)
for (int i = 1; i < filterAttribute.ConstructorArguments.Length; i++)
{
ReadSkippedInformationFromSkipOnCoreClrAttributeArgument(filterAttribute, i);
ReadSkippedInformationFromSkipOnCoreClrAttributeArgument(filterAttribute.ConstructorArguments[i]);
}

void ReadSkippedInformationFromSkipOnCoreClrAttributeArgument(AttributeData filterAttribute, int argumentIndex)
void ReadSkippedInformationFromSkipOnCoreClrAttributeArgument(TypedConstant argument)
{
int argumentValue = (int)filterAttribute.ConstructorArguments[argumentIndex].Value!;
switch (filterAttribute.AttributeConstructor!.Parameters[argumentIndex].Type.ToDisplayString())
int argumentValue = (int)argument.Value!;
switch (argument.Type!.ToDisplayString())
{
case "Xunit.TestPlatforms":
skippedTestPlatforms = (Xunit.TestPlatforms)argumentValue;
Expand Down
12 changes: 4 additions & 8 deletions src/tests/Common/dirs.proj
Original file line number Diff line number Diff line change
Expand Up @@ -96,24 +96,20 @@
<GroupNumber>5</GroupNumber>
</_GroupStartsWith>

<_GroupStartsWith Include="$(TestRoot)JIT\Methodical\flowgraph">
<GroupNumber>6</GroupNumber>
</_GroupStartsWith>

<_GroupStartsWith Include="$(TestRoot)JIT\opt">
<GroupNumber>7</GroupNumber>
<GroupNumber>6</GroupNumber>
</_GroupStartsWith>

<_GroupStartsWith Include="$(TestRoot)JIT\Regression\CLR-x86-JIT\V1-M11-Beta2">
<GroupNumber>8</GroupNumber>
<GroupNumber>7</GroupNumber>
</_GroupStartsWith>

<_GroupStartsWith Include="$(TestRoot)JIT\SIMD">
<GroupNumber>9</GroupNumber>
<GroupNumber>8</GroupNumber>
</_GroupStartsWith>

<_GroupStartsWith Include="$(TestRoot)Loader\classloader\TypeGeneratorTests\TypeGeneratorTest200">
<GroupNumber>10</GroupNumber>
<GroupNumber>9</GroupNumber>
</_GroupStartsWith>
</ItemGroup>

Expand Down
1 change: 1 addition & 0 deletions src/tests/JIT/Methodical/Arrays/lcs/lcs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ private static void findLCS(int[,,,] c, int[,,,] b, char[][] seq, int[] len)
}

[Fact]
[OuterLoop]
public static int TestEntryPoint()
{
Console.WriteLine("Test searches for longest common subsequence of 4 strings\n\n");
Expand Down
1 change: 1 addition & 0 deletions src/tests/JIT/Methodical/Arrays/lcs/lcs2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ private static void findLCS(ref int[][][][] c, ref int[][][][] b, ref char[][] s
}

[Fact]
[SkipOnCoreClr("This test is not compatible with GCStress.", RuntimeTestModes.AnyGCStress)]
public static int TestEntryPoint()
{
Console.WriteLine("Test searches for longest common subsequence of 4 strings\n\n");
Expand Down
13 changes: 0 additions & 13 deletions src/tests/JIT/Methodical/Arrays/lcs/lcs2_d.csproj

This file was deleted.

13 changes: 0 additions & 13 deletions src/tests/JIT/Methodical/Arrays/lcs/lcs2_do.csproj

This file was deleted.

13 changes: 0 additions & 13 deletions src/tests/JIT/Methodical/Arrays/lcs/lcs2_r.csproj

This file was deleted.

13 changes: 0 additions & 13 deletions src/tests/JIT/Methodical/Arrays/lcs/lcs2_ro.csproj

This file was deleted.

12 changes: 0 additions & 12 deletions src/tests/JIT/Methodical/Arrays/lcs/lcs_lcs_d.csproj

This file was deleted.

11 changes: 0 additions & 11 deletions src/tests/JIT/Methodical/Arrays/lcs/lcs_lcs_do.csproj

This file was deleted.

12 changes: 0 additions & 12 deletions src/tests/JIT/Methodical/Arrays/lcs/lcs_lcs_r.csproj

This file was deleted.

11 changes: 0 additions & 11 deletions src/tests/JIT/Methodical/Arrays/lcs/lcs_lcs_ro.csproj

This file was deleted.

1 change: 1 addition & 0 deletions src/tests/JIT/Methodical/Arrays/lcs/lcsbas.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ private static void findLCS(int[,,,] c, int[,,,] b, char[][] seq, int[] len)
}

[Fact]
[OuterLoop]
public static int TestEntryPoint()
{
Console.WriteLine("Test searches for longest common subsequence of 4 strings\n\n");
Expand Down
12 changes: 0 additions & 12 deletions src/tests/JIT/Methodical/Arrays/lcs/lcsbas_d.csproj

This file was deleted.

11 changes: 0 additions & 11 deletions src/tests/JIT/Methodical/Arrays/lcs/lcsbas_do.csproj

This file was deleted.

12 changes: 0 additions & 12 deletions src/tests/JIT/Methodical/Arrays/lcs/lcsbas_r.csproj

This file was deleted.

11 changes: 0 additions & 11 deletions src/tests/JIT/Methodical/Arrays/lcs/lcsbas_ro.csproj

This file was deleted.

11 changes: 0 additions & 11 deletions src/tests/JIT/Methodical/Arrays/lcs/lcsbox_d.csproj

This file was deleted.

11 changes: 0 additions & 11 deletions src/tests/JIT/Methodical/Arrays/lcs/lcsbox_do.csproj

This file was deleted.

11 changes: 0 additions & 11 deletions src/tests/JIT/Methodical/Arrays/lcs/lcsbox_r.csproj

This file was deleted.

11 changes: 0 additions & 11 deletions src/tests/JIT/Methodical/Arrays/lcs/lcsbox_ro.csproj

This file was deleted.

1 change: 1 addition & 0 deletions src/tests/JIT/Methodical/Arrays/lcs/lcsmax.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ private static void findLCS(int[,,,,,,,] c, int[,,,,,,,] b, char[][] seq, int[]
}

[Fact]
[OuterLoop]
public static int TestEntryPoint()
{
Console.WriteLine("Test searches for longest common subsequence of 8 strings\n\n");
Expand Down
12 changes: 0 additions & 12 deletions src/tests/JIT/Methodical/Arrays/lcs/lcsmax_d.csproj

This file was deleted.

11 changes: 0 additions & 11 deletions src/tests/JIT/Methodical/Arrays/lcs/lcsmax_do.csproj

This file was deleted.

12 changes: 0 additions & 12 deletions src/tests/JIT/Methodical/Arrays/lcs/lcsmax_r.csproj

This file was deleted.

Loading
Loading