From fa66d38fb85281f15581124f9b4512a07cbba509 Mon Sep 17 00:00:00 2001 From: Holden Date: Sun, 25 Aug 2024 18:41:56 -0400 Subject: [PATCH] Fix Tests --- .github/.cSpellWords.txt | 1 + .../FreeRTOS_ARP/FreeRTOS_ARP_utest.c | 10 ++++---- .../ut.cmake | 2 +- .../unit-test/FreeRTOS_IP/FreeRTOS_IP_utest.c | 24 +++++++++---------- 4 files changed, 19 insertions(+), 18 deletions(-) diff --git a/.github/.cSpellWords.txt b/.github/.cSpellWords.txt index ed12e1e9c..a17936017 100644 --- a/.github/.cSpellWords.txt +++ b/.github/.cSpellWords.txt @@ -1263,6 +1263,7 @@ STLIDMPUSR STLIMPUOR STLNVICACTVOR STLNVICPENDOR +Storex strbt STRBT strexb diff --git a/test/unit-test/FreeRTOS_ARP/FreeRTOS_ARP_utest.c b/test/unit-test/FreeRTOS_ARP/FreeRTOS_ARP_utest.c index b0e3d04c1..e75eee978 100644 --- a/test/unit-test/FreeRTOS_ARP/FreeRTOS_ARP_utest.c +++ b/test/unit-test/FreeRTOS_ARP/FreeRTOS_ARP_utest.c @@ -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. */ @@ -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 ); /* =================================================== */ @@ -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; @@ -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 ); @@ -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 ); /* =================================================== */ diff --git a/test/unit-test/FreeRTOS_ARP_DataLenLessThanMinPacket/ut.cmake b/test/unit-test/FreeRTOS_ARP_DataLenLessThanMinPacket/ut.cmake index 645595565..949036f43 100644 --- a/test/unit-test/FreeRTOS_ARP_DataLenLessThanMinPacket/ut.cmake +++ b/test/unit-test/FreeRTOS_ARP_DataLenLessThanMinPacket/ut.cmake @@ -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 "") diff --git a/test/unit-test/FreeRTOS_IP/FreeRTOS_IP_utest.c b/test/unit-test/FreeRTOS_IP/FreeRTOS_IP_utest.c index ff9a69706..5f2c192c5 100644 --- a/test/unit-test/FreeRTOS_IP/FreeRTOS_IP_utest.c +++ b/test/unit-test/FreeRTOS_IP/FreeRTOS_IP_utest.c @@ -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 ) @@ -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(); @@ -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 ) @@ -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 ); @@ -2489,7 +2489,7 @@ void test_prvProcessIPPacket_ValidHeader_ARPResolutionReqd( void ) eResult = prvProcessIPPacket( pxIPPacket, pxNetworkBuffer ); - TEST_ASSERT_EQUAL( eWaitingARPResolution, eResult ); + TEST_ASSERT_EQUAL( eWaitingResolution, eResult ); } /** @@ -2825,12 +2825,12 @@ void test_prvProcessIPPacket_ARPResolutionReqd_UDP( void ) prvAllowIPPacketIPv4_ExpectAndReturn( pxIPPacket, pxNetworkBuffer, ( pxIPHeader->ucVersionHeaderLength & 0x0FU ) << 2, eProcessBuffer ); xProcessReceivedUDPPacket_ExpectAndReturn( pxNetworkBuffer, pxUDPPacket->xUDPHeader.usDestinationPort, NULL, pdFAIL ); - xProcessReceivedUDPPacket_IgnoreArg_pxIsWaitingForARPResolution(); - xProcessReceivedUDPPacket_ReturnThruPtr_pxIsWaitingForARPResolution( &xReturnValue ); + xProcessReceivedUDPPacket_IgnoreArg_pxIsWaitingForResolution(); + xProcessReceivedUDPPacket_ReturnThruPtr_pxIsWaitingForResolution( &xReturnValue ); 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 ); @@ -2876,12 +2876,12 @@ void test_prvProcessIPPacket_ARPResolutionReqd_UDP1( void ) prvAllowIPPacketIPv4_ExpectAndReturn( pxIPPacket, pxNetworkBuffer, ( pxIPHeader->ucVersionHeaderLength & 0x0FU ) << 2, eProcessBuffer ); xProcessReceivedUDPPacket_ExpectAndReturn( pxNetworkBuffer, pxUDPPacket->xUDPHeader.usDestinationPort, NULL, pdFAIL ); - xProcessReceivedUDPPacket_IgnoreArg_pxIsWaitingForARPResolution(); - xProcessReceivedUDPPacket_ReturnThruPtr_pxIsWaitingForARPResolution( &xReturnValue ); + xProcessReceivedUDPPacket_IgnoreArg_pxIsWaitingForResolution(); + xProcessReceivedUDPPacket_ReturnThruPtr_pxIsWaitingForResolution( &xReturnValue ); 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 ); } @@ -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 ); } /**