Skip to content

Commit

Permalink
Merge pull request nasa#1000 from jphickey/fix-999-moduleload-flags
Browse files Browse the repository at this point in the history
Fix nasa#999, Add flags parameter to module load
  • Loading branch information
astrogeco authored Nov 12, 2020
2 parents f7eeb46 + b320d68 commit a4f3a4c
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 24 deletions.
3 changes: 2 additions & 1 deletion fsw/cfe-core/src/es/cfe_es_apps.c
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,8 @@ int32 CFE_ES_LoadModule(const CFE_ES_ModuleLoadParams_t* LoadParams, CFE_ES_Modu
*/
StatusCode = OS_ModuleLoad ( &ModuleId,
LoadParams->Name,
LoadParams->FileName );
LoadParams->FileName,
OS_MODULE_FLAG_GLOBAL_SYMBOLS );

if (StatusCode != OS_SUCCESS)
{
Expand Down
46 changes: 23 additions & 23 deletions fsw/cfe-core/unit-test/es_UT.c
Original file line number Diff line number Diff line change
Expand Up @@ -1494,7 +1494,7 @@ void TestApps(void)
UtAppRecPtr->StartParams.Priority = 255;
UtAppRecPtr->StartParams.StackSize = 8192;
UtAppRecPtr->StartParams.ExceptionAction = 0;
OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL);
OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL, 0);
UtAppRecPtr->ControlReq.AppControlRequest =
CFE_ES_RunStatus_APP_EXIT;
Id = CFE_ES_AppRecordGetID(UtAppRecPtr);
Expand All @@ -1511,7 +1511,7 @@ void TestApps(void)
ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, NULL);
UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_APP_EXIT;
UT_SetDeferredRetcode(UT_KEY(CFE_EVS_CleanUpApp), 1, -1);
OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL);
OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL, 0);
Id = CFE_ES_AppRecordGetID(UtAppRecPtr);
CFE_ES_ProcessControlRequest(Id);
UT_Report(__FILE__, __LINE__,
Expand All @@ -1527,7 +1527,7 @@ void TestApps(void)
UtAppRecPtr->ControlReq.AppControlRequest =
CFE_ES_RunStatus_SYS_DELETE;
UT_SetDeferredRetcode(UT_KEY(CFE_EVS_CleanUpApp), 1, -1);
OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL);
OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL, 0);
Id = CFE_ES_AppRecordGetID(UtAppRecPtr);
CFE_ES_ProcessControlRequest(Id);
UT_Report(__FILE__, __LINE__,
Expand All @@ -1543,7 +1543,7 @@ void TestApps(void)
UtAppRecPtr->ControlReq.AppControlRequest =
CFE_ES_RunStatus_SYS_RESTART;
UT_SetDeferredRetcode(UT_KEY(CFE_EVS_CleanUpApp), 1, -1);
OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL);
OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL, 0);
Id = CFE_ES_AppRecordGetID(UtAppRecPtr);
CFE_ES_ProcessControlRequest(Id);
UT_Report(__FILE__, __LINE__,
Expand All @@ -1558,7 +1558,7 @@ void TestApps(void)
ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, NULL);
UtAppRecPtr->ControlReq.AppControlRequest =
CFE_ES_RunStatus_SYS_RESTART;
OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL);
OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL, 0);
UT_SetForceFail(UT_KEY(OS_TaskCreate), OS_ERROR);
Id = CFE_ES_AppRecordGetID(UtAppRecPtr);
CFE_ES_ProcessControlRequest(Id);
Expand All @@ -1574,7 +1574,7 @@ void TestApps(void)
ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, NULL);
UtAppRecPtr->ControlReq.AppControlRequest =
CFE_ES_RunStatus_SYS_RELOAD;
OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL);
OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL, 0);
UT_SetDeferredRetcode(UT_KEY(CFE_EVS_CleanUpApp), 1, -1);
Id = CFE_ES_AppRecordGetID(UtAppRecPtr);
CFE_ES_ProcessControlRequest(Id);
Expand All @@ -1590,7 +1590,7 @@ void TestApps(void)
ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, NULL);
UtAppRecPtr->ControlReq.AppControlRequest =
CFE_ES_RunStatus_SYS_RELOAD;
OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL);
OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL, 0);
UT_SetForceFail(UT_KEY(OS_TaskCreate), OS_ERROR);
Id = CFE_ES_AppRecordGetID(UtAppRecPtr);
CFE_ES_ProcessControlRequest(Id);
Expand All @@ -1614,7 +1614,7 @@ void TestApps(void)
UtAppRecPtr->StartParams.Priority = 255;
UtAppRecPtr->StartParams.StackSize = 8192;
UtAppRecPtr->StartParams.ExceptionAction = 0;
OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL);
OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL, 0);
UtAppRecPtr->ControlReq.AppControlRequest =
CFE_ES_RunStatus_APP_ERROR;
Id = CFE_ES_AppRecordGetID(UtAppRecPtr);
Expand All @@ -1632,7 +1632,7 @@ void TestApps(void)
UT_SetDeferredRetcode(UT_KEY(CFE_EVS_CleanUpApp), 1, -1);
UtAppRecPtr->ControlReq.AppControlRequest =
CFE_ES_RunStatus_APP_ERROR;
OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL);
OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL, 0);
Id = CFE_ES_AppRecordGetID(UtAppRecPtr);
CFE_ES_ProcessControlRequest(Id);
UT_Report(__FILE__, __LINE__,
Expand All @@ -1655,7 +1655,7 @@ void TestApps(void)
UtAppRecPtr->StartParams.ExceptionAction = 0;
UtAppRecPtr->ControlReq.AppControlRequest =
CFE_ES_RunStatus_SYS_DELETE;
OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL);
OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL, 0);
Id = CFE_ES_AppRecordGetID(UtAppRecPtr);
CFE_ES_ProcessControlRequest(Id);
UT_Report(__FILE__, __LINE__,
Expand All @@ -1678,7 +1678,7 @@ void TestApps(void)
UtAppRecPtr->StartParams.ExceptionAction = 0;
UtAppRecPtr->ControlReq.AppControlRequest =
CFE_ES_RunStatus_SYS_RESTART;
OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL);
OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL, 0);
Id = CFE_ES_AppRecordGetID(UtAppRecPtr);
CFE_ES_ProcessControlRequest(Id);
UT_Report(__FILE__, __LINE__,
Expand All @@ -1701,7 +1701,7 @@ void TestApps(void)
UtAppRecPtr->StartParams.ExceptionAction = 0;
UtAppRecPtr->ControlReq.AppControlRequest =
CFE_ES_RunStatus_SYS_RELOAD;
OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL);
OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL, 0);
Id = CFE_ES_AppRecordGetID(UtAppRecPtr);
CFE_ES_ProcessControlRequest(Id);
UT_Report(__FILE__, __LINE__,
Expand All @@ -1726,7 +1726,7 @@ void TestApps(void)
UtAppRecPtr->StartParams.ExceptionAction = 0;
UtAppRecPtr->ControlReq.AppControlRequest =
CFE_ES_RunStatus_SYS_EXCEPTION;
OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL);
OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL, 0);
Id = CFE_ES_AppRecordGetID(UtAppRecPtr);
CFE_ES_ProcessControlRequest(Id);
UT_Report(__FILE__, __LINE__,
Expand Down Expand Up @@ -1795,7 +1795,7 @@ void TestApps(void)
ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, NULL);
ES_UT_SetupForOSCleanup();

OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL);
OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL, 0);
UT_SetForceFail(UT_KEY(OS_TaskDelete), OS_ERROR);
UT_SetForceFail(UT_KEY(OS_close), OS_ERROR);
Id = CFE_ES_AppRecordGetID(UtAppRecPtr);
Expand All @@ -1809,7 +1809,7 @@ void TestApps(void)
*/
ES_ResetUnitTest();
ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, NULL);
OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL);
OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL, 0);
ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, NULL, NULL);
ES_UT_SetupForOSCleanup();
UT_SetDeferredRetcode(UT_KEY(OS_MutSemDelete), 1, OS_ERROR);
Expand All @@ -1824,7 +1824,7 @@ void TestApps(void)
*/
ES_ResetUnitTest();
ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, NULL);
OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL);
OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL, 0);
UT_SetDeferredRetcode(UT_KEY(OS_ModuleUnload), 1, OS_ERROR);
Id = CFE_ES_AppRecordGetID(UtAppRecPtr);
UT_Report(__FILE__, __LINE__,
Expand All @@ -1837,7 +1837,7 @@ void TestApps(void)
*/
ES_ResetUnitTest();
ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, NULL);
OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL);
OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL, 0);
UT_SetDeferredRetcode(UT_KEY(CFE_EVS_CleanUpApp), 1, -1);
Id = CFE_ES_AppRecordGetID(UtAppRecPtr);
UT_Report(__FILE__, __LINE__,
Expand Down Expand Up @@ -2009,12 +2009,12 @@ void TestApps(void)
ES_ResetUnitTest();
/* Setup an entry which will be deleted */
ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, NULL);
OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL);
OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL, 0);
/* Setup a second entry which will NOT be deleted */
ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, NULL, &UtTaskRecPtr);
ES_UT_SetupMemPoolId(&UtPoolRecPtr);
UtPoolRecPtr->OwnerAppID = CFE_ES_AppRecordGetID(UtAppRecPtr);
OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL);
OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL, 0);
/* Associate a child task with the app to be deleted */
ES_UT_SetupChildTaskId(UtAppRecPtr, NULL, NULL);
Id = CFE_ES_AppRecordGetID(UtAppRecPtr);
Expand All @@ -2037,7 +2037,7 @@ void TestApps(void)
ES_ResetUnitTest();
/* Setup an entry which will be deleted */
ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, NULL);
OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL);
OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL, 0);
ES_UT_SetupMemPoolId(&UtPoolRecPtr);
UtPoolRecPtr->OwnerAppID = CFE_ES_AppRecordGetID(UtAppRecPtr);
UtPoolRecPtr->PoolID = CFE_ES_ResourceID_FromInteger(99999); /* Mismatch */
Expand All @@ -2058,10 +2058,10 @@ void TestApps(void)

/* Setup an entry which will be deleted */
ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, NULL);
OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL);
OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL, 0);
/* Setup a second entry which will NOT be deleted */
ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, NULL, &UtTaskRecPtr);
OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL);
OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL, 0);
/* Associate a child task with the app to be deleted */
ES_UT_SetupChildTaskId(UtAppRecPtr, NULL, NULL);

Expand Down Expand Up @@ -2118,7 +2118,7 @@ void TestApps(void)
ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, &UtTaskRecPtr);

OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, "UT",
"ut-module");
"ut-module", 0);
Id = CFE_ES_AppRecordGetID(UtAppRecPtr);
UT_Report(__FILE__, __LINE__,
CFE_ES_CleanUpApp(Id) == CFE_SUCCESS &&
Expand Down

0 comments on commit a4f3a4c

Please sign in to comment.