Skip to content

[mobile] Enable NativeAOT library tests on Apple mobile platforms#125437

Open
kotlarmilos wants to merge 102 commits into
dotnet:mainfrom
kotlarmilos:enable-nativeaot-libs-tests-mobile
Open

[mobile] Enable NativeAOT library tests on Apple mobile platforms#125437
kotlarmilos wants to merge 102 commits into
dotnet:mainfrom
kotlarmilos:enable-nativeaot-libs-tests-mobile

Conversation

@kotlarmilos

@kotlarmilos kotlarmilos commented Mar 11, 2026

Copy link
Copy Markdown
Member

Description

Enables NativeAOT library tests on Apple mobile in extra platforms by wiring the trim+ILC step on the host build leg and consuming the produced static library in AppleAppBuilder library mode on the Helix.

Build flow

  • Host (build leg): publishes each test project with NativeLib=Static + CustomNativeMain=true, producing lib<TestAssembly>.a plus the staged ILC link inputs. eng/testing/tests.ioslike.targets is updated to set TestNativeAot/TestSingleFile/PublishAotUsingRuntimePack and to opt into _SuppressNativeLibEventSourceWarning for the static-library path.
  • Helix (proxy): src/mono/msbuild/apple/data/ProxyProjectForAOTOnHelix.proj no longer re-runs ILC on the agent. It detects the prebuilt static library via the new _NativeAotLibraryTestOnHelix property, replaces _AppleNativeAotCompile in $(AppleBuildDependsOn) with _StageNativeAotLinkInputsOnHelix, and unconditionally adds DirectPInvoke __Internal so the AppleAppBuilder-generated objc symbols (mono_ios_set_summary, …) are statically resolved by ILC.

Pipelines

  • runtime.yml keeps the existing AllSubsets_NativeAOT_Smoke legs for iOS device + maccatalyst arm64, runs System.Runtime.Tests plus iOS functional tests.
  • eng/pipelines/extra-platforms/runtime-extra-platforms-{ioslike,ioslikesimulator,maccatalyst}.yml add AllSubsets_NativeAOT[_AppSandbox] legs. They run a curated subset of library tests: System.Runtime, System.Collections, System.Linq, System.Threading, System.Threading.Tasks, System.Net.Http.Functional.

Depends on dotnet/xharness#1554
Fixes #81075

Replace NativeAOT runtime test legs with library test legs on iOS/tvOS
devices, iOS/tvOS simulators, and Mac Catalyst. The runtime tests
(nativeaot/SmokeTests) provide minimal value on mobile since the compiler
doesn't meaningfully distinguish between iOS and macOS. Library tests
exercise OS-specific APIs (crypto, networking, etc.) that are the real
quality gate.

Changes:
- ioslike: remove NativeAOT runtime test leg, update existing library
  test leg to use dynamic smoke test arg
- ioslikesimulator: replace NativeAOT runtime test leg with library
  test leg, fix isiOSLikeSimulatorOnlyBuild parameter
- maccatalyst: replace both NativeAOT runtime test legs (regular +
  AppSandbox) with library test legs, fix coreclrContainsChange
  variable (was incorrectly using monoContainsChange)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

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 Apple “extra platforms” CI legs to validate NativeAOT on iOS/tvOS devices, iOS/tvOS simulators, and Mac Catalyst by running libraries tests (via Helix) instead of the minimal NativeAOT runtime SmokeTests, improving OS-specific coverage (crypto/networking/globalization) on mobile.

Changes:

  • Switch NativeAOT Apple-mobile legs from runtime SmokeTests submission to eng/pipelines/libraries/helix.yml submission of libraries tests.
  • Use eng/pipelines/libraries/helix-queues-setup.yml and pass NeedsToBuildAppsOnHelix=true for the new legs.
  • Update naming/args to use $(_runSmokeTestsOnlyArg) and fix path-evaluation variable naming in affected legs.

Reviewed changes

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

