Skip to content

Commit

Permalink
Fix Tests
Browse files Browse the repository at this point in the history
  • Loading branch information
HTRamsey committed Aug 25, 2024
1 parent 6a8b501 commit a7b9759
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 14 deletions.
1 change: 1 addition & 0 deletions .github/.cSpellWords.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1263,6 +1263,7 @@ STLIDMPUSR
STLIMPUOR
STLNVICACTVOR
STLNVICPENDOR
Storex
strbt
STRBT
strexb
Expand Down
10 changes: 5 additions & 5 deletions test/unit-test/FreeRTOS_ARP/FreeRTOS_ARP_utest.c
Original file line number Diff line number Diff line change
Expand Up @@ -1961,7 +1961,7 @@ void test_eARPGetCacheEntryByMac_NoMatchingEntries( void )
eResolutionLookupResult_t eResult;
MACAddress_t xMACAddress = { 0x22, 0x22, 0x22, 0x22, 0x22, 0x22 };
int i;
struct xNetworkInterface * xInterface;
NetworkInterface_t xInterface, * pxInterface = &xInterface;

/* =================================================== */
/* Make sure no entry matches. */
Expand All @@ -1971,7 +1971,7 @@ void test_eARPGetCacheEntryByMac_NoMatchingEntries( void )
memset( xARPCache[ i ].xMACAddress.ucBytes, 0x11, sizeof( xMACAddress.ucBytes ) );
}

eResult = eARPGetCacheEntryByMac( &xMACAddress, &ulIPAddress, &xInterface );
eResult = eARPGetCacheEntryByMac( &xMACAddress, &ulIPAddress, &pxInterface );
TEST_ASSERT_EQUAL( eResolutionCacheMiss, eResult );
TEST_ASSERT_EQUAL( 0x12345678, ulIPAddress );
/* =================================================== */
Expand All @@ -1984,7 +1984,7 @@ void test_eARPGetCacheEntryByMac_OneMatchingEntry( void )
MACAddress_t xMACAddress = { 0x22, 0x22, 0x22, 0x22, 0x22, 0x22 };
int i;
NetworkEndPoint_t xNetworkEndPoint = { 0 };
NetworkInterface_t xInterface, * pxInterface = NULL;
NetworkInterface_t xInterface, * pxInterface = &xInterface;

xNetworkEndPoint.pxNetworkInterface = &xInterface;

