Skip to content

Commit

Permalink
Fix nasa#808, ES API Functional test
Browse files Browse the repository at this point in the history
  • Loading branch information
zanzaben committed Mar 22, 2021
1 parent 096127b commit 6a53356
Show file tree
Hide file tree
Showing 4 changed files with 95 additions and 0 deletions.
1 change: 1 addition & 0 deletions modules/cfe_testcase/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ include_directories("${UT_ASSERT_SOURCE_DIR}/inc")
add_cfe_app(cfe_testcase
src/cfe_test.c
src/es_test.c
src/es_info_test.c
)
1 change: 1 addition & 0 deletions modules/cfe_testcase/src/cfe_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,6 @@
int32 CFE_Test_Init(int32 LibId)
{
UtTest_Add(ES_Test_AppId, NULL, NULL, "ES AppID");
UtTest_Add(ES_Test_InfoApi, NULL, NULL, "ES Info API");
return CFE_SUCCESS;
}
1 change: 1 addition & 0 deletions modules/cfe_testcase/src/cfe_test.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
#include "utassert.h"

void ES_Test_AppId(void);
void ES_Test_InfoApi(void);
int32 CFE_Test_Init(int32 LibId);

#endif /* CFE_TEST_H */
92 changes: 92 additions & 0 deletions modules/cfe_testcase/src/es_info_test.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
/*************************************************************************
**
** GSC-18128-1, "Core Flight Executive Version 6.7"
**
** Copyright (c) 2006-2019 United States Government as represented by
** the Administrator of the National Aeronautics and Space Administration.
** All Rights Reserved.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
**
** File: es_test.c
**
** Purpose:
** Functional test of basic ES APIs
**
** Demonstration of how to register and use the UT assert functions.
**
*************************************************************************/

/*
* Includes
*/

#include "cfe_test.h"

void ES_Test_InfoApi(void)
{
uint32 AppId;
uint32 AppId2;
const char *AppName = "TESTRUN_APP";
char AppNameBuf[OS_MAX_API_NAME + 4];
uint32 resetSubType;
CFE_ES_AppInfo_t appInfo;
CFE_ES_TaskInfo_t taskInfo;


UtAssert_SUCCESS(CFE_ES_GetAppIDByName(&AppId, AppName));
UtAssert_SUCCESS(CFE_ES_GetAppID(&AppId2));
UtAssert_INT32_EQ(AppId, AppId2);

UtAssert_SUCCESS(CFE_ES_GetAppName(AppNameBuf, AppId, sizeof(AppNameBuf)));
UtAssert_StrCmp(AppNameBuf, AppName, "CFE_ES_GetAppName() = TESTRUN_APP");

UtAssert_INT32_EQ(CFE_ES_GetResetType(&resetSubType),CFE_PSP_RST_TYPE_POWERON);
UtAssert_INT32_EQ(resetSubType,CFE_PSP_RST_SUBTYPE_POWER_CYCLE);



UtAssert_SUCCESS(CFE_ES_GetAppInfo(&appInfo, AppId));

UtAssert_True(appInfo.Type == 2, "App Info -> Type = %d", appInfo.Type);


UtPrintf ("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");

UtAssert_StrCmp(appInfo.Name , AppName, "App Info -> Name = %s",appInfo.Name);
UtAssert_StrCmp(appInfo.EntryPoint , "CFE_TR_AppMain","App Info -> EntryPt = %s",appInfo.EntryPoint);
UtAssert_StrCmp(appInfo.FileName , "/cf/cfe_testrunner.so", "App Info -> FileName = %s",appInfo.FileName);
UtAssert_True(appInfo.StackSize == 16384, "App Info -> StackSz = %d",appInfo.StackSize);
//UtPrintf ("App Info -> ModuleId = %d\n",appInfo.ModuleId);
UtPrintf ("App Info -> AddrsValid? = %d\n",appInfo.AddressesAreValid);
UtPrintf ("App Info -> CodeAddress = %d\n",appInfo.CodeAddress);
UtPrintf ("App Info -> CodeSize = %d\n",appInfo.CodeSize);
UtPrintf ("App Info -> DataAddress = %d\n",appInfo.DataAddress);
UtPrintf ("App Info -> DataSize = %d\n",appInfo.DataSize);
UtPrintf ("App Info -> BSSAddress = 0x%4x\n",appInfo.BSSAddress);
UtPrintf ("App Info -> BSSSize = %d\n",appInfo.BSSSize);
UtPrintf ("App Info -> StartAddress = 0x%4x\n",appInfo.StartAddress);
UtPrintf ("App Info -> ExceptionAction = %d\n",appInfo.ExceptionAction);
UtPrintf ("App Info -> Priority = %d\n",appInfo.Priority);
UtPrintf ("App Info -> MainTaskID = %d\n",appInfo.MainTaskId);
UtPrintf ("App Info -> ExecutionCtr = %d\n",appInfo.ExecutionCounter);
UtPrintf ("App Info -> Task Name = %s\n",appInfo.MainTaskName);
UtPrintf ("App Info -> Child Tasks = %d\n",appInfo.NumOfChildTasks);

UtAssert_INT32_EQ(CFE_ES_GetTaskInfo(&taskInfo, appInfo.MainTaskId), CFE_SUCCESS);
UtPrintf ("Task Info -> TaskId = %d\n",taskInfo.TaskId);
UtPrintf ("Task Info -> ExeCtr = %d\n",taskInfo.ExecutionCounter);
UtPrintf ("Task Info -> Task Name = %s\n",taskInfo.TaskName);
UtPrintf ("Task Info -> AppId = %d\n",taskInfo.AppId);
UtPrintf ("Task Info -> App Name = %s\n",taskInfo.AppName);
}

0 comments on commit 6a53356

Please sign in to comment.