Skip to content

Commit

Permalink
Updated the initial test to include the ES Info API calls and renamed…
Browse files Browse the repository at this point in the history
… the source file to es_info_test.c.
  • Loading branch information
wmoleski committed Aug 25, 2020
1 parent 10ccb16 commit 4a4882c
Show file tree
Hide file tree
Showing 5 changed files with 85 additions and 47 deletions.
2 changes: 1 addition & 1 deletion modules/cfe_test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ include_directories("${UT_ASSERT_SOURCE_DIR}/inc")
# Create the app module
add_cfe_app(cfe_test
src/cfe_test.c
src/es_test.c
src/es_info_test.c
)
2 changes: 1 addition & 1 deletion modules/cfe_test/src/cfe_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,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;
}
2 changes: 1 addition & 1 deletion modules/cfe_test/src/cfe_test.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
#include "uttest.h"
#include "utassert.h"

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

#endif /* CFE_TEST_H */
82 changes: 82 additions & 0 deletions modules/cfe_test/src/es_info_test.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
/*************************************************************************
**
** 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;
char AppNameBuf[OS_MAX_API_NAME + 4];
uint32 resetSubType;
CFE_ES_AppInfo_t appInfo;
CFE_ES_TaskInfo_t taskInfo;

UtAssert_INT32_EQ(CFE_ES_GetAppID(&AppId), CFE_SUCCESS);
UtAssert_INT32_EQ(CFE_ES_GetAppName(AppNameBuf, AppId, sizeof(AppNameBuf)), CFE_SUCCESS);
UtAssert_StrCmp(AppNameBuf, "ASSERT_APP", "CFE_ES_GetAppName() returned ASSERT_APP");
UtAssert_INT32_EQ(CFE_ES_GetAppIDByName(&AppId2, AppNameBuf), CFE_SUCCESS);
UtAssert_INT32_EQ(AppId, AppId2);

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

UtAssert_INT32_EQ(CFE_ES_GetAppInfo(&appInfo, AppId), CFE_SUCCESS);
UtPrintf ("App Info -> Type = %d\n",appInfo.Type);
UtPrintf ("App Info -> Name = %s\n",appInfo.Name);
UtPrintf ("App Info -> EntryPt = %s\n",appInfo.EntryPoint);
UtPrintf ("App Info -> FileName = %s\n",appInfo.FileName);
UtPrintf ("App Info -> StackSz = %d\n",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);
}
44 changes: 0 additions & 44 deletions modules/cfe_test/src/es_test.c

This file was deleted.

0 comments on commit 4a4882c

Please sign in to comment.