-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Increase unit test code coverage of ble/ by 1.6%
#39618
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
Increase unit test code coverage of ble/ by 1.6%
#39618
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds new unit tests for the BtpEngine::HandleCharacteristicSend method in the ble module to increase the overall test coverage for BLE packet handling.
- Added tests for single packet send with acknowledgment
- Added tests for multi-packet sends with both correct and incorrect acknowledgment sequences
- Added tests to validate rejection of new sends during an in-progress transmission and to check error handling when packet buffers have insufficient headroom
Comments suppressed due to low confidence (1)
src/ble/tests/TestBtpEngine.cpp:274
- [nitpick] Consider using System::PacketBufferHandle::New consistently for creating packet buffers across all tests to improve clarity and maintain conformity in naming.
auto packet0 = PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSize, 0);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This PR increases ble unit test coverage by adding comprehensive unit tests for the BtpEngine::HandleCharacteristicSend method. The new tests cover various scenarios for BLE packet transmission, including sending single and multi-packet payloads, testing acknowledgment sequences, ensuring the engine rejects new sends until the previous payload is fully acknowledged, and handling cases where the packet buffer lacks sufficient headroom. The added tests are well-structured and contribute positively to code quality. The review includes suggestions to enhance clarity in test naming and comments.
|
PR #39618: Size comparison from 0657d7d to daa2e08 Full report (3 builds for cc32xx, stm32)
|
|
PR #39618: Size comparison from 0657d7d to 6c8b592 Full report (48 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, nrfconnect, psoc6, qpg, stm32, telink, tizen)
|
|
PR #39618: Size comparison from 0657d7d to 1c2d19f Full report (3 builds for cc32xx, stm32)
|
1c2d19f to
de4d19d
Compare
|
PR #39618: Size comparison from 0657d7d to de4d19d Full report (71 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, linux, nrfconnect, nxp, psoc6, qpg, stm32, telink, tizen)
|
de4d19d to
4d03fb4
Compare
|
PR #39618: Size comparison from a8ab4d5 to 4d03fb4 Full report (3 builds for cc32xx, stm32)
|
dd0e897 to
8cd5ed2
Compare
|
PR #39618: Size comparison from 0bac726 to 8cd5ed2 Full report (3 builds for cc32xx, stm32)
|
d824df8 to
be66643
Compare
|
PR #39618: Size comparison from 0bac726 to be66643 Full report (71 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, linux, nrfconnect, nxp, psoc6, qpg, stm32, telink, tizen)
|
yunhanw-google
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you!
|
PR #39618: Size comparison from 3c9946c to ee8c42a Full report (71 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, linux, nrfconnect, nxp, psoc6, qpg, stm32, telink, tizen)
|
ee8c42a to
0fc0434
Compare
|
PR #39618: Size comparison from 852d123 to 0fc0434 Full report (71 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, linux, nrfconnect, nxp, psoc6, qpg, stm32, telink, tizen)
|
- Added test for HandleCharacteristicSend with empthy packet with ACK
-Added test to verify with one packet and acknowledgment requestes
0fc0434 to
cf1571e
Compare
|
PR #39618: Size comparison from 2d454ec to cf1571e Full report (71 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, linux, nrfconnect, nxp, psoc6, qpg, stm32, telink, tizen)
|
* Add unit tests for BrpEngine - Added test for HandleCharacteristicSend with empthy packet with ACK * Add unit test for HandleCharacteristicSend -Added test to verify with one packet and acknowledgment requestes * Added test for insufficient headroom * Changeed structure of tests and add tests * Added the new test for send two packets with correct usage of ack * Added HandleCharacteristicSendRejectsNewSendUntilPreviousAcked test * Corrections in HandleCharacteristicSendInsufficientHeadroom test * Added comments * Update TestBtpEngine.cpp * Update TestBtpEngine.cpp * Update TestBtpEngine.cpp * Defined named constants for header size and expected packet lengths * Fix for clang-format * Corrected variables types
Summary
This PR increases
bleunit test coverage from 65.6% to 67.2% by adding comprehensive unit tests for theBtpEngine::HandleCharacteristicSendmethod inTestBtpEngine. The new tests cover various scenarios for BLE packet transmission, including:Related issues
Main issue #37232
Testing
This PR only adds new unit tests. No changes made to production code.