Skip to content

Commit

Permalink
Merge pull request nasa#640 from lethuillierg/issue_637
Browse files Browse the repository at this point in the history
Fix nasa#637, Remove old CFE_ARINC653-related tests
  • Loading branch information
astrogeco authored May 8, 2020
2 parents 8365a0c + 4dd5bda commit b3a9974
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 198 deletions.
173 changes: 0 additions & 173 deletions fsw/cfe-core/unit-test/es_UT.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,6 @@ extern CFE_ES_CDSBlockDesc_t CFE_ES_CDSBlockDesc;
extern CFE_ES_TaskData_t CFE_ES_TaskData;
extern CFE_ES_CDSPool_t CFE_ES_CDSMemPool;

#ifdef CFE_ARINC653
extern CFE_ES_StaticStartupTable_t CFE_ES_StaticStartupTable[];
#endif

extern int32 dummy_function(void);

/*
Expand Down Expand Up @@ -295,10 +291,6 @@ void UtTest_Setup(void)
UT_ADD_TEST(TestESMempool);
UT_ADD_TEST(TestSysLog);
UT_ADD_TEST(TestBackground);

#ifdef CFE_ARINC653
UT_ADD_TEST(TestStaticApp);
#endif
}

/*
Expand Down Expand Up @@ -7040,168 +7032,3 @@ void TestBackground(void)
"CFE_ES_BackgroundTask - Nominal, CFE_ES_Global.BackgroundTask.NumJobsRunning (%u) == 1",
(unsigned int)CFE_ES_Global.BackgroundTask.NumJobsRunning);
}



#ifdef CFE_ARINC653
void TestStaticApp(void)
{
int j;
uint32 Id;
uint32 LibraryIdPtr;
CFE_ES_AppMainFuncPtr_t MainFunc = 0;

/* Test successful static app creation */
ES_ResetUnitTest();
CFE_ES_Global.AppTable[0].AppState = CFE_ES_AppState_RUNNING;
CFE_ES_Global.AppTable[1].AppState = CFE_ES_AppState_UNDEFINED;
CFE_ES_Global.TaskTable[1].RecordUsed = false;
UT_Report(__FILE__, __LINE__,
CFE_ES_StaticAppCreate(&Id,
MainFunc,
"AppName",
170,
4096,
1) == CFE_SUCCESS &&
CFE_ES_Global.TaskTable[1].RecordUsed == true,
"CFE_ES_StaticAppCreate",
"Create static application; successful");

/* Test static app creation with a task create failure */
ES_ResetUnitTest();
UT_SetForceFail(UT_KEY(OS_TaskCreate), OS_ERROR);
UT_Report(__FILE__, __LINE__,
CFE_ES_StaticAppCreate(&Id,
MainFunc,
"AppName",
170,
4096,
1) == CFE_ES_ERR_APP_CREATE,
"CFE_ES_StaticAppCreate",
"Task create error");

/* Test static app creation specifying a slot already in use */
ES_ResetUnitTest();
CFE_ES_Global.TaskTable[0].RecordUsed = true;
UT_Report(__FILE__, __LINE__,
CFE_ES_StaticAppCreate(&Id,
MainFunc,
"AppName",
170,
4096,
1) == CFE_SUCCESS,
"CFE_ES_StaticAppCreate",
"Task slot in use");

/* Test static app creation with no free slots available */
ES_ResetUnitTest();

for (j = 0; j < CFE_PLATFORM_ES_MAX_APPLICATIONS; j++)
{
CFE_ES_Global.AppTable[j].AppState = CFE_ES_AppState_RUNNING;
}

UT_Report(__FILE__, __LINE__,
CFE_ES_StaticAppCreate(&Id,
MainFunc,
"AppName",
170,
4096,
1) == CFE_ES_ERR_APP_CREATE,
"CFE_ES_StaticAppCreate",
"No free application slots available");

/* Test successful static shared library initialization */
ES_ResetUnitTest();
UT_SetLibInitRtn(CFE_SUCCESS);
LibraryIdPtr = 1;
CFE_ES_Global.LibTable[0].RecordUsed = false;
UT_Report(__FILE__, __LINE__,
CFE_ES_InitStaticLibrary(&LibraryIdPtr,
(CFE_ES_LibInitFuncPtr_t) UT_LibInit,
"LibName") == CFE_SUCCESS &&
LibraryIdPtr == 0,
"CFE_ES_InitStaticLibrary",
"Static library initialization; successful");

