Skip to content

Commit

Permalink
Fix #2625, add initialization of table indices
Browse files Browse the repository at this point in the history
The "Last" ID values that are tracked in the CFE_TBL_Global were not
initialized correctly, thus making it fail to get a record.  This in
turn caused the "Too many validations" issue, because it could not get a
result buffer.
  • Loading branch information
jphickey committed Jan 24, 2025
1 parent ee273d3 commit 9f58cb3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
7 changes: 5 additions & 2 deletions modules/tbl/fsw/src/cfe_tbl_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,8 @@ int32 CFE_TBL_TaskInit(void)
/*
** Task startup event message
*/
CFE_Config_GetVersionString(VersionString, CFE_CFG_MAX_VERSION_STR_LEN, "cFE",
CFE_SRC_VERSION, CFE_BUILD_CODENAME, CFE_LAST_OFFICIAL);
CFE_Config_GetVersionString(VersionString, CFE_CFG_MAX_VERSION_STR_LEN, "cFE", CFE_SRC_VERSION, CFE_BUILD_CODENAME,
CFE_LAST_OFFICIAL);
Status = CFE_EVS_SendEvent(CFE_TBL_INIT_INF_EID, CFE_EVS_EventType_INFORMATION, "cFE TBL Initialized: %s",
VersionString);

Expand Down Expand Up @@ -199,4 +199,7 @@ void CFE_TBL_InitData(void)
/* Message ID is set when sent, so OK as 0 here */
CFE_MSG_Init(CFE_MSG_PTR(CFE_TBL_Global.NotifyMsg.CommandHeader), CFE_SB_INVALID_MSG_ID,
sizeof(CFE_TBL_Global.NotifyMsg));

CFE_TBL_Global.LastValidationResultId = CFE_ResourceId_FromInteger(CFE_TBL_VALRESULTID_BASE);
CFE_TBL_Global.LastDumpCtrlBlockId = CFE_ResourceId_FromInteger(CFE_TBL_DUMPCTRLID_BASE);
}
6 changes: 3 additions & 3 deletions modules/tbl/ut-coverage/tbl_UT.c
Original file line number Diff line number Diff line change
Expand Up @@ -783,7 +783,7 @@ void Test_CFE_TBL_ValidateCmd(void)
ValidateCmd.Payload.ActiveTableFlag = CFE_TBL_BufferSelect_ACTIVE;
CFE_TBL_Global.Registry[0].Buffers[CFE_TBL_Global.Registry[0].ActiveBufferIndex].BufferPtr = BuffPtr;

UT_SetDeferredRetcode(UT_KEY(CFE_ResourceId_FindNext), 1, 0);
UT_SetDeferredRetcode(UT_KEY(CFE_ResourceId_FindNext), 1, -1);
UtAssert_INT32_EQ(CFE_TBL_ValidateCmd(&ValidateCmd), CFE_TBL_INC_ERR_CTR);

/* Test where the active buffer has data, but there is no validation
Expand Down Expand Up @@ -4068,7 +4068,7 @@ void Test_CFE_TBL_ResourceID_ValidationResult(void)
UtAssert_BOOL_TRUE(CFE_TBL_CheckValidationResultSlotUsed(PendingId));

/* Test case where no ID is available */
UT_SetDefaultReturnValue(UT_KEY(CFE_ResourceId_FindNext), 0);
UT_SetDefaultReturnValue(UT_KEY(CFE_ResourceId_FindNext), -1);
UtAssert_VOIDCALL(PendingId = CFE_TBL_GetNextValResultBlock());
UtAssert_BOOL_FALSE(CFE_ResourceId_IsDefined(PendingId));

Expand Down Expand Up @@ -4167,7 +4167,7 @@ void Test_CFE_TBL_ResourceID_DumpControl(void)
UtAssert_BOOL_TRUE(CFE_TBL_CheckDumpCtrlSlotUsed(PendingId));

/* Test case where no ID is available */
UT_SetDefaultReturnValue(UT_KEY(CFE_ResourceId_FindNext), 0);
UT_SetDefaultReturnValue(UT_KEY(CFE_ResourceId_FindNext), -1);
UtAssert_VOIDCALL(PendingId = CFE_TBL_GetNextDumpCtrlBlock());
UtAssert_BOOL_FALSE(CFE_ResourceId_IsDefined(PendingId));

Expand Down

0 comments on commit 9f58cb3

Please sign in to comment.