Skip to content

Add more multithreaded tests#12994

Merged
OvesN merged 17 commits intodotnet:mainfrom
AR-May:add-mt-tests
Apr 28, 2026
Merged

Add more multithreaded tests#12994
OvesN merged 17 commits intodotnet:mainfrom
AR-May:add-mt-tests

Conversation

@AR-May
Copy link
Copy Markdown
Member

@AR-May AR-May commented Jan 9, 2026

Fixes #12640

Context

End-to-end tests for building test projects with /mt mode were added.

Tests for:

SDK assets:

  • Single console-app project
  • Single console app and multi-project solution (ConsoleApp + libraries)

Non-SDK assets:

  • Single console-app project
  • Single console app and multi-project solution (ConsoleApp + libraries)

Changes Made

  • Added new MSBuild.EndToEnd.Tests test project.

Testing

End-to-end tests in MultithreadedExecution_Tests.cs:

  • MultithreadedBuild_Success — SDK-style builds with various /mt combinations.
  • MultithreadedBuild_BinaryLogging — SDK-style build with binlog + replay.
  • MultithreadedBuild_NonSdkStyle_Success — non-SDK builds (Windows-only).
  • MultithreadedBuild_NonSdkStyle_BinaryLogging — non-SDK binlog + replay (Windows-only).

@AR-May AR-May self-assigned this Jan 9, 2026
@AR-May
Copy link
Copy Markdown
Member Author

AR-May commented Jan 19, 2026

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@OvesN OvesN marked this pull request as ready for review April 21, 2026 10:59
Copilot AI review requested due to automatic review settings April 21, 2026 10:59
@OvesN OvesN requested a review from JanProvaznik April 21, 2026 11:07
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a new command-line end-to-end test project intended to exercise /mt (multithreaded) MSBuild execution using small on-disk test assets, and refactors an existing BuildCheck E2E test helper to use FileUtilities.CopyDirectory.

Changes:

  • Introduce Microsoft.Build.CommandLine.EndToEnd.Tests with /mt build + binlog replay scenarios and a shared fixture for restoring/copying test assets.
  • Add new SDK-style and non-SDK-style test asset projects used by the E2E tests.
  • Replace custom recursive copy logic in BuildCheck.UnitTests with FileUtilities.CopyDirectory.

Reviewed changes

Copilot reviewed 31 out of 31 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
src/MSBuild/AssemblyInfo.cs Adds IVT for the new EndToEnd test assembly.
src/MSBuild.EndToEnd.Tests/Microsoft.Build.CommandLine.EndToEnd.Tests.csproj New E2E test project wired into the repo build.
src/MSBuild.EndToEnd.Tests/MultithreadedExecution_Tests.cs New /mt end-to-end tests that spawn bootstrapped MSBuild.
src/MSBuild.EndToEnd.Tests/TestAssetsFixture.cs New fixture to pre-restore selected test assets.
src/MSBuild.EndToEnd.Tests/TestSolutionAsset.cs New lightweight model for identifying test assets.
src/MSBuild.EndToEnd.Tests/TestAssets/SingleProject/global.json Prevents SDK resolution walking up to repo settings during tests.
src/MSBuild.EndToEnd.Tests/TestAssets/SingleProject/SingleProject.csproj SDK-style single-project test asset.
src/MSBuild.EndToEnd.Tests/TestAssets/SingleProject/Program.cs Source file for the single-project asset.
src/MSBuild.EndToEnd.Tests/TestAssets/ProjectWithDependencies/global.json Prevents SDK resolution walking up to repo settings during tests.
src/MSBuild.EndToEnd.Tests/TestAssets/ProjectWithDependencies/ConsoleApp/ConsoleApp.csproj SDK-style app referencing multiple libraries.
src/MSBuild.EndToEnd.Tests/TestAssets/ProjectWithDependencies/ConsoleApp/Program.cs App entry point for dependency-graph asset.
src/MSBuild.EndToEnd.Tests/TestAssets/ProjectWithDependencies/Library1/Library1.csproj SDK-style library project (dependency graph).
src/MSBuild.EndToEnd.Tests/TestAssets/ProjectWithDependencies/Library1/Class1.cs Source file for Library1.
src/MSBuild.EndToEnd.Tests/TestAssets/ProjectWithDependencies/Library2/Library2.csproj SDK-style library referencing Library3/4.
src/MSBuild.EndToEnd.Tests/TestAssets/ProjectWithDependencies/Library2/Class2.cs Source file for Library2.
src/MSBuild.EndToEnd.Tests/TestAssets/ProjectWithDependencies/Library3/Library3.csproj SDK-style library project.
src/MSBuild.EndToEnd.Tests/TestAssets/ProjectWithDependencies/Library3/Class3.cs Source file for Library3.
src/MSBuild.EndToEnd.Tests/TestAssets/ProjectWithDependencies/Library4/Library4.csproj SDK-style library project.
src/MSBuild.EndToEnd.Tests/TestAssets/ProjectWithDependencies/Library4/Class4.cs Source file for Library4.
src/MSBuild.EndToEnd.Tests/TestAssets/NonSdkSingleProject/NonSdkSingleProject.csproj Non-SDK-style .NET Framework project asset.
src/MSBuild.EndToEnd.Tests/TestAssets/NonSdkSingleProject/Program.cs Source file for non-SDK single-project asset.
src/MSBuild.EndToEnd.Tests/TestAssets/NonSdkProjectWithDependencies/ConsoleApp/ConsoleApp.csproj Non-SDK-style app referencing non-SDK libraries.
src/MSBuild.EndToEnd.Tests/TestAssets/NonSdkProjectWithDependencies/ConsoleApp/Program.cs App entry point for non-SDK dependency-graph asset.
src/MSBuild.EndToEnd.Tests/TestAssets/NonSdkProjectWithDependencies/Library1/Library1.csproj Non-SDK-style library project.
src/MSBuild.EndToEnd.Tests/TestAssets/NonSdkProjectWithDependencies/Library1/Class1.cs Source file for non-SDK Library1.
src/MSBuild.EndToEnd.Tests/TestAssets/NonSdkProjectWithDependencies/Library2/Library2.csproj Non-SDK-style library project.
src/MSBuild.EndToEnd.Tests/TestAssets/NonSdkProjectWithDependencies/Library2/Class2.cs Source file for non-SDK Library2.
src/Framework/Properties/AssemblyInfo.cs Adds IVT for the EndToEnd test assembly (enables internal helpers like FileUtilities).
src/BuildCheck.UnitTests/EndToEndTests.cs Switches to FileUtilities.CopyDirectory and removes custom recursive copy helper.
src/Build/AssemblyInfo.cs Adds IVT for the EndToEnd test assembly.
MSBuild.slnx Adds the new EndToEnd test project to the solution.

Comment thread src/MSBuild.EndToEnd.Tests/TestAssetsFixture.cs
Comment thread src/MSBuild.EndToEnd.Tests/MultithreadedExecution_Tests.cs
Comment thread src/MSBuild/AssemblyInfo.cs Outdated
Comment thread src/Build/AssemblyInfo.cs Outdated
Comment thread src/MSBuild.EndToEnd.Tests/TestAssetsFixture.cs Outdated
Comment thread src/MSBuild.EndToEnd.Tests/MultithreadedExecution_Tests.cs Outdated
Comment thread src/MSBuild.EndToEnd.Tests/MultithreadedExecution_Tests.cs
Comment thread src/MSBuild.EndToEnd.Tests/MultithreadedExecution_Tests.cs
Comment thread src/MSBuild.EndToEnd.Tests/MultithreadedExecution_Tests.cs
Comment thread src/MSBuild.EndToEnd.Tests/TestSolutionAsset.cs Outdated
Comment thread src/MSBuild.EndToEnd.Tests/Microsoft.Build.EndToEnd.Tests.csproj
 - Rename csproj from Microsoft.Build.CommandLine.EndToEnd.Tests to
   Microsoft.Build.EndToEnd.Tests
 - Delete InternalsVisibleTo in Build and MSBuild assemblies
 - Increase restore timeout to 120s to reduce CI flakiness
 - Route fixture output via IMessageSink for diagnostics
 - Remove unnecessary IDisposable from TestSolutionAssetsFixture
 - Fix inaccurate XML doc comments on BuildAndVerify and ProjectPath
 - Add binlog non-empty assertion
 - Increase test timeout to 180s
@OvesN
Copy link
Copy Markdown
Contributor

OvesN commented Apr 23, 2026

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 2 pipeline(s).

Comment thread src/MSBuild.EndToEnd.Tests/TestSolutionAsset.cs Outdated
Comment thread pr-description.md Outdated
Comment thread src/MSBuild.EndToEnd.Tests/TestAssetsFixture.cs Outdated
Comment thread src/MSBuild.EndToEnd.Tests/TestAssetsFixture.cs
Comment thread src/MSBuild.EndToEnd.Tests/MultithreadedExecution_Tests.cs
@AR-May
Copy link
Copy Markdown
Member Author

AR-May commented Apr 28, 2026

LGTM!

Copy link
Copy Markdown
Member

@JanProvaznik JanProvaznik left a comment

Choose a reason for hiding this comment

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

lgtm after comments resolved

Make TestSolutionAsset and TestAssetsFixture internal
Improve comments in TestAssetsFixture
Add project with dependencies to binaryLogging tests.
@OvesN OvesN enabled auto-merge (squash) April 28, 2026 12:37
@OvesN OvesN merged commit 50f3f69 into dotnet:main Apr 28, 2026
10 checks passed
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.

Write end-to-end tests for /mt mode.

5 participants