[tests] Make DotNetPublish pack assertions deterministic - #12359
Merged
Conversation
Assert against the reference and runtime pack paths resolved in MSBuild's detailed output instead of relying on filesystem enumeration order. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 2e8c3c1d-c95e-4d35-ad95-0ff027d776f0
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the XASdkTests.DotNetPublish assertions to avoid relying on unspecified filesystem enumeration order when selecting installed Android workload packs, making the test outcome deterministic and validating that MSBuild actually resolved the expected pack paths.
Changes:
- Replaced “pick last directory” logic with a deterministic assertion that exactly one installed pack path matches what MSBuild used.
- Captured detailed
dotnet publishoutput once and reused it for both ref/runtime pack assertions. - Added a small helper (
AssertUsingPack) to centralize and tighten the pack-resolution validation.
Keep AssertUsingPack generic by deriving its search filename from the supplied assembly path. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 2e8c3c1d-c95e-4d35-ad95-0ff027d776f0
Member
Author
|
@dalexsoto review |
dalexsoto
approved these changes
Aug 12, 2026
dalexsoto
left a comment
Member
There was a problem hiding this comment.
Pack assertions now select the logged framework pack deterministically across configurations, and exact-head tests cover the changed paths.
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.
Changes
XASdkTests.DotNetPublishMicrosoft.Android.Refand managedMicrosoft.Android.Runtimepaths actually resolved in MSBuild's detailed outputRoot cause
Directory.GetDirectories(...).LastOrDefault()used unspecified filesystem enumeration order, so a stale side-by-side pack could be selected as the expected path even when MSBuild resolved another installed version.Validation
dotnet-local.cmd build src\Xamarin.Android.Build.Tasks\Tests\Xamarin.Android.Build.Tests\Xamarin.Android.Build.Tests.csproj -c Debug --no-restore -v:minimalThe focused
DotNetPublishrun was also attempted, but this worktree could not produce the full local workload because native runtime outputbin\Debug\lib\runtimes\mono\android-arm\libmono-android.debug.sowas unavailable.binlogtoolconfirmed the test stopped at workload resolution before reaching the changed assertion.