feat: Test Android+Skia+NativeAOT on CI#1245
Conversation
40c33cf to
7fbd755
Compare
|
|
7fbd755 to
f7b3722
Compare
|
|
4a8f3c4 to
e4de85f
Compare
|
|
e4de85f to
aba1ed4
Compare
|
|
aba1ed4 to
57a060d
Compare
|
|
503ba25 to
7cfe258
Compare
There was a problem hiding this comment.
Pull request overview
Adds a CI integration test for Uno.Gallery that validates Android Skia + NativeAOT startup by building a NativeAOT APK, installing it on an emulator, and executing a minimal Android Instrumentation entrypoint to detect startup crashes.
Changes:
- Add an Android
Instrumentationclass used to validate app startup (no UI testing needed). - Introduce a new CI stage/jobs to build the Skia+NativeAOT APK and run the instrumentation on an emulator.
- Refactor emulator provisioning logic into a shared script and reuse it from the existing Android UI test runner script.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| Uno.Gallery/Platforms/Android/MainInstrumentation.Android.cs | Adds a minimal Instrumentation entrypoint for startup validation. |
| build/stage-tests-android.yml | New pipeline jobs to build and run the Android Skia+NativeAOT instrumentation test. |
| build/scripts/android-uitest-build.sh | Extends publish flags to support Skia builds vs native rendering builds. |
| build/scripts/android-uitest-run.sh | Reuses shared emulator provisioning script instead of duplicating logic inline. |
| build/scripts/android-test-run.sh | New script that installs the APK, runs instrumentation, and validates INSTRUMENTATION_CODE: -1. |
| build/scripts/android-sdk-emu.inc.sh | New shared script to provision Android SDK/emulator and boot an AVD. |
| azure-pipelines.yml | Adds a dedicated stage to execute the new instrumentation test jobs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
7cfe258 to
070857c
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
070857c to
da1edd2
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
da1edd2 to
5fe94ac
Compare
There was a problem hiding this comment.
LGTM. The shared android-sdk-emu.inc.sh extraction is a clean DRY improvement.
A few minor, non-blocking observations:
-
android-sdk-emu.inc.sh— mac-only default forCMDLINETOOLS: The default value iscommandlinetools-mac-8512546_latest.zip. Since the emulator job runs onmacos-14this works today, but if a future caller runs on Linux, they'd need to overrideCMDLINETOOLS. A comment noting this assumption would help future maintainers. -
android-sdk-emu.inc.sh— unconditional SDK level installs: The script installs platform levels 28, 34, 35, and 36 regardless of which API level the test actually targets (currently API 34 only). This is inherited from the originalandroid-uitest-run.sh, so not a regression, but could maybe be trimmed in a follow-up to save CI time. -
android-sdk-emu.inc.sh— commented-out shebang: Line 1 is# #!/usr/bin/env bash(commented). Since this file issourced rather than executed directly, the shebang is correctly absent — but the commented-out line is a bit unusual. Consider removing it or adding a brief note that this file is meant to be sourced.
5fe94ac to
7e2004c
Compare
Fixes: #1241 Context: unoplatform/uno#22676 Context: unoplatform/uno#22832 Context: unoplatform/uno#22834 Commit unoplatform/uno#22676 *broke* Android+Skia+NativeAOT startup; see also unoplatform/uno#22832. This is noticeable when building and launching Uno.Gallery for Android+Skia+NativeAOT: git clone https://github.com/unoplatform/Uno.Gallery.git cd Uno.Gallery git checkout b194399 # anything between 6.6.0-dev.92 and "the fix" will fail sed -i '' 's/"Uno.Sdk": ".*"/"Uno.Sdk": "6.6.0-dev.127"/g' global.json dotnet publish -m:1 -r android-x64 -f net10.0-android -p:TargetFrameworkOverride=net10.0-android \ -bl Uno.Gallery/Uno.Gallery.csproj -p:UseSkiaRendering=true -p:SkiaPublishAot=true \ "-p:ApplicationTitleVendorSuffix= (NAOT)" -p:ApplicationIdVendorSuffix=.naot adb logcat > log.txt & adb install Uno.Gallery/bin/Release/net10.0-android/android-x64/publish/com.nventive.uno.ui.demo.naot-Signed.apk adb shell am start com.nventive.uno.ui.demo.naot/crc64a57a145253f0f267.MainActivity After launching the app, it crashes with: E Java.InteropRuntime: JavaInteropRuntime.init: error: System.IO.FileNotFoundException: IO_FileNotFound_FileName, Uno.UI.BindingHelper.Android E JavaInteropRuntime: IO_FileName_Name, Uno.UI.BindingHelper.Android E JavaInteropRuntime: at Internal.Runtime.TypeLoaderExceptionHelper.CreateFileNotFoundException(ExceptionStringID, String) + 0x4a E JavaInteropRuntime: at Microsoft.Android.Runtime.ManagedTypeMapping.GetTypeByJniNameHashIndex(Int32) + 0x12 E JavaInteropRuntime: at Microsoft.Android.Runtime.ManagedTypeMapping.TryGetType(String, Type&) + 0x85 E JavaInteropRuntime: at Microsoft.Android.Runtime.ManagedTypeManager.<GetTypesForSimpleReference>d__6.MoveNext() + 0xd1 E JavaInteropRuntime: at Java.Interop.JniRuntime.JniTypeManager.<CreateGetTypesEnumerator>d__28.MoveNext() + 0x103 E JavaInteropRuntime: at Java.Interop.JniRuntime.JniValueManager.<CreatePeerInstance>g__GetTypeAssignableTo|28_0(JniTypeSignature, Type) + 0x54 E JavaInteropRuntime: at Java.Interop.JniRuntime.JniValueManager.CreatePeerInstance(JniObjectReference&, Type, JniObjectReference&, JniObjectReferenceOptions) + 0x69 E JavaInteropRuntime: at Java.Interop.JniRuntime.JniValueManager.CreatePeer(JniObjectReference&, JniObjectReferenceOpti E DOTNET : Unhandled exception. E DOTNET : System.IO.FileNotFoundException: IO_FileNotFound_FileName, Uno.UI.BindingHelper.Android E DOTNET : IO_FileName_Name, Uno.UI.BindingHelper.Android E DOTNET : at Internal.Runtime.TypeLoaderExceptionHelper.CreateFileNotFoundException(ExceptionStringID, String) + 0x4a E DOTNET : at Microsoft.Android.Runtime.ManagedTypeMapping.GetTypeByJniNameHashIndex(Int32) + 0x12 E DOTNET : at Microsoft.Android.Runtime.ManagedTypeMapping.TryGetType(String, Type&) + 0x85 E DOTNET : at Microsoft.Android.Runtime.ManagedTypeManager.<GetTypesForSimpleReference>d__6.MoveNext() + 0xd1 E DOTNET : at Java.Interop.JniRuntime.JniTypeManager.<CreateGetTypesEnumerator>d__28.MoveNext() + 0x103 E DOTNET : at System.Linq.Enumerable.TryGetFirstNonIterator[TSource](IEnumerable`1, Boolean&) + 0x53 E DOTNET : at Java.Interop.ManagedPeer.GetTypeFromSignature(JniRuntime.JniTypeManager, JniTypeSignature, String) + 0x6a E DOTNET : at Java.Interop.ManagedPeer.RegisterNativeMembers(IntPtr jnienv, IntPtr klass, IntPtr n_nativeClass, IntPtr n_methods) + 0x11d E DOTNET : --- End of stack trace from previous location --- E DOTNET : at Java.Interop. E DOTNET : --------- beginning of crash F libc : Fatal signal 6 (SIGABRT), code -6 (SI_TKILL) in tid 8165 (no.ui.demo.naot), pid 8165 (no.ui.demo.naot) F DEBUG : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** F DEBUG : Build fingerprint: 'google/sdk_gphone_x86_64/generic_x86_64:9/PSR1.180720.075/5124027:user/release-keys' F DEBUG : Revision: '0' F DEBUG : ABI: 'x86_64' F DEBUG : pid: 8165, tid: 8165, name: no.ui.demo.naot >>> com.nventive.uno.ui.demo.naot <<< F DEBUG : signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr -------- F DEBUG : rax 0000000000000000 rbx 0000000000001fe5 rcx 00007bee94d69b98 rdx 0000000000000006 F DEBUG : r8 00007ffe68c985b0 r9 00007ffe68c985b0 r10 00007ffe68c985b0 r11 0000000000000246 F DEBUG : r12 00007bedf85be38c r13 0000000000000000 r14 0000000000001fe5 r15 00007ffe68c986e8 F DEBUG : rdi 0000000000001fe5 rsi 0000000000001fe5 F DEBUG : rbp 00007ffe68c98730 rsp 00007ffe68c986d8 rip 00007bee94d69b98 F DEBUG : F DEBUG : backtrace: F DEBUG : #00 pc 0000000000026b98 /system/lib64/libc.so (syscall+24) F DEBUG : #1 pc 0000000000029775 /system/lib64/libc.so (abort+101) F DEBUG : #2 pc 0000000002dfc298 /data/app/com.nventive.uno.ui.demo.naot-G-PdZd4xCgJDY9vLPv4UWA==/lib/x86_64/libUno.Gallery.so (offset 0x2d0f000) F DEBUG : #3 pc 000000000363e5db /data/app/com.nventive.uno.ui.demo.naot-G-PdZd4xCgJDY9vLPv4UWA==/lib/x86_64/libUno.Gallery.so (offset 0x2d0f000) F DEBUG : #4 pc 0000000000dc1aff [anon:.bss:00007bedfaaab000] PR unoplatform/uno#22834 fixes the issue, but before we merge it we want an *integration test* that exercises this codepath. Uno.Gallery was chosen as the integration test app. :-) (It can't be in unoplatform/uno because to reproduce the bug it needs to build against published NuGet paackages, and unoplatform/uno only uses in-tree build artifacts; [see also][0].) Update Uno.Gallery so that CI includes a new set of jobs, which: 1. Builds Uno.Gallery for Android+Skia+NativeAOT, 2. Installs the resulting APK on an emulator, 3. Launches the app via a new `Instrumentation` subclass. We can't use "normal" UI Testing a'la f31954e because [Uno.UITest doesn't support Skia][1], and the crash descibed above *requires* a Skia environment to observe. As the crash is observed during app startup, we can instead use an `Instrumentation` which otherwise does nothing, then run: adb shell am instrument -w com.nventive.uno.ui.demo.naot/my.MainInstrumentation and check the output (logged to the executing console). If it has: INSTRUMENTATION_CODE: -1 then the app launched successfully; otherwise, Something Went Wrong™ (presumably it crashed). Note: Skia currently requires using API-34 for the emulator, in order to avoid https://github.com//unoplatform/uno/pull/22571. [0]: unoplatform/uno#22832 (comment) [1]: https://platform.uno/docs/articles/external/uno.uitest/doc/using-uno-uitest.html
7e2004c to
4244648
Compare
|
@agneszitte : thank you for the comments. They are all addressed in 4244648.
|
|
|
Fixes: #1241
Context: unoplatform/uno#22676
Context: unoplatform/uno#22832
Context: unoplatform/uno#22834
Commit unoplatform/uno#22676 broke Android+Skia+NativeAOT startup; see also unoplatform/uno#22832. This is noticeable when building and launching Uno.Gallery for Android+Skia+NativeAOT:
After launching the app, it crashes with:
PR unoplatform/uno#22834 fixes the issue, but before we merge it we want an integration test that exercises this codepath.
Uno.Gallery was chosen as the integration test app. :-)
(It can't be in unoplatform/uno because to reproduce the bug it needs to build against published NuGet paackages, and unoplatform/uno only uses in-tree build artifacts; see also.)
Update Uno.Gallery so that CI includes a new set of jobs, which:
Instrumentationsubclass.We can't use "normal" UI Testing a'la f31954e because Uno.UITest doesn't support Skia, and the crash descibed above requires a Skia environment to observe.
As the crash is observed during app startup, we can instead use an
Instrumentationwhich otherwise does nothing, then run:and check the output (logged to the executing console). If it has:
then the app launched successfully; otherwise, Something Went Wrong™ (presumably it crashed).
GitHub Issue: closes #
PR Type:
What is the current behavior? 🤔
What is the new behavior? 🚀
PR Checklist ✅
Please check if your PR fulfills the following requirements:
Screenshots Compare Test Runresults.Other information ℹ️