Skip to content

Enable build-free dotnet test in Native AOT - #55971

Merged
Evangelink merged 2 commits into
mainfrom
dev/amauryleve/native-aot-dotnet-test
Aug 28, 2026
Merged

Evangelink merged 2 commits into
mainfrom
dev/amauryleve/native-aot-dotnet-test

Conversation

@Evangelink

Copy link
Copy Markdown
Member

Summary

  • handle explicit Microsoft.Testing.Platform dotnet test --test-modules invocations in the Native AOT CLI
  • reuse the managed module matcher, IPC, terminal reporting, cancellation, policy, results-layout, and artifact post-processing implementation
  • fall back before output or mutation for VSTest, project/solution/file-based discovery, positional shorthand, root diagnostics, unknown options, and MSBuild-dependent options
  • add parser and native integration coverage, including an AOT-only execution marker

Validation

  • full build.cmd
  • focused AOT parser tests: 3 passed
  • focused managed test-command tests: 170 passed
  • clean AOT product and test builds
  • warning-free win-x64 Native AOT publish
  • real MTP module execution through dn and the built SDK
  • Release native suite: 167/170 passed; the remaining three existing harness failures are AotRun_NoBuildSyntheticCache_LaunchesAndConservativelyFallsBack, Version_WithAotDisabled_StillWorks, and Info_WithAotDisabled_ShowsFullInfo, all failing while loading hostfxr with Access is denied

Native size

Release dotnet-aot.dll: 18,500,096 -> 19,572,224 bytes (+1,072,128 bytes, +5.8%).

Handle explicit Microsoft.Testing.Platform --test-modules invocations in the Native AOT CLI while preserving managed fallback for build-dependent and unsupported shapes.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: fd4b45f2-a70d-42bd-b6b1-cfdc9f729a08
Copilot AI lite review requested due to automatic review settings August 27, 2026 16:32
@Evangelink
Evangelink requested review from a team as code owners August 27, 2026 16:32
@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 extends the Native AOT dotnet CLI to handle a constrained, build-free dotnet test --test-modules (Microsoft.Testing.Platform) execution path in native code, while preserving managed fallback for MSBuild- and VSTest-dependent shapes.

Changes:

  • Adds an AOT-only AotTestCommand eligibility gate and wires it into the AOT command tree.
  • Refactors dotnet test MTP build-option parsing into a shared TestCommandOptions helper with #if CLI_AOT behavior differences.
  • Adds AOT parser/integration tests plus runner scripts that supply a managed test module for end-to-end validation.
Show a summary per file
File Description
test/dotnet-aot.Tests/run-aot-tests.sh Exports a managed test module path for AOT integration validation.
test/dotnet-aot.Tests/run-aot-tests.ps1 Locates and exports a managed test module path for AOT integration validation.
test/dotnet-aot.Tests/AotParserTests.cs Adds AOT parser coverage for supported/unsupported test --test-modules shapes.
test/dotnet-aot.Tests/AotIntegrationTests.cs Adds end-to-end execution test for AOT test --test-modules driving a managed module.
src/Cli/dotnet/Parser.cs Wires AotTestCommand into AOT action configuration for dotnet test.
src/Cli/dotnet/Commands/Test/MTP/TestCommandOptions.cs New shared helper for extracting build/options from MTP ParseResult (AOT-aware).
src/Cli/dotnet/Commands/Test/MTP/MSBuildUtility.cs Delegates build-options extraction to the new TestCommandOptions helper.
src/Cli/dotnet/Commands/Test/MTP/MicrosoftTestingPlatformTestCommand.cs Adds #if CLI_AOT path for test-module handler and avoids MSBuild-only logic in AOT.
src/Cli/dotnet/Commands/Test/AotTestCommand.cs New AOT-only command action that allowlists options and triggers fallback otherwise.
src/Cli/dotnet-aot/DESIGN.md Documents the new build-free test-modules orchestration behavior in AOT.
src/Cli/dotnet-aot/AotSourceFiles.props Links the required dotnet test MTP orchestration sources into the AOT closure.
src/Cli/dotnet-aot/AotDependencies.props Adds dependencies needed by the AOT test-module orchestration closure.

Review details

  • Files reviewed: 12/12 changed files
  • Comments generated: 1
  • Review effort level: Lite

@Evangelink
Evangelink enabled auto-merge August 27, 2026 17:37
Assert that the extension option is preserved without rejecting the environment-driven --no-banner argument.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: fd4b45f2-a70d-42bd-b6b1-cfdc9f729a08
@Evangelink
Evangelink merged commit ee21d92 into main Aug 28, 2026
22 checks passed
@Evangelink
Evangelink deleted the dev/amauryleve/native-aot-dotnet-test branch August 28, 2026 14:21
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 12.0-preview1 milestone Aug 29, 2026

This branch had an error being deployed

1 failed deployment
copilot-pat-pool — 7c8c002d Deployed Aug 28, 2026 by Evangelink via pre_activation #1540
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