Skip to content

Add ILLink conditional test scope to reduce PR validation time - #55522

Merged
MichaelSimons merged 2 commits into
dotnet:mainfrom
MichaelSimons:michaelsimons-il-test-scope
Jul 30, 2026
Merged

Add ILLink conditional test scope to reduce PR validation time#55522
MichaelSimons merged 2 commits into
dotnet:mainfrom
MichaelSimons:michaelsimons-il-test-scope

Conversation

@MichaelSimons

@MichaelSimons MichaelSimons commented Jul 29, 2026

Copy link
Copy Markdown
Member

ILLink trimming tests are among the most expensive in the test suite — each test case invokes a full dotnet publish with the ILLink linker. On PRs that don't touch trimming-related code, running them provides no signal and burns significant Helix compute.

This PR extracts the ILLink tests from Microsoft.NET.Publish.Tests into a dedicated Microsoft.NET.ILLink.Tests assembly and registers it as a ConditionalTestScope. The scope triggers when src/Tasks/Microsoft.NET.Build.Tasks/** or the test assembly itself changes, and runs unconditionally on CI.

Based on this PR's validation run, the ILLink test work items consumed about 117 Helix compute minutes across Linux x64, Windows x64, Windows x64 FullFramework, and Mac arm64. This is a reasonable approximation of the compute saved on PRs where this scope is not applicable.

PublishTestUtils.cs remains in Microsoft.NET.Publish.Tests and is linked into the new assembly via <Compile Include> to avoid duplicating shared test data.

Related to #55203

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 2 pipeline(s).
1 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@MichaelSimons
MichaelSimons force-pushed the michaelsimons-il-test-scope branch 3 times, most recently from 37a1991 to 622eb8a Compare July 29, 2026 19:29
@MichaelSimons
MichaelSimons marked this pull request as ready for review July 29, 2026 19:31
Copilot AI review requested due to automatic review settings July 29, 2026 19:31
@MichaelSimons
MichaelSimons requested review from a team as code owners July 29, 2026 19:31
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 2 pipeline(s).
1 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR reduces PR validation time by splitting expensive ILLink trimming tests into a dedicated Microsoft.NET.ILLink.Tests test assembly and wiring it into the conditional test filtering system so those tests only run on PRs that touch trimming-related code (while still running unconditionally on CI).

Changes:

  • Add a new test/Microsoft.NET.ILLink.Tests MSTest project and include shared publish test utilities via linked source to avoid duplication.
  • Move/update ILLink trimming test classes into the new assembly/namespace and update solution/solution filter inclusion.
  • Register an ILLink ConditionalTestScope, and update documentation and CODEOWNERS accordingly.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
test/Microsoft.NET.ILLink.Tests/Microsoft.NET.ILLink.Tests.csproj New ILLink-specific test project; links shared PublishTestUtils.cs and embeds Strings.resx for resource assertions.
test/Microsoft.NET.ILLink.Tests/GivenThatWeWantToRunILLink.cs Updates namespace/imports and minor formatting; keeps shared helpers available via PublishTestUtils and local ILLinkTestUtils.
test/Microsoft.NET.ILLink.Tests/GivenThatWeWantToRunILLink1b.cs Updates namespace/imports to use the new ILLink test assembly namespace and helpers.
test/Microsoft.NET.ILLink.Tests/GivenThatWeWantToRunILLink2b.cs Updates namespace/imports to use the new ILLink test assembly namespace and helpers.
test/Microsoft.NET.ILLink.Tests/GivenThatWeWantToRunILLink3b.cs Updates namespace/imports to use the new ILLink test assembly namespace and helpers.
test/ConditionalTests.props Adds the ILLink conditional test scope for PR filtering.
src/Tasks/Microsoft.NET.slnf Adds the new ILLink test project to the Tasks solution filter.
sdk.slnx Adds the new ILLink test project to the main solution.
documentation/project-docs/pr-test-filtering.md Updates guidance text now that ILLink tests are no longer the motivating example for class-level filtering.
CODEOWNERS Updates ownership to cover the new ILLink test project directory.

Comment thread test/ConditionalTests.props
Comment thread test/ConditionalTests.props
MichaelSimons and others added 2 commits July 29, 2026 17:09
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 446ca0fe-0b6a-44dc-aeaf-7a70fe16272c
Per reviewer feedback, add the ILLink-unique test assets to the
ILLink scope's TriggerPaths so a change to those assets triggers
the ILLink test suite on PR builds.

Also expand the test assets guidance in pr-test-filtering.md to
call out the discovery recipe (search for CopyTestAsset/GetTestAsset
string literals) so future agents don't miss them.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 446ca0fe-0b6a-44dc-aeaf-7a70fe16272c
@MichaelSimons
MichaelSimons force-pushed the michaelsimons-il-test-scope branch from d1ec222 to f60dc88 Compare July 29, 2026 22:22
@MichaelSimons
MichaelSimons requested a review from mthalman July 29, 2026 22:23
@MichaelSimons
MichaelSimons merged commit b5b1801 into dotnet:main Jul 30, 2026
25 checks passed
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 11.0-rc1 milestone Jul 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants