Skip to content

Commit

Permalink
Fixes nasa#274, NumOfChildTasks not decremented
Browse files Browse the repository at this point in the history
  • Loading branch information
dmknutsen committed Jan 30, 2020
1 parent ba69ce9 commit 0c6d1a5
Showing 1 changed file with 13 additions and 27 deletions.
40 changes: 13 additions & 27 deletions fsw/cfe-core/unit-test/es_UT.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
** Includes
*/
#include "es_UT.h"
#include <stdio.h>

extern CFE_ES_PerfData_t *Perf;
extern CFE_ES_Global_t CFE_ES_Global;
Expand Down Expand Up @@ -4306,8 +4307,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,6 +4319,8 @@ void TestAPI(void)
uint32 CounterCount;
CFE_ES_CDSHandle_t CDSHandle;
CFE_ES_TaskInfo_t TaskInfo;
int32 DeleteChildResult;
int32 DeleteChildTestResult = 0xFFFFFFFF;

CFE_ES_AppInfo_t AppInfo;

Expand Down Expand Up @@ -4795,33 +4798,16 @@ 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_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);
DeleteChildResult = CFE_ES_DeleteChildTask(CFE_ES_Global.TaskTable[1].TaskId);
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 )
if( DeleteChildResult == CFE_SUCCESS && CFE_ES_Global.RegisteredTasks == 15
&& AppInfo.NumOfChildTasks == 0 )
{
DeleteChildTestResult = CFE_SUCCESS;
}
Expand Down

0 comments on commit 0c6d1a5

Please sign in to comment.