[tests] Improve trimmer warning diagnostics#11981
Open
simonrozsival wants to merge 1 commit into
Open
Conversation
Report the parsed warning summary and the warning lines found when BuildHasTrimmerWarnings gets an unexpected warning count. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Improves diagnostics in the BuildHasTrimmerWarnings test to make trimmer-warning failures easier to understand by extracting the warning summary count and printing the warning lines found when expectations don’t match.
Changes:
- Parse the MSBuild warning summary line (
N Warning(s)) and compare the parsed count to the expected total. - Collect and print up to 25 warning lines (
: warning) in assertion failures to aid debugging. - Add a local helper (
GetWarningCount) to parse the summary line.
Show a summary per file
| File | Description |
|---|---|
| src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/BuildTest2.cs | Enhances BuildHasTrimmerWarnings failure output by parsing the warning summary and printing captured warning lines. |
Copilot's findings
- Files reviewed: 1/1 changed files
- Comments generated: 1
Comment on lines
+607
to
+611
| string warningSummaryLine = b.LastBuildOutput.LastOrDefault (line => line.Contains ("Warning(s)", StringComparison.Ordinal)) ?? ""; | ||
| var actualWarnings = GetWarningCount (warningSummaryLine); | ||
|
|
||
| var allWarningLines = b.LastBuildOutput | ||
| .Where (line => line.Contains (": warning ", StringComparison.OrdinalIgnoreCase)) |
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.
Improve the failure message in BuildHasTrimmerWarnings by parsing the warning summary and printing the warning lines found when the expected count does not match.
Split out from #11669 so the RuntimeFeature PR stays focused.