From 4175c7a0b830c8f6a815da56cf2be558e3d366e3 Mon Sep 17 00:00:00 2001 From: Isaac Rowe <9010221+irowebbn@users.noreply.github.com> Date: Fri, 9 Jun 2023 16:47:27 -0500 Subject: [PATCH] TBL UT update for OSAL/CFE path length mismatch --- modules/tbl/ut-coverage/tbl_UT.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/modules/tbl/ut-coverage/tbl_UT.c b/modules/tbl/ut-coverage/tbl_UT.c index 77db831f9..abed76e7e 100644 --- a/modules/tbl/ut-coverage/tbl_UT.c +++ b/modules/tbl/ut-coverage/tbl_UT.c @@ -3177,13 +3177,23 @@ void Test_CFE_TBL_TblMod(void) UtAssert_INT32_EQ(CFE_TBL_GetAddress(&TblDataAddr, App1TblHandle1), CFE_TBL_INFO_UPDATED); /* - * LastFileLoaded (limited by mission) can be bigger than MyFilename (limited by osal), - * need to adjust length of check to account for difference and modified marking + * LastFileLoaded (limited by mission) can be bigger than MyFilename (limited by osal) */ - UtAssert_StrnCmp(TblInfo1.LastFileLoaded, MyFilename, sizeof(MyFilename) - 4, "%s == %s, %ld", - TblInfo1.LastFileLoaded, MyFilename, (long)sizeof(MyFilename) - 4); - UtAssert_StrCmp(&TblInfo1.LastFileLoaded[sizeof(MyFilename) - 4], "(*)", "%s == (*)", - &TblInfo1.LastFileLoaded[sizeof(MyFilename) - 4]); + UtAssert_StrnCmp(TblInfo1.LastFileLoaded, MyFilename, sizeof(TblInfo1.LastFileLoaded) - 4, "%s == %s, %ld", + TblInfo1.LastFileLoaded, MyFilename, (long)sizeof(TblInfo1.LastFileLoaded) - 4); + + int maxPathLenDiff = (int) CFE_MISSION_MAX_PATH_LEN - (int) OS_MAX_PATH_LEN; + if(maxPathLenDiff >= 0) + { + UtAssert_StrCmp(&TblInfo1.LastFileLoaded[sizeof(MyFilename) - 4], "(*)", "%s == (*)", + &TblInfo1.LastFileLoaded[sizeof(MyFilename) - 4]); + } + else if(maxPathLenDiff > -3) + { + int modIndicatorStart = (int) CFE_MISSION_MAX_PATH_LEN -4 - maxPathLenDiff; + UtAssert_StrCmp(&TblInfo1.LastFileLoaded[modIndicatorStart], "(*)", "%s == (*)", + &TblInfo1.LastFileLoaded[modIndicatorStart]); + } /* Test response to an invalid handle */ UtAssert_INT32_EQ(CFE_TBL_Modified(CFE_TBL_BAD_TABLE_HANDLE), CFE_TBL_ERR_INVALID_HANDLE);