Skip to content

Commit

Permalink
Fix UT coverage to 100% (FreeRTOS#1053)
Browse files Browse the repository at this point in the history
* Update to 100% coverage

* Fix UT coverage
  • Loading branch information
moninom1 committed Dec 4, 2023
1 parent 8133702 commit d70a21c
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ jobs:
uses: FreeRTOS/CI-CD-Github-Actions/coverage-cop@main
with:
coverage-file: ./test/unit-test/build/coverage.info
branch-coverage-min: 100
line-coverage-min: 100

spell-check:
runs-on: ubuntu-latest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1863,6 +1863,10 @@ void test_FreeRTOS_get_tx_base_InvalidParams( void )
xSocket.ucProtocol = FREERTOS_IPPROTO_TCP;
pucReturn = FreeRTOS_get_tx_base( &xSocket );
TEST_ASSERT_EQUAL( NULL, pucReturn );

xSocket.u.xTCP.bits.bMallocError == pdTRUE_UNSIGNED;
pucReturn = FreeRTOS_get_tx_base( &xSocket );
TEST_ASSERT_EQUAL( NULL, pucReturn );
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,7 @@ void test_vSocketBind_TCP( void )
/**
* @brief Address passed is NULL.
*/
void test_vSocketBind_TCPNULLAddress( void )
void test_vSocketBind_TCPNULLAddress_v4( void )
{
BaseType_t xReturn;
FreeRTOS_Socket_t xSocket;
Expand All @@ -603,6 +603,30 @@ void test_vSocketBind_TCPNULLAddress( void )
memset( &xSocket, 0, sizeof( xSocket ) );

xSocket.ucProtocol = ( uint8_t ) FREERTOS_IPPROTO_TCP;
xSocket.bits.bIsIPv6 = 0;

xApplicationGetRandomNumber_ExpectAnyArgsAndReturn( pdFALSE );
xReturn = vSocketBind( &xSocket, NULL, uxAddressLength, xInternal );

TEST_ASSERT_EQUAL( -pdFREERTOS_ERRNO_EADDRNOTAVAIL, xReturn );
}

/**
* @brief Address passed is NULL.
*/
void test_vSocketBind_TCPNULLAddress_v6( void )
{
BaseType_t xReturn;
FreeRTOS_Socket_t xSocket;
struct freertos_sockaddr xBindAddress;
size_t uxAddressLength;
BaseType_t xInternal = pdFALSE;

memset( &xBindAddress, 0xFC, sizeof( xBindAddress ) );
memset( &xSocket, 0, sizeof( xSocket ) );

xSocket.ucProtocol = ( uint8_t ) FREERTOS_IPPROTO_TCP;
xSocket.bits.bIsIPv6 = 1;

xApplicationGetRandomNumber_ExpectAnyArgsAndReturn( pdFALSE );
xReturn = vSocketBind( &xSocket, NULL, uxAddressLength, xInternal );
Expand Down

0 comments on commit d70a21c

Please sign in to comment.