Skip to content

Improve code coverage for zip module error paths#1555

Merged
d-e-s-o merged 1 commit intolibbpf:mainfrom
d-e-s-o:topic/zip-cov
Apr 24, 2026
Merged

Improve code coverage for zip module error paths#1555
d-e-s-o merged 1 commit intolibbpf:mainfrom
d-e-s-o:topic/zip-cov

Conversation

@d-e-s-o
Copy link
Copy Markdown
Collaborator

@d-e-s-o d-e-s-o commented Apr 24, 2026

Code coverage of our zip module is comparably low, but solely so because of the various error conditions that we don't explicitly test.

Add a bunch of tests that each corrupt specific bytes in the archive to trigger a different error path: invalid local file header magic, unsupported entry flags (encryption), invalid central directory header magic, truncated central directory records, multi-disk archive rejection, undersized archives, and out-of-bounds central directory ranges. In so doing we drastically improve coverage for this module.

Code coverage of our zip module is comparably low, but solely so because
of the various error conditions that we don't explicitly test.

Add a bunch of tests that each corrupt specific bytes in the archive to
trigger a different error path: invalid local file header magic,
unsupported entry flags (encryption), invalid central directory header
magic, truncated central directory records, multi-disk archive
rejection, undersized archives, and out-of-bounds central directory
ranges. In so doing we drastically improve coverage for this module.

Signed-off-by: Daniel Müller <deso@posteo.net>
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 24, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.74%. Comparing base (bf0766b) to head (d3ebe11).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1555      +/-   ##
==========================================
+ Coverage   95.50%   95.74%   +0.23%     
==========================================
  Files          56       56              
  Lines        9551     9549       -2     
==========================================
+ Hits         9122     9143      +21     
+ Misses        429      406      -23     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@d-e-s-o
Copy link
Copy Markdown
Collaborator Author

d-e-s-o commented Apr 24, 2026

99.32% coverage of zip.rs, +14.29% 👍

@d-e-s-o d-e-s-o merged commit 017ba3b into libbpf:main Apr 24, 2026
46 checks passed
@d-e-s-o d-e-s-o deleted the topic/zip-cov branch April 24, 2026 18:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant