Skip to content

peimage: Add test suite for PE parsing#36

Merged
kukrimate merged 1 commit intomainfrom
copilot/analyze-test-coverage
Apr 8, 2026
Merged

peimage: Add test suite for PE parsing#36
kukrimate merged 1 commit intomainfrom
copilot/analyze-test-coverage

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 7, 2026

  • Fix build_pe doc comment (inaccurate statement about virtual section data)
  • Add test_virtual_sections_correct_data — verify iterator returns Ok with correct data when VA is in-bounds
  • Fix test_virtual_sections_out_of_bounds_returns_truncated — assert in-bounds case first, then corrupt
  • Fix test_relocate_into_success — pre-fill pages with 0xAA so the zero-fill assertion is meaningful

@julian-klode julian-klode marked this pull request as ready for review April 7, 2026 18:26
Copilot AI review requested due to automatic review settings April 7, 2026 18:27
@julian-klode julian-klode force-pushed the copilot/analyze-test-coverage branch from ca88cdb to 0d293f9 Compare April 7, 2026 18:28
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an in-file unit test suite to lace-util’s PE parsing module (peimage.rs) to exercise parsing, section iteration, relocation, and error formatting paths for PE64 images.

Changes:

  • Introduces a build_pe helper to construct minimal PE64 byte images for tests using zerocopy::IntoBytes.
  • Adds unit tests for parse_pe, SectionHeader::name, section iterators, relocate_into, and PeError display strings.
  • Adds targeted header corruption in tests via offset_of! to hit specific error branches.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

Agent-Logs-Url: https://github.com/canonical/lace/sessions/58459055-4e10-4849-9eff-cdfd637c915f

Co-authored-by: julian-klode <6325588+julian-klode@users.noreply.github.com>
@julian-klode julian-klode force-pushed the copilot/analyze-test-coverage branch from 6305b48 to e5ab3e9 Compare April 7, 2026 19:01
Copy link
Copy Markdown
Contributor

@julian-klode julian-klode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well this is somewhat ok, I'd love some integration tests but also end-to-end boot integration tests will cover that so, this is enough perhaps

@julian-klode julian-klode requested a review from kukrimate April 7, 2026 19:12
@kukrimate kukrimate merged commit c632596 into main Apr 8, 2026
15 checks passed
@kukrimate kukrimate deleted the copilot/analyze-test-coverage branch April 8, 2026 09:24
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.

4 participants