Skip to content

Conversation

@kar-rahul-aws
Copy link
Member

@kar-rahul-aws kar-rahul-aws commented May 27, 2024

Description

This PR removes unnecessary asserts from static functions. The NULL check for the pointer variables are unnecessary , since these are static functions and non-NULL values are always passed from the caller functions. As a result, the code coverage increases.

Test Steps

make -C build/ coverage
declare -a EXCLUDE=("\*test\*" "\*CMakeCCompilerId\*" "\*mocks\*" "\*vendor/unity\*" "\*_deps\*")
echo ${EXCLUDE[@]} | xargs lcov --rc lcov_branch_coverage=1 -r build/coverage.info -o build/coverage.info
lcov --rc lcov_branch_coverage=1 --list build/coverage.info

Before patch

                                   |Lines       |Functions  |Branches    
Filename                           |Rate     Num|Rate    Num|Rate     Num
=========================================================================
[/home/ubuntu/Temp/karahulx_coreMQTTFileStreams/aws-iot-core-mqtt-file-streams-embedded-c/source/]
MQTTFileDownloader.c               |97.3%    146| 100%     9|96.0%    100
MQTTFileDownloader_base64.c        |99.0%    103| 100%     4|85.2%     88
MQTTFileDownloader_cbor.c          | 100%     85| 100%     3| 100%     88
=========================================================================
                             Total:|98.5%    334| 100%    16|93.8%    276

After patch

                                   |Lines       |Functions  |Branches    
Filename                           |Rate     Num|Rate    Num|Rate     Num
=========================================================================
[/home/ubuntu/Temp/karahulx_coreMQTTFileStreams/aws-iot-core-mqtt-file-streams-embedded-c/source/]
MQTTFileDownloader.c               |97.3%    146| 100%     9|96.0%    100
MQTTFileDownloader_base64.c        |98.9%     95| 100%     4|93.1%     72
MQTTFileDownloader_cbor.c          | 100%     85| 100%     3| 100%     88
=========================================================================
                             Total:|98.5%    326| 100%    16|96.5%    260

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

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

@kar-rahul-aws kar-rahul-aws requested a review from a team as a code owner May 27, 2024 18:57
@kar-rahul-aws kar-rahul-aws merged commit e937cb2 into aws:main May 28, 2024
@kar-rahul-aws kar-rahul-aws deleted the update_code_coverage branch May 28, 2024 10:07
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