Skip to content
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
Expand All @@ -11,7 +12,10 @@ namespace Mono.Linker.Tests.TestCases
{
public static class TestDatabase
{
private static TestCase[] _cachedAllCases;
private static readonly Lazy<TestCase[]> s_allCases = new(() => CreateCollector()
.Collect()
.OrderBy(c => c.DisplayName)
.ToArray());

public static IEnumerable<object[]> AdvancedTests()
{
Expand All @@ -28,6 +32,12 @@ public static IEnumerable<object[]> AttributeTests()
return TestCasesBySuiteName("Attributes");
}

public static IEnumerable<object[]> AttributeTestsShard(int shardIndex, int shardCount)
{
return TestCasesBySuiteName("Attributes")
.Where((_, index) => index % shardCount == shardIndex);
}
Comment thread
sbomer marked this conversation as resolved.
Comment thread
sbomer marked this conversation as resolved.

public static IEnumerable<object[]> AttributesStructLayoutTests()
{
return TestCasesBySuiteName("Attributes.StructLayout");
Expand Down Expand Up @@ -73,6 +83,12 @@ public static IEnumerable<object[]> DataFlowTests()
return TestCasesBySuiteName("DataFlow");
}

public static IEnumerable<object[]> DataFlowTestsShard(int shardIndex, int shardCount)
{
return TestCasesBySuiteName("DataFlow")
.Where((_, index) => index % shardCount == shardIndex);
}

public static IEnumerable<object[]> DynamicDependenciesTests()
{
return TestCasesBySuiteName("DynamicDependencies");
Expand Down Expand Up @@ -113,6 +129,12 @@ public static IEnumerable<object[]> InheritanceInterfaceTests()
return TestCasesBySuiteName("Inheritance.Interfaces");
}

public static IEnumerable<object[]> InheritanceInterfaceTestsShard(int shardIndex, int shardCount)
{
return TestCasesBySuiteName("Inheritance.Interfaces")
.Where((_, index) => index % shardCount == shardIndex);
}

public static IEnumerable<object[]> InheritanceVirtualMethodsTests()
{
return TestCasesBySuiteName("Inheritance.VirtualMethods");
Expand Down Expand Up @@ -265,12 +287,7 @@ public static NPath TestCasesRootDirectory

static IEnumerable<TestCase> AllCases()
{
_cachedAllCases ??= CreateCollector()
.Collect()
.OrderBy(c => c.DisplayName)
.ToArray();

return _cachedAllCases;
return s_allCases.Value;
}

static IEnumerable<object[]> TestCasesBySuiteName(string suiteName)
Expand Down
Loading