Skip to content

Commit

Permalink
test_lTCPWindowTxAdd_nothing_to_do(): Fix TCP window initialization
Browse files Browse the repository at this point in the history
Under Gcc 11, this expression in the tested function lTCPWindowTxAdd()
was always true, leading to imperfect coverage:

    pxSegment->lDataLength < pxSegment->lMaxLength

With Gcc 13, they were both 0.
Let's add zero-initialization to make this what's tested for.
  • Loading branch information
anordal committed Jun 4, 2024
1 parent 2dde1c6 commit 06479ce
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions test/unit-test/FreeRTOS_TCP_WIN/FreeRTOS_TCP_WIN_utest.c
Original file line number Diff line number Diff line change
Expand Up @@ -1050,13 +1050,14 @@ void test_lTCPWindowTxAdd_nothing_to_do( void )
{
int32_t lDone;
TCPWindow_t xWindow = { 0 };
TCPSegment_t xSegment = { 0 };
uint32_t ulLength = 0;
int32_t lPosition = 0;
int32_t lMax = 0;
BaseType_t xBackup = xTCPWindowLoggingLevel;

/* in real code, this points to a list of segments */
xWindow.pxHeadSegment = malloc( sizeof( TCPSegment_t ) );
xWindow.pxHeadSegment = &xSegment;

xTCPWindowLoggingLevel = 3;

Expand All @@ -1068,7 +1069,6 @@ void test_lTCPWindowTxAdd_nothing_to_do( void )
TEST_ASSERT_EQUAL( 0, lDone );

xTCPWindowLoggingLevel = xBackup;
free( xWindow.pxHeadSegment );
}

void test_lTCPWindowTxAdd_null_txSegment( void )
Expand Down

0 comments on commit 06479ce

Please sign in to comment.