Skip to content

Commit

Permalink
FreeRTOS_DHCP_utest: Fix it for Gcc 11
Browse files Browse the repository at this point in the history
Symptom:

The call to FreeRTOS_recvfrom_ExpectAndReturn() clearly specifies that
FreeRTOS_recvfrom() shall return the (NULL, 0) slice. But instead,
it returns a random pointer and a lenght of 1.
This happens only with Gcc 11 with AddressSanitizer,
but no other compiler does that with or without AddressSanitizer.

A random hunch:

All other calls to FreeRTOS_recvfrom_ExpectAndReturn() set
cmock_to_return=0 instead of 1.

Last ditch attempt before ditching Gcc 11:

I don't know what cmock_to_return is, but doing the same fixes
the last AddressSanitizer error under Gcc 11 run by CI, and of course
also works for all other builds I'm testing with.
  • Loading branch information
anordal committed May 28, 2024
1 parent 9c6a16e commit 467eda6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion test/unit-test/FreeRTOS_DHCP/FreeRTOS_DHCP_utest.c
Original file line number Diff line number Diff line change
Expand Up @@ -1586,7 +1586,7 @@ void test_vDHCPProcessEndPoint_eWaitingOfferNullUDPBuffer( void )

pxNetworkEndPoints = pxEndPoint;

FreeRTOS_recvfrom_ExpectAndReturn( xDHCPv4Socket, NULL, 0UL, FREERTOS_ZERO_COPY, NULL, NULL, 1 );
FreeRTOS_recvfrom_ExpectAndReturn( xDHCPv4Socket, NULL, 0UL, FREERTOS_ZERO_COPY, NULL, NULL, 0 );
/* Ignore the buffer argument though. */
FreeRTOS_recvfrom_IgnoreArg_pvBuffer();

Expand Down

0 comments on commit 467eda6

Please sign in to comment.