[mobile] Skip GetMaxCompressedLength test on mobile platforms#127081
[mobile] Skip GetMaxCompressedLength test on mobile platforms#127081github-actions[bot] wants to merge 2 commits intomainfrom
Conversation
The GetMaxCompressedLength_MatchesNativeCompressBound test compares the managed DeflateEncoder.GetMaxCompressedLength() against the native zlib compressBound() function. The managed implementation uses the zlib-ng formula, but mobile platforms (Android and Apple) use classic zlib, which returns different values for certain input sizes. This fix adds IsNotMobile to the ConditionalTheory attribute to skip the test on all mobile platforms where the native zlib implementation differs. Fixes test failures in build 1383320: - android-arm Release AllSubsets_Mono - android-arm64 Release AllSubsets_Mono - (Preemptively prevents failures on iOS/tvOS/MacCatalyst) Helix job: 730b4b98-bd0b-4578-99bc-0cb6a8eb9289 Work item: System.IO.Compression.Tests Closes #127080 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Tagging subscribers to 'os-ios': @vitek-karas, @kotlarmilos, @steveisok, @akoeplinger |
There was a problem hiding this comment.
Pull request overview
This PR addresses mobile CI failures in System.IO.Compression.Tests by preventing a platform-dependent assertion from running on platforms where the native zlib compressBound() behavior differs from the managed DeflateEncoder.GetMaxCompressedLength() implementation.
Changes:
- Update
GetMaxCompressedLength_MatchesNativeCompressBoundto be conditionally skipped on “mobile” platforms viaPlatformDetection.IsNotMobile.
|
/azp run runtime-extra-platforms |
|
Azure Pipelines successfully started running 1 pipeline(s). |
The value returned by Are the values returned by |
Fixes test failure on Android mobile platforms discovered in build #1383320.
Failure
Test:
System.IO.Compression.DeflateEncoderDecoderTests.GetMaxCompressedLength_MatchesNativeCompressBoundHelix job:
730b4b98-bd0b-4578-99bc-0cb6a8eb9289Work item:
System.IO.Compression.TestsPlatform: android-arm, android-arm64 (also affects iOS, tvOS, MacCatalyst)
Root cause
This test compares the managed
DeflateEncoder.GetMaxCompressedLength()against the native zlibcompressBound()function. The managed implementation (added in #123145) uses the zlib-ng formula for calculating the maximum compressed buffer size:However, mobile platforms use classic zlib, not zlib-ng. The classic zlib
compressBound()returns different values for certain input sizes, causing assertion failures:Fix
Skip the test on all mobile platforms by adding
nameof(PlatformDetection.IsNotMobile)to theConditionalTheoryattribute. The managed implementation remains correct for its intended use (calculating buffer sizes), but this test cannot validate it against classic zlib.Testing
The test will be skipped on Android, iOS, tvOS, and MacCatalyst in the
runtime-extra-platformspipeline. Desktop platforms will continue to run the test with zlib-ng.Note
This PR was created by GitHub Copilot after analyzing mobile platform CI failures in the runtime-extra-platforms pipeline.
Closes #127080