Skip to content

Update unit tests to work with asserts enabled #322

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jun 11, 2025

Conversation

DakshitBabbar
Copy link
Member

@DakshitBabbar DakshitBabbar commented May 28, 2025

Description

This PR solves the Issue #321.

Learning: Unit tests are supposed to be built with asserts enabled during the development process. But when these are built for coverage analysis these should be built with asserts disabled. This is because the lcov tool would consider all the branches in the asserts as uncovered.

This PR:

  1. Update the unit tests to work with asserts enabled
  2. Update the code to have 100% branch coverage. To achieve this, one branch which was logically unreachable, was excluded from the coverage analysis.
  3. Updates the CI checks to build the code with asserts to check if all the unit tests are working as expected. Along with this it will also build the code without asserts to check coverage.
  4. Updates the command in the README.md that users should use to build the unit tests. This command has asserts disabled, as asserts are only required during the development process of the unit tests.

Test Steps

The unit tests are building and running successfully with asserts. They also give 100% coverage without asserts.

Checklist:

  • I have tested my changes. No regression in existing tests.
  • I have modified and/or added unit-tests to cover the code changes in this Pull Request.

Related Issue

#321

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@DakshitBabbar DakshitBabbar changed the title Utupdate Update unit tests to work with asserts enabled May 28, 2025
@DakshitBabbar DakshitBabbar merged commit d7b04a1 into FreeRTOS:main Jun 11, 2025
41 of 44 checks passed
@DakshitBabbar DakshitBabbar deleted the utupdate branch June 11, 2025 09:22
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.

3 participants