openthread / ot-br-posix

OpenThread Border Router, a Thread border router for POSIX-based platforms.
https://openthread.io/
BSD 3-Clause "New" or "Revised" License
421 stars 235 forks source link

[test] add unit test framework for ThreadHost APIs (RCP) #2549

Closed Irving-cl closed 1 month ago

Irving-cl commented 1 month ago

This PR adds a unit test framework for testing ThreadHost APIs (RCP).

It's implemeneted by building rcp_host.cpp with FakePlatform in OT. A few small changes are done to make this work:

This PR also implements the first unit test case to test the RcpHost::SetThreadEnabled method.

codecov[bot] commented 1 month ago

Codecov Report

Attention: Patch coverage is 65.90909% with 30 lines in your changes missing coverage. Please review.

Project coverage is 45.78%. Comparing base (2b41187) to head (f9f1517). Report is 839 commits behind head on main.

Files with missing lines Patch % Lines
tests/gtest/test_rcp_host_api.cpp 78.18% 10 Missing and 2 partials :warning:
src/common/logging.cpp 50.00% 9 Missing :warning:
tests/gtest/fake_posix_platform.cpp 40.00% 9 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #2549 +/- ## ========================================== - Coverage 55.77% 45.78% -9.99% ========================================== Files 87 104 +17 Lines 6890 12274 +5384 Branches 0 895 +895 ========================================== + Hits 3843 5620 +1777 - Misses 3047 6346 +3299 - Partials 0 308 +308 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.