Skip to content

Commit

Permalink
TBL UT update for OSAL/CFE path length mismatch
Browse files Browse the repository at this point in the history
  • Loading branch information
irowebbn committed Jun 9, 2023
1 parent 112bc51 commit 4175c7a
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions modules/tbl/ut-coverage/tbl_UT.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 4175c7a

Please sign in to comment.