Add NativeAOT publish smoke test (win-x64, linux-x64, osx-arm64) - #2061
Merged
Conversation
Adds test/OpenCvSharp.Tests.NativeAot, a plain console app published with PublishAot=true that exercises drawing, the ORB/OpenCL-probe path, an ImEncode/ImDecode codec round trip, and Cv2.Dnn.BlobFromImage - the same end-to-end surface OpenCvSharp.Tests.Wasm's E2E test covers, but through CoreCLR's ILCompiler instead of Blazor wasm's Mono AOT compiler. Also fixes a real NETSDK1207 failure this surfaced: OpenCvSharp.csproj's ProjectReference to the netstandard2.0 OpenCvSharp.Analyzers project was propagating PublishAot/RuntimeIdentifier down to it, which any consumer publishing with PublishAot would hit regardless of this test project.
Resolves the OpenCvSharp.sln/.slnx conflict: main migrated to the .slnx format (#2059) while this branch still edited the old .sln, so the new NativeAOT test project is registered in OpenCvSharp.slnx instead.
opencv_videoio_ffmpeg500_64.dll is only conditionally copied by CMake's POST_BUILD step (guarded by an EXISTS check), so it isn't guaranteed to be there - and this smoke test never exercises video/ffmpeg, so it was never needed. Fixes the win-x64 CI failure from PR #2061.
…deps A second `apt-get update` after the 1700+ test run in this Docker stage hit a reproducible apt-get segfault (twice in a row on PR #2061's CI): apt printed "libapt-private.so.0.0: no version information available" and then crashed with SIGSEGV before installing anything. Root cause unconfirmed, but consolidating into the one apt-get pass at the top of the stage (before the heavy dotnet build/test run) sidesteps it and is cleaner regardless.
Contributor
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (7)
📝 WalkthroughWalkthroughAdds a net10.0 NativeAOT console smoke test covering core OpenCV operations, integrates it into the solution, configures AOT build dependencies, and runs published binaries in macOS, Windows, and Linux validation environments. ChangesNativeAOT validation
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant CI
participant dotnet
participant NativeAOTApp
participant OpenCvSharpExtern
CI->>dotnet: restore NativeAOT project
CI->>dotnet: publish with PublishAot=true
CI->>NativeAOTApp: run published executable
NativeAOTApp->>OpenCvSharpExtern: perform OpenCV operations
OpenCvSharpExtern-->>NativeAOTApp: return image, ORB, and DNN results
NativeAOTApp-->>CI: exit 0 or exit 1
Possibly related PRs
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Opening as draft to watch CI on win-x64/linux-x64/osx-arm64 before marking ready.
Adds
test/OpenCvSharp.Tests.NativeAot, a plain console app published withPublishAot=truethat exercises drawing, the ORB/OpenCL-probe path, an ImEncode/ImDecode codec round trip, andCv2.Dnn.BlobFromImage- the same end-to-end surfaceOpenCvSharp.Tests.Wasm's E2E test covers (seeopencvsharp_blazor_sample#8/#11, which hit a Mono AOT compiler crash onOpenCvSharp.dll's large P/Invoke surface), but through CoreCLR's ILCompiler instead of Blazor wasm's Mono AOT compiler. Locally,win-x64publishes and runs cleanly end-to-end against the real native binary, andlinux-x64publishes/links cleanly (not yet run against a real.solocally - too slow to build OpenCV from scratch just for this check).osx-arm64is untested locally (no Mac available); this PR's CI run is its first real signal.Also fixes a real
NETSDK1207failure this surfaced:OpenCvSharp.csproj'sProjectReferenceto the netstandard2.0OpenCvSharp.Analyzersproject was propagatingPublishAot/RuntimeIdentifierdown to it, which any consumer publishing withPublishAotwould hit regardless of this test project.Test plan
win-x64:dotnet publish -p:PublishAot=truesucceeds with 0 trim/AOT warnings; published exe runs and printsok: ...(verified locally)linux-x64: same publish command succeeds inside a plainmcr.microsoft.com/dotnet/sdk:10.0-noblecontainer withclang/zlib1g-devinstalled (verified locally, link step only - not run against a real.so)osx-arm64: relies on this PR's CI runwindows.yml,docker-test-ubuntu.yml,macos.yml) added/changed here🤖 Generated with Claude Code
Summary by CodeRabbit