Skip to content

Commit

Permalink
Fix nasa#2047, Add CFE_ES_CreateChildTask default handler
Browse files Browse the repository at this point in the history
  • Loading branch information
skliper committed Feb 10, 2022
1 parent 99429bf commit f166a0a
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
34 changes: 34 additions & 0 deletions modules/core_api/ut-stubs/src/cfe_es_handlers.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,40 @@ static const cpuaddr UT_ESPOOL_ALIGN_MASK = ((cpuaddr) & ((struct UT_AlignTest *
** Functions
*/

/*------------------------------------------------------------
*
* Default handler for CFE_ES_CreateChildTask coverage stub function
*
*------------------------------------------------------------*/
void UT_DefaultHandler_CFE_ES_CreateChildTask(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context)
{
CFE_ES_TaskId_t *TaskIdPtr = UT_Hook_GetArgValueByName(Context, "TaskIdPtr", CFE_ES_TaskId_t *);
int32 status;
void * IdBuff;
size_t BuffSize;
size_t Position;

UT_Stub_GetInt32StatusCode(Context, &status);

if (status >= 0)
{
UT_GetDataBuffer(UT_KEY(CFE_ES_GetAppID), &IdBuff, &BuffSize, &Position);
if (IdBuff != NULL && BuffSize == sizeof(*TaskIdPtr))
{
memcpy(TaskIdPtr, IdBuff, sizeof(*TaskIdPtr));
}
else
{
*TaskIdPtr = CFE_UT_ES_DEFAULT_TASKID;
}
}

if (status < 0)
{
*TaskIdPtr = CFE_ES_TASKID_UNDEFINED;
}
}

/*------------------------------------------------------------
*
* Default handler for CFE_ES_GetAppID coverage stub function
Expand Down
3 changes: 2 additions & 1 deletion modules/core_api/ut-stubs/src/cfe_es_stubs.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

void UT_DefaultHandler_CFE_ES_AppID_ToIndex(void *, UT_EntryKey_t, const UT_StubContext_t *);
void UT_DefaultHandler_CFE_ES_CopyToCDS(void *, UT_EntryKey_t, const UT_StubContext_t *);
void UT_DefaultHandler_CFE_ES_CreateChildTask(void *, UT_EntryKey_t, const UT_StubContext_t *);
void UT_DefaultHandler_CFE_ES_ExitApp(void *, UT_EntryKey_t, const UT_StubContext_t *);
void UT_DefaultHandler_CFE_ES_GetAppID(void *, UT_EntryKey_t, const UT_StubContext_t *);
void UT_DefaultHandler_CFE_ES_GetAppIDByName(void *, UT_EntryKey_t, const UT_StubContext_t *);
Expand Down Expand Up @@ -146,7 +147,7 @@ CFE_Status_t CFE_ES_CreateChildTask(CFE_ES_TaskId_t *TaskIdPtr, const char *Task
UT_GenStub_AddParam(CFE_ES_CreateChildTask, CFE_ES_TaskPriority_Atom_t, Priority);
UT_GenStub_AddParam(CFE_ES_CreateChildTask, uint32, Flags);

UT_GenStub_Execute(CFE_ES_CreateChildTask, Basic, NULL);
UT_GenStub_Execute(CFE_ES_CreateChildTask, Basic, UT_DefaultHandler_CFE_ES_CreateChildTask);

return UT_GenStub_GetReturnValue(CFE_ES_CreateChildTask, CFE_Status_t);
}
Expand Down

0 comments on commit f166a0a

Please sign in to comment.