Skip to content

Commit

Permalink
Fix nasa#467, Add coverage for CFE_ES_CreateObjects and CFE_ES_Main
Browse files Browse the repository at this point in the history
Completed 100% coverage on cfe_es_start.c
  • Loading branch information
pepepr08 committed Jun 23, 2021
1 parent d5480b5 commit 4f0d0c1
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion modules/es/ut-coverage/es_UT.c
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,15 @@ void TestStartupErrorPaths(void)
UtAssert_STUB_COUNT(CFE_PSP_Panic, 1);
UtAssert_UINT32_EQ(PanicStatus, CFE_PSP_PANIC_STARTUP_SEM);

/* Perform ES main startup with a file open failure */
/* Perform ES main startup with a ES Perf Data mutex creation failure */
ES_ResetUnitTest();
UT_SetDeferredRetcode(UT_KEY(OS_MutSemCreate), 2, OS_ERROR);
UT_SetDataBuffer(UT_KEY(CFE_PSP_Panic), &PanicStatus, sizeof(PanicStatus), false);
CFE_ES_Main(CFE_PSP_RST_TYPE_POWERON, 1, 1, "ut_startup");
UtAssert_UINT32_EQ(PanicStatus, CFE_PSP_PANIC_STARTUP_SEM);
UtAssert_UINT32_EQ(UT_GetStubCount(UT_KEY(CFE_PSP_Panic)), 1);

/* Perform ES main startup with a ES Shared Data mutex creation failure */
ES_ResetUnitTest();
UT_SetDummyFuncRtn(OS_SUCCESS);
UT_SetDefaultReturnValue(UT_KEY(OS_OpenCreate), OS_ERROR);
Expand Down Expand Up @@ -926,6 +934,13 @@ void TestStartupErrorPaths(void)
CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_NO_FREE_CORE_APP_SLOTS]);
CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_FUNCTION_POINTER]);

/* Test reading the object table with a NULL object type */
ES_ResetUnitTest();
UT_SetDefaultReturnValue(UT_KEY(CFE_ResourceId_FindNext), OS_ERROR);
CFE_ES_ObjectTable[CFE_PLATFORM_ES_OBJECT_TABLE_SIZE - 1].ObjectType = -1; /* Set last entry to unknown type */
CFE_ES_CreateObjects();
CFE_UtAssert_PrintfIsInHistory((UT_OSP_MESSAGES[UT_OSP_NO_FREE_CORE_APP_SLOTS]));

/* Test response to an invalid startup type */
ES_ResetUnitTest();
CFE_ES_Global.DebugVars.DebugFlag = 1;
Expand Down

0 comments on commit 4f0d0c1

Please sign in to comment.