Skip to content

Conversation

jonathanpeppers
Copy link
Member

@jonathanpeppers jonathanpeppers commented Apr 28, 2025

For each "smoke test" that build an Android application project (libraries not really relevant), we run the test on all runtimes.

For each test, I generally added two more test cases for NativeAOT and CoreCLR.

This is a first step to ensure that we don't break CoreCLR or NativeAOT support at build time.

This also discovered a bug on NativeAOT, in a project with spaces:

clang no such file or directory: 'Me.so'
C:\Users\cloudtest\.nuget\packages\microsoft.dotnet.ilcompiler\10.0.0-preview.5.25227.101\build\Microsoft.NETCore.Native.targets(391,5): error MSB3073: The command ""clang" "obj\Release\android-arm64\native\Test Me.o" -o "bin\Release\android-arm64\native\Test Me.so" -Wl,--version-script="obj\Release\android-arm64\native\Test Me.exports" -Wl,--export-dynamic -gz=zlib -fuse-ld=lld C:\Users\cloudtest\.nuget\packages\microsoft.netcore.app.runtime.nativeaot.linux-bionic-arm64\10.0.0-preview.5.25227.101/runtimes/linux-bionic-arm64/\native\libSystem.Native.a C:\Users\cloudtest\.nuget\packages\microsoft.netcore.app.runtime.nativeaot.linux-bionic-arm64\10.0.0-preview.5.25227.101/runtimes/linux-bionic-arm64/\native\libSystem.Globalization.Native.a C:\Users\cloudtest\.nuget\packages\microsoft.netcore.app.runtime.nativeaot.linux-bionic-arm64\10.0.0-preview.5.25227.101/runtimes/linux-bionic-arm64/\native\libSystem.IO.Compression.Native.a C:\Users\cloudtest\.nuget\packages\microsoft.netcore.app.runtime.nativeaot.linux-bionic-arm64\10.0.0-preview.5.25227.101/runtimes/linux-bionic-arm64/\native\libSystem.Security.Cryptography.Native.OpenSsl.a C:\Users\cloudtest\.nuget\packages\microsoft.netcore.app.runtime.nativeaot.linux-bionic-arm64\10.0.0-preview.5.25227.101/runtimes/linux-bionic-arm64/\native\libbootstrapperdll.o C:\Users\cloudtest\.nuget\packages\microsoft.netcore.app.runtime.nativeaot.linux-bionic-arm64\10.0.0-preview.5.25227.101/runtimes/linux-bionic-arm64/\native\libRuntime.WorkstationGC.a C:\Users\cloudtest\.nuget\packages\microsoft.netcore.app.runtime.nativeaot.linux-bionic-arm64\10.0.0-preview.5.25227.101/runtimes/linux-bionic-arm64/\native\libeventpipe-disabled.a C:\Users\cloudtest\.nuget\packages\microsoft.netcore.app.runtime.nativeaot.linux-bionic-arm64\10.0.0-preview.5.25227.101/runtimes/linux-bionic-arm64/\native\libstandalonegc-disabled.a C:\Users\cloudtest\.nuget\packages\microsoft.netcore.app.runtime.nativeaot.linux-bionic-arm64\10.0.0-preview.5.25227.101/runtimes/linux-bionic-arm64/\native\libaotminipal.a C:\Users\cloudtest\.nuget\packages\microsoft.netcore.app.runtime.nativeaot.linux-bionic-arm64\10.0.0-preview.5.25227.101/runtimes/linux-bionic-arm64/\native\libstdc++compat.a C:\Users\cloudtest\.nuget\packages\microsoft.netcore.app.runtime.nativeaot.linux-bionic-arm64\10.0.0-preview.5.25227.101/runtimes/linux-bionic-arm64/\native\libbrotlienc.a C:\Users\cloudtest\.nuget\packages\microsoft.netcore.app.runtime.nativeaot.linux-bionic-arm64\10.0.0-preview.5.25227.101/runtimes/linux-bionic-arm64/\native\libbrotlidec.a C:\Users\cloudtest\.nuget\packages\microsoft.netcore.app.runtime.nativeaot.linux-bionic-arm64\10.0.0-preview.5.25227.101/runtimes/linux-bionic-arm64/\native\libbrotlicommon.a --target=aarch64-linux-android21 -g -Wl,-rpath,"$ORIGIN" -Wl,--build-id=sha1 -Wl,--as-needed -Wl,-e,0x0 -pthread -ldl -lz -llog -lm -shared -Wl,-z,relro -Wl,-z,now -Wl,--eh-frame-hdr -Wl,-z,max-page-size=16384 -Wl,-soname,libTest Me.so -Wl,--discard-all -Wl,--gc-sections -Wl,-T,"obj\Release\android-arm64\native\sections.ld"" exited with code 1.

The fix was to quote @(LinkerArg):

<LinkerArg Include="&quot;-Wl,-soname,lib$(TargetName)$(NativeBinaryExt)&quot;" />

For each "smoke test" that build an Android application project
(libraries not really relevant), we run the test on all runtimes.

For each test, I generally added two more test cases for NativeAOT and
CoreCLR.

This is a first step to ensure that we don't break CoreCLR or
NativeAOT support at build time.
@jonathanpeppers jonathanpeppers marked this pull request as ready for review April 30, 2025 20:52
Copy link

@Copilot 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

This PR enhances the Android smoke test suite by supporting multiple .NET runtime configurations (MonoVM, CoreCLR, NativeAOT) during MSBuild execution. Key changes include:

  • Adding a SetRuntime extension method in ProjectExtensions.cs to set the appropriate runtime property.
  • Updating test cases in PackagingTest.cs, BuildTest.cs, BuildTest.TestCaseSource.cs, and AssetPackTests.cs to include a new AndroidRuntime parameter.
  • Adjusting build assertions and test logic to correctly handle runtime-specific behaviors and warnings.

Reviewed Changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
ProjectExtensions.cs Introduces the SetRuntime extension method to configure the project based on the specified AndroidRuntime.
PackagingTest.cs Updates test cases to include an AndroidRuntime parameter and applies the runtime configuration.
BuildTest.cs Extends test methods with an AndroidRuntime parameter and adjusts build logic (e.g. warning assertions and preview feature enablement) accordingly.
BuildTest.TestCaseSource.cs Adds runtime parameter values to the test case sources for improved consistency.
AssetPackTests.cs Revises asset pack tests to accept a runtime parameter and set the runtime on the project.
Files not reviewed (1)
  • src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.NativeAOT.targets: Language not supported

Copy link
Contributor

@jpobst jpobst left a comment

Choose a reason for hiding this comment

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

Looks like a good approach for now that doesn't balloon our CI times.

We are probably getting close to needing a few more Windows MSBuild Tests agents. 😉

@jonathanpeppers jonathanpeppers enabled auto-merge (squash) April 30, 2025 21:13
@jonathanpeppers jonathanpeppers merged commit 9d55c75 into main May 1, 2025
59 checks passed
@jonathanpeppers jonathanpeppers deleted the dev/peppers/runtime-msbuild-smoke-tests branch May 1, 2025 13:50
@github-actions github-actions bot locked and limited conversation to collaborators Jun 1, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants