Skip to content

Commit

Permalink
Fix nasa#2040, Improve CFE_SB_IsValidMsgId handler
Browse files Browse the repository at this point in the history
If no return value override is set test against CFE_SB_INVALID_MSG_ID
  • Loading branch information
skliper committed Jan 29, 2022
1 parent 07fb348 commit 3428882
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions modules/core_api/ut-stubs/src/cfe_sb_handlers.c
Original file line number Diff line number Diff line change
Expand Up @@ -400,10 +400,17 @@ void UT_DefaultHandler_CFE_SB_IsValidMsgId(void *UserObj, UT_EntryKey_t FuncKey,
{
int32 status;
bool return_value;
CFE_SB_MsgId_t MsgId = UT_Hook_GetArgValueByName(Context, "MsgId", CFE_SB_MsgId_t);

UT_Stub_GetInt32StatusCode(Context, &status);

return_value = status;
if (UT_Stub_GetInt32StatusCode(Context, &status))
{
return_value = status;
}
else
{
/* The only invalid value UT's should be using is CFE_SB_INVALID_MSG_ID */
return_value = !CFE_SB_MsgId_Equal(MsgId, CFE_SB_INVALID_MSG_ID);
}

UT_Stub_SetReturnValue(FuncKey, return_value);
}
Expand Down

0 comments on commit 3428882

Please sign in to comment.