Skip to content

Conversation

@makubacki
Copy link
Collaborator

Description


Note: The debug asserts in the component parameter validation code in the first phase of enforcing strong parameter validation as described in #1122.


patina_dxe_core/image: Remove debug asserts from unit tests

Closes #1108

  • Return EfiError::LoadError for an invalid HII resource section.
  • Remove complex logic in some unit tests for testing different
    conditions with debug asserts enabled or disabled.

Remove debug_assert!() expectations in unit tests

Debug assertions will no longer be enabled when running unit tests.

While the assertions can still be used in the code, they are removed
from unit test expectations.


Disable debug assertions in the test profile

Closes #1054

To have unit tests stay focused on production expectations and
reduce complexity in tests for managing debug assertions, debug
assertions are disabled in the test profile.

  • Debug asserts may still be used but we're avoiding writing tests
    around them
  • Non-debug asserts may be used and tested in unit tests

  • Impacts functionality?
  • Impacts security?
  • Breaking change?
  • Includes tests?
  • Includes documentation?

How This Was Tested

  • cargo make all

Integration Instructions

  • N/A

@makubacki makubacki self-assigned this Nov 26, 2025
@github-actions github-actions bot added the impact:testing Affects testing label Nov 26, 2025
@codecov
Copy link

codecov bot commented Nov 26, 2025

Codecov Report

❌ Patch coverage is 58.33333% with 10 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
patina_dxe_core/src/allocator.rs 60.87% 9 Missing ⚠️
patina_dxe_core/src/image.rs 0.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

- Return `EfiError::LoadError` for an invalid HII resource section.
- Remove complex logic in some unit tests for testing different
  conditions with debug asserts enabled or disabled.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
@makubacki makubacki force-pushed the remove_debug_asserts_in_tests branch from 6beb605 to 3032587 Compare November 26, 2025 22:44
@makubacki makubacki enabled auto-merge (rebase) November 26, 2025 22:44
@makubacki makubacki force-pushed the remove_debug_asserts_in_tests branch from 3032587 to 4c73df3 Compare November 26, 2025 23:17
Debug assertions will no longer be enabled when running unit tests.

While the assertions can still be used in the code, they are removed
from unit test expectations.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
To have unit tests stay focused on production expectations and
reduce complexity in tests for managing debug assertions, debug
assertions are disabled in the `test` profile.

- Debug asserts may still be used but we're avoiding writing tests
  around them
- Non-debug asserts may be used and tested in unit tests

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
@makubacki makubacki force-pushed the remove_debug_asserts_in_tests branch from 4c73df3 to 2f00bc5 Compare November 26, 2025 23:28
@makubacki makubacki disabled auto-merge November 26, 2025 23:46
@makubacki makubacki merged commit 07e885b into OpenDevicePartnership:main Nov 26, 2025
7 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

impact:testing Affects testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Replace debug_assert() in core_load_pe_image() with return value [Tests]: Run Tests With Debug Asserts Disabled

4 participants