File Description
eng/pipelines/extra-platforms/runtime-extra-platforms-maccatalyst.yml Replaces NativeAOT runtime SmokeTests legs with libraries test legs (including App Sandbox variant) using libraries Helix templates/queues.
eng/pipelines/extra-platforms/runtime-extra-platforms-ioslikesimulator.yml Replaces NativeAOT runtime SmokeTests on iOS/tvOS simulators with libraries tests using libraries Helix templates/queues.
eng/pipelines/extra-platforms/runtime-extra-platforms-ioslike.yml Adjusts NativeAOT iOS/tvOS device leg to use $(_runSmokeTestsOnlyArg) for libraries tests and removes the old NativeAOT runtime SmokeTests device leg.

You can also share your feedback on Copilot code review. Take the survey.

dotnet-maestro Bot and others added 5 commits March 12, 2026 10:30
…60312.1

On relative base path root
Microsoft.DotNet.XHarness.CLI , Microsoft.DotNet.XHarness.TestRunners.Common , Microsoft.DotNet.XHarness.TestRunners.Xunit From Version 11.0.0-prerelease.26160.2 -> To Version 11.0.0-prerelease.26162.1
…60312.3

On relative base path root
Microsoft.DotNet.XHarness.CLI , Microsoft.DotNet.XHarness.TestRunners.Common , Microsoft.DotNet.XHarness.TestRunners.Xunit From Version 11.0.0-prerelease.26160.2 -> To Version 11.0.0-prerelease.26162.3
…60314.3

On relative base path root
Microsoft.DotNet.XHarness.CLI , Microsoft.DotNet.XHarness.TestRunners.Common , Microsoft.DotNet.XHarness.TestRunners.Xunit From Version 11.0.0-prerelease.26160.2 -> To Version 11.0.0-prerelease.26164.3
…60317.2

On relative base path root
Microsoft.DotNet.XHarness.CLI , Microsoft.DotNet.XHarness.TestRunners.Common , Microsoft.DotNet.XHarness.TestRunners.Xunit From Version 11.0.0-prerelease.26160.2 -> To Version 11.0.0-prerelease.26167.2
…60318.1

On relative base path root
Microsoft.DotNet.XHarness.CLI , Microsoft.DotNet.XHarness.TestRunners.Common , Microsoft.DotNet.XHarness.TestRunners.Xunit From Version 11.0.0-prerelease.26160.2 -> To Version 11.0.0-prerelease.26168.1
@kotlarmilos kotlarmilos marked this pull request as draft March 18, 2026 12:57
…bb6-53258cb4f260' into enable-nativeaot-libs-tests-mobile
Copilot AI review requested due to automatic review settings March 18, 2026 13:02

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

Copilot reviewed 6 out of 6 changed files in this pull request and generated no new comments.


You can also share your feedback on Copilot code review. Take the survey.

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

Address @jkotas review feedback.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@kotlarmilos

Copy link
Copy Markdown
Member Author

/azp run runtime-extra-platforms

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

Replace the blanket .json exclusion in the NativeAOT bundler path with
specific publish-metadata suffixes (.deps.json, .runtimeconfig.json,
.runtimeconfig.dev.json). Content files like appSettings.json now flow
through to the .app/ bundle, fixing CanConfigureAppConfigurationFromFile
and similar tests in Microsoft.Extensions.Hosting.Unit.Tests on iOS,
tvOS, and MacCatalyst NativeAOT.

The .dll exclusion is left in place because NativeAOT publish output
contains ILC intermediate .dll files that legitimately shouldn't be
bundled; separating content .dll from intermediate .dll requires a
broader publish-folder refactor (per the existing TODO).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

@MichalStrehovsky MichalStrehovsky left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The general direction looks good. I have not looked at anything under eng/pipelines, mono/, tasks/ and the tests.ioslike.targets, tests.mobile.targets, so please get a review from someone who knows what those components are.

Comment thread src/libraries/tests.proj
Comment thread src/libraries/tests.proj
@kotlarmilos

Copy link
Copy Markdown
Member Author

@steveisok @matouskozak Please take a look again

@kotlarmilos

Copy link
Copy Markdown
Member Author

/azp run runtime-extra-platforms

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@kotlarmilos

Copy link
Copy Markdown
Member Author

/azp run runtime-extra-platforms

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-Infrastructure-coreclr Only use for closed issues os-ios Apple iOS

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

Enable building/running libraries tests on iOS simulator and device with NativeAOT

7 participants