/* Test static shared library initialization with a library load failure */
ES_ResetUnitTest();
UT_SetLibInitRtn(CFE_ES_ERR_LOAD_LIB);
CFE_ES_Global.LibTable[0].RecordUsed = false;
UT_Report(__FILE__, __LINE__,
CFE_ES_InitStaticLibrary(&LibraryIdPtr,
(CFE_ES_LibInitFuncPtr_t) UT_LibInit,
"LibName") == CFE_ES_ERR_LOAD_LIB,
"CFE_ES_InitStaticLibrary",
"Shared library initialization failure");

/* Test static shared library initialization with no free
* slots available
*/
ES_ResetUnitTest();

for (j = 0; j < CFE_PLATFORM_ES_MAX_LIBRARIES; j++)
{
CFE_ES_Global.LibTable[j].RecordUsed = true;
}

UT_Report(__FILE__, __LINE__,
CFE_ES_InitStaticLibrary(&LibraryIdPtr,
(CFE_ES_LibInitFuncPtr_t) UT_LibInit,
"LibName") == CFE_ES_ERR_LOAD_LIB,
"CFE_ES_InitStaticLibrary",
"No free library slots available");

/* Test successful static application initialization */
ES_ResetUnitTest();

for (j = 0; j < CFE_PLATFORM_ES_MAX_LIBRARIES; j++)
{
CFE_ES_Global.LibTable[j].RecordUsed = false;
}

strncpy(CFE_ES_StaticStartupTable[0].Name,
"StaticAppName", OS_MAX_API_NAME);
CFE_ES_StaticStartupTable[0].Name[OS_MAX_API_NAME - 1] = '\0';
CFE_ES_StaticStartupTable[0].ObjectType = CFE_ES_STATIC_APP;
CFE_ES_StaticStartupTable[0].ExceptionAction =
CFE_ES_ExceptionAction_RESTART_APP + 1;
CFE_ES_StartStaticApplications(CFE_PSP_RST_TYPE_PROCESSOR);
UT_Report(__FILE__, __LINE__,
CFE_ES_StaticStartupTable[0].ExceptionAction ==
CFE_ES_ExceptionAction_PROC_RESTART &&
UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_NO_MESSAGE]),
"CFE_ES_StartStaticApplications",
"*Not implemented* Initialize static application; successful");

/* Test successful static library initialization */
ES_ResetUnitTest();
CFE_ES_StaticStartupTable[0].ObjectType = CFE_ES_STATIC_LIB;
CFE_ES_StartStaticApplications(CFE_PSP_RST_TYPE_PROCESSOR);
UT_Report(__FILE__, __LINE__,
UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_NO_MESSAGE]),
"CFE_ES_StartStaticApplications",
"*Not implemented* Initialize static shared library; successful");

/* Test successful static application initialization null action */
ES_ResetUnitTest();
CFE_ES_StaticStartupTable[0].ObjectType = CFE_ES_STATIC_NULL;
CFE_ES_StartStaticApplications(CFE_PSP_RST_TYPE_PROCESSOR);
UT_Report(__FILE__, __LINE__,
UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_NO_MESSAGE]),
"CFE_ES_StartStaticApplications",
"*Not implemented* No action");

/* Test successful static library initialization with an invalid
* entry type
*/
ES_ResetUnitTest();
CFE_ES_StaticStartupTable[0].ObjectType = 0xff;
CFE_ES_StartStaticApplications(CFE_PSP_RST_TYPE_PROCESSOR);
UT_Report(__FILE__, __LINE__,
UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_NO_MESSAGE]),
"CFE_ES_StartStaticApplications",
"*Not implemented* Unexpected entry type");
}
#endif

25 changes: 0 additions & 25 deletions fsw/cfe-core/unit-test/es_UT.h
Original file line number Diff line number Diff line change
Expand Up @@ -355,29 +355,4 @@ void TestESMempool(void);

void TestSysLog(void);

#ifdef CFE_ARINC653
/*****************************************************************************/
/**
** \brief Perform tests on the cFE applications from statically linked code
**
** \par Description
** This function tests the code for creating and loading cFE
** applications from statically linked code, and for initializing
** static libraries.
**
** \par Assumptions, External Events, and Notes:
** None
**
** \returns
** This function does not return a value.
**
** \sa #UT_InitData, #UT_Report, CFE_ES_StaticAppCreate, #UT_SetOSFail
** \sa #UT_SetLibInitRtn, #CFE_ES_InitStaticLibrary
** \sa #CFE_ES_StartStaticApplications
**
******************************************************************************/
void TestStaticApp(void);
#endif


#endif /* _es_ut_h_ */

0 comments on commit b3a9974

Please sign in to comment.