Expand All @@ -2000,7 +2000,7 @@ void test_eARPGetCacheEntryByMac_OneMatchingEntry( void )
ulEntryToTest = 1;
memset( xARPCache[ ulEntryToTest ].xMACAddress.ucBytes, 0x22, sizeof( xMACAddress.ucBytes ) );
xARPCache[ ulEntryToTest ].ulIPAddress = 0xAABBCCEE;
eResult = eARPGetCacheEntryByMac( &xMACAddress, &ulIPAddress, &xInterface );
eResult = eARPGetCacheEntryByMac( &xMACAddress, &ulIPAddress, &pxInterface );
TEST_ASSERT_EQUAL( eResolutionCacheHit, eResult );
TEST_ASSERT_EQUAL( xARPCache[ ulEntryToTest ].ulIPAddress, ulIPAddress );
TEST_ASSERT_EQUAL( &xInterface, pxInterface );
Expand All @@ -2010,7 +2010,7 @@ void test_eARPGetCacheEntryByMac_OneMatchingEntry( void )
TEST_ASSERT_EQUAL( xARPCache[ ulEntryToTest ].ulIPAddress, ulIPAddress );
/* =================================================== */
xARPCache[ ulEntryToTest ].pxEndPoint = NULL;
eResult = eARPGetCacheEntryByMac( &xMACAddress, &ulIPAddress, &xInterface );
eResult = eARPGetCacheEntryByMac( &xMACAddress, &ulIPAddress, &pxInterface );
TEST_ASSERT_EQUAL( eResolutionCacheHit, eResult );
TEST_ASSERT_EQUAL( xARPCache[ ulEntryToTest ].ulIPAddress, ulIPAddress );
/* =================================================== */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ list(APPEND mock_define_list
# list the files you would like to test here
set(real_source_files "")
list(APPEND real_source_files
${CMAKE_BINARY_DIR}/Annexed_TCP_Sources/${project_name}.c
${CMAKE_BINARY_DIR}/Annexed_TCP_Sources/FreeRTOS_ARP.c
)
# list the directories the module under test includes
set(real_include_directories "")
Expand Down
16 changes: 8 additions & 8 deletions test/unit-test/FreeRTOS_IP/FreeRTOS_IP_utest.c
Original file line number Diff line number Diff line change
Expand Up @@ -2116,7 +2116,7 @@ void test_prvProcessEthernetPacket_ARPFrameType2( void )

/**
* @brief test_prvProcessEthernetPacket_ARPFrameType_WaitingARPResolution
* To validate the flow to handle ARP packets but eARPProcessPacket() returns eWaitingARPResolution
* To validate the flow to handle ARP packets but eARPProcessPacket() returns eWaitingResolution
* without pxARPWaitingNetworkBuffer.
*/
void test_prvProcessEthernetPacket_ARPFrameType_WaitingARPResolution( void )
Expand All @@ -2141,7 +2141,7 @@ void test_prvProcessEthernetPacket_ARPFrameType_WaitingARPResolution( void )

pxEthernetHeader->usFrameType = ipARP_FRAME_TYPE;

eARPProcessPacket_ExpectAndReturn( pxNetworkBuffer, eWaitingARPResolution );
eARPProcessPacket_ExpectAndReturn( pxNetworkBuffer, eWaitingResolution );

vIPTimerStartARPResolution_ExpectAnyArgs();

Expand All @@ -2150,7 +2150,7 @@ void test_prvProcessEthernetPacket_ARPFrameType_WaitingARPResolution( void )

/**
* @brief test_prvProcessEthernetPacket_ARPFrameType_WaitingARPResolution2
* To validate the flow to handle ARP packets but eARPProcessPacket() returns eWaitingARPResolution
* To validate the flow to handle ARP packets but eARPProcessPacket() returns eWaitingResolution
* with pxARPWaitingNetworkBuffer.
*/
void test_prvProcessEthernetPacket_ARPFrameType_WaitingARPResolution2( void )
Expand All @@ -2175,7 +2175,7 @@ void test_prvProcessEthernetPacket_ARPFrameType_WaitingARPResolution2( void )

pxEthernetHeader->usFrameType = ipARP_FRAME_TYPE;

eARPProcessPacket_ExpectAndReturn( pxNetworkBuffer, eWaitingARPResolution );
eARPProcessPacket_ExpectAndReturn( pxNetworkBuffer, eWaitingResolution );

vReleaseNetworkBufferAndDescriptor_Expect( pxNetworkBuffer );

Expand Down Expand Up @@ -2489,7 +2489,7 @@ void test_prvProcessIPPacket_ValidHeader_ARPResolutionReqd( void )

eResult = prvProcessIPPacket( pxIPPacket, pxNetworkBuffer );

TEST_ASSERT_EQUAL( eWaitingARPResolution, eResult );
TEST_ASSERT_EQUAL( eWaitingResolution, eResult );
}

/**
Expand Down Expand Up @@ -2830,7 +2830,7 @@ void test_prvProcessIPPacket_ARPResolutionReqd_UDP( void )

eResult = prvProcessIPPacket( pxIPPacket, pxNetworkBuffer );

TEST_ASSERT_EQUAL( eWaitingARPResolution, eResult );
TEST_ASSERT_EQUAL( eWaitingResolution, eResult );
TEST_ASSERT_EQUAL( FreeRTOS_ntohs( pxUDPPacket->xUDPHeader.usLength ) - sizeof( UDPHeader_t ) + sizeof( UDPPacket_t ), pxNetworkBuffer->xDataLength );
TEST_ASSERT_EQUAL( pxNetworkBuffer->usPort, pxUDPPacket->xUDPHeader.usSourcePort );
TEST_ASSERT_EQUAL( pxNetworkBuffer->xIPAddress.ulIP_IPv4, pxUDPPacket->xIPHeader.ulSourceIPAddress );
Expand Down Expand Up @@ -2881,7 +2881,7 @@ void test_prvProcessIPPacket_ARPResolutionReqd_UDP1( void )

eResult = prvProcessIPPacket( pxIPPacket, pxNetworkBuffer );

TEST_ASSERT_EQUAL( eWaitingARPResolution, eResult );
TEST_ASSERT_EQUAL( eWaitingResolution, eResult );
TEST_ASSERT_EQUAL( pxNetworkBuffer->usPort, pxUDPPacket->xUDPHeader.usSourcePort );
TEST_ASSERT_EQUAL( pxNetworkBuffer->xIPAddress.ulIP_IPv4, pxUDPPacket->xIPHeader.ulSourceIPAddress );
}
Expand Down Expand Up @@ -3360,7 +3360,7 @@ void test_prvProcessIPPacket_TCP_IPv6_ARPResolution( void )

eResult = prvProcessIPPacket( ( IPPacket_t * ) pxIPPacket, pxNetworkBuffer );

TEST_ASSERT_EQUAL( eWaitingARPResolution, eResult );
TEST_ASSERT_EQUAL( eWaitingResolution, eResult );
}

/**
Expand Down

0 comments on commit a7b9759

Please sign in to comment.