Skip to content

Commit

Permalink
Fixes nasa#274, NumOfChildTasks not decremented
Browse files Browse the repository at this point in the history
Fixes nasa#274, NumOfChildTasks not decremented

Fixes nasa#274, NumOfChildTasks not decremented

Fixes nasa#274, NumOfChildTasks not decremented

Fixes nasa#274, NumOfChildTasks not decremented

Fixes nasa#274, NumOfChildTasks not decremented
  • Loading branch information
dmknutsen committed Feb 3, 2020
1 parent ba69ce9 commit 936fb45
Showing 1 changed file with 20 additions and 37 deletions.
57 changes: 20 additions & 37 deletions fsw/cfe-core/unit-test/es_UT.c
Original file line number Diff line number Diff line change
Expand Up @@ -4306,8 +4306,8 @@ void TestAPI(void)
char CDSName[CFE_MISSION_ES_CDS_MAX_NAME_LENGTH + 2];
int i;
uint32 ExceptionContext = 0;
int32 Return;
uint8 Data[12];
int32 Return;
uint8 Data[12];
uint32 ResetType;
uint32 *ResetTypePtr;
uint32 AppId;
Expand All @@ -4318,7 +4318,6 @@ void TestAPI(void)
uint32 CounterCount;
CFE_ES_CDSHandle_t CDSHandle;
CFE_ES_TaskInfo_t TaskInfo;

CFE_ES_AppInfo_t AppInfo;

#ifdef UT_VERBOSE
Expand Down Expand Up @@ -4795,40 +4794,24 @@ void TestAPI(void)
/* Test successfully deleting a child task */
ES_ResetUnitTest();
CFE_ES_Global.TaskTable[1].RecordUsed = true;
CFE_ES_Global.TaskTable[1].AppId = 15;

CFE_ES_Global.TaskTable[16].RecordUsed = true;
CFE_ES_Global.TaskTable[16].AppId = 15;
CFE_ES_Global.TaskTable[17].RecordUsed = true;
CFE_ES_Global.TaskTable[17].AppId = 15;
CFE_ES_Global.TaskTable[17].TaskId = 25;
CFE_ES_Global.TaskTable[18].RecordUsed = true;
CFE_ES_Global.TaskTable[18].AppId = 15;
CFE_ES_Global.AppTable[15].AppState = CFE_ES_AppState_RUNNING;
CFE_ES_Global.AppTable[15].TaskInfo.MainTaskId = 25;

OS_TaskCreate(&CFE_ES_Global.TaskTable[16].TaskId, NULL, NULL, NULL,
0, 0, 0);

CFE_ES_GetAppInfo(&AppInfo,CFE_ES_Global.TaskTable[1].AppId);
uint32 NumORegTasksTemp = CFE_ES_Global.RegisteredTasks;
uint32 NumOChildTastTemp1 = AppInfo.NumOfChildTasks;

int32 DeleteChildResult = CFE_ES_DeleteChildTask(CFE_ES_Global.TaskTable[1].TaskId);
int32 DeleteChildTestResult = 0xFFFFFFFF;

CFE_ES_GetAppInfo(&AppInfo,CFE_ES_Global.TaskTable[1].AppId);
uint32 NumOChildTastTemp2 = AppInfo.NumOfChildTasks;

if( DeleteChildResult == CFE_SUCCESS && CFE_ES_Global.RegisteredTasks == NumORegTasksTemp - 1
&& NumOChildTastTemp2 == NumOChildTastTemp1 - 1 )
{
DeleteChildTestResult = CFE_SUCCESS;
}
UT_Report(__FILE__, __LINE__,
DeleteChildTestResult == CFE_SUCCESS,
"CFE_ES_DeleteChildTask",
"Delete child task successful");
CFE_ES_Global.TaskTable[1].AppId = 0;
CFE_ES_Global.AppTable[0].AppState = CFE_ES_AppState_RUNNING;
CFE_ES_Global.AppTable[0].TaskInfo.MainTaskId = 15;
OS_TaskCreate(&CFE_ES_Global.TaskTable[1].TaskId, NULL, NULL, NULL,
0, 0, 0);
Return = CFE_ES_GetAppInfo(&AppInfo,CFE_ES_Global.TaskTable[1].AppId);
UtAssert_True(Return == CFE_SUCCESS,
"CFE_ES_GetAppInfo() return=%x", (unsigned int)Return);
UtAssert_True(AppInfo.NumOfChildTasks == 1,
"AppInfo.NumOfChildTaskss == %u", (unsigned int)AppInfo.NumOfChildTasks);
Return = CFE_ES_DeleteChildTask(CFE_ES_Global.TaskTable[1].TaskId);
UtAssert_True(Return == CFE_SUCCESS,
"DeleteChildResult() return=%x", (unsigned int)Return);
Return = CFE_ES_GetAppInfo(&AppInfo,CFE_ES_Global.TaskTable[1].AppId);
UtAssert_True(Return == CFE_SUCCESS,
"CFE_ES_GetAppInfo() return=%x", (unsigned int)Return);
UtAssert_True(AppInfo.NumOfChildTasks == 0,
"AppInfo.NumOfChildTaskss == %u", (unsigned int)AppInfo.NumOfChildTasks);

/* Test deleting a child task with an OS task delete failure */
ES_ResetUnitTest();
Expand Down

0 comments on commit 936fb45

Please sign in to comment.