Skip to content

Run dn integration tests in the Native AOT test runner - #55854

Merged
JeremyKuhne merged 4 commits into
dotnet:mainfrom
JeremyKuhne:fix-aot-cli-dn-integration-tests
Aug 19, 2026
Merged

JeremyKuhne merged 4 commits into
dotnet:mainfrom
JeremyKuhne:fix-aot-cli-dn-integration-tests

Conversation

@JeremyKuhne

Copy link
Copy Markdown
Member

Summary

The Native AOT CLI test runner currently publishes only the dotnet-aot.Tests executable. AotIntegrationTests launches the separate dn host, so those tests report inconclusive when the host is absent and CI can pass without exercising the real native host/library boundary.

This change makes the runner:

  • publish dotnet-aot.Tests, the product dotnet-aot native library, and dn for the host RID
  • run dn against a complete installed SDK while loading the freshly published native library from a separate directory
  • provide the host, SDK, and library paths required by end-to-end and separated-layout tests
  • fail preflight when any required native artifact is missing
  • keep the AOT workflow guidance aligned with the runner contract

History

#54297 introduced the Native AOT test project and the dn integration tests. Its validation explicitly reported 38 passed, 6 skipped; the integration tests were designed to skip when dn had not been built.

#54719 added the native test runner to Windows, Linux, and macOS CI. Its validation reported 0 failed, 52 passed, 9 skipped, including the six dn integration tests. The CI runner still published only the test executable, so this was a deliberate incremental scope boundary rather than a platform restriction.

As a result, CI proved that the test closure could compile and execute under Native AOT, but it did not prove that the separately published dn host could load the product library, use a complete SDK layout, or transition to managed fallback.

Implementation notes

DOTNET_AOT_SDK_DIR continues to identify the complete versioned SDK directory passed to dotnet_execute. A separate DOTNET_AOT_LIBRARY_DIR test hook identifies the directory containing the freshly published product library. Keeping these paths separate avoids modifying the bootstrap SDK while preserving realistic SDK-relative lookup for Roslyn, Sdks, Current, and install-root packs.

The no-build fallback integration fixture also now creates a cache shape that the native path intentionally rejects. A source timestamp change alone is valid with managed --no-build semantics and therefore could not reach the asserted fallback branch.

Validation

Windows win-x64, Release Native AOT run:

.\test\dotnet-aot.Tests\run-aot-tests.ps1 `
  -Configuration Release `
  -Trx `
  -ResultsDirectory .\artifacts\TestResults\Release

Result: 159 discovered, 159 executed, 159 passed, 0 failed, 0 skipped.

The assembled artifacts were rerun with -NoBuild with the same result. bash -n test/dotnet-aot.Tests/run-aot-tests.sh, diagnostics, and git diff --check also pass. Linux and macOS native execution are left to the existing CI matrix.

The native runner published only dotnet-aot.Tests, so end-to-end tests treated the missing dn host as inconclusive. Publish dn and dotnet-aot for the host RID, load the test-built library separately from a complete SDK layout, and require the integration tests to execute.
Copilot AI lite review requested due to automatic review settings August 19, 2026 00:02
@JeremyKuhne
JeremyKuhne requested review from a team, lbussell and mthalman as code owners August 19, 2026 00:02
@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 updates the Native AOT CLI test runner so CI executes the dn end-to-end integration tests against a complete SDK layout, while loading the freshly published dotnet-aot native library from a separate directory. This closes a gap where CI could pass without validating the real native host/library boundary and managed fallback behavior.

Changes:

  • Publish additional Native AOT artifacts for the test run (dotnet-aot native library and dn host) and fail preflight if they’re missing.
  • Pass explicit SDK/host/library/dn paths into the Native AOT test binary via environment variables to enable reliable integration/E2E coverage.
  • Update integration fixtures and workflow guidance to support separated-layout and “no-build fallback” validation.

Reviewed changes

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

Show a summary per file
File Description
test/dotnet-aot.Tests/run-aot-tests.sh Publishes dotnet-aot.Tests, dotnet-aot library, and dn, then runs tests with required env vars and preflight checks.
test/dotnet-aot.Tests/run-aot-tests.ps1 Same as the bash runner; additionally normalizes dotnet(.exe) and scopes env var setup/restore around execution.
test/dotnet-aot.Tests/AotIntegrationTests.cs Allows sourcing the dotnet-aot library from DOTNET_AOT_LIBRARY_DIR and tightens the synthetic cache fallback setup.
src/Cli/dn/run-dn.ps1 Ensures DOTNET_AOT_LIBRARY_DIR is included in the env var hygiene for local dn runs.
src/Cli/dn/Program.cs Adds DOTNET_AOT_LIBRARY_DIR support so dn can load the native library separately from the SDK directory used for SDK-relative assets.
.github/skills/add-dotnet-aot-command/SKILL.md Updates workflow guidance to reflect the runner’s expanded publish+run contract and integration-test expectations.

Comment thread src/Cli/dn/Program.cs Resolved
@JeremyKuhne
JeremyKuhne enabled auto-merge (squash) August 19, 2026 20:08
@JeremyKuhne
JeremyKuhne merged commit 96d77d9 into dotnet:main Aug 19, 2026
22 checks passed
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 12.0-preview1 milestone Aug 20, 2026

This branch had an error being deployed

1 failed deployment
copilot-pat-pool — 927589d4 Deployed Aug 19, 2026 by JeremyKuhne via pre_activation #443
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