Skip to content

Commit

Permalink
Update #778, add CFE test module
Browse files Browse the repository at this point in the history
  • Loading branch information
jphickey committed Jul 29, 2020
1 parent 1a2bdc5 commit f061d5d
Show file tree
Hide file tree
Showing 6 changed files with 145 additions and 2 deletions.
1 change: 0 additions & 1 deletion cmake/arch_build.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,6 @@ function(add_unit_test_exe UT_NAME UT_SRCS)
add_test(${UT_NAME} ${UT_NAME})
endfunction(add_unit_test_exe)


##################################################################
#
# FUNCTION: cfe_exec_do_install
Expand Down
2 changes: 1 addition & 1 deletion cmake/mission_defaults.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,6 @@ set(psp_SEARCH_PATH ".")
# If ENABLE_UNIT_TEST is enabled, then include the cfe_assert library in
# all targets. This can still be overridden in targets.cmake.
if (ENABLE_UNIT_TESTS)
list(APPEND MISSION_GLOBAL_APPLIST cfe_assert)
list(APPEND MISSION_GLOBAL_APPLIST cfe_assert cfe_test)
endif (ENABLE_UNIT_TESTS)

8 changes: 8 additions & 0 deletions modules/cfe_test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
include_directories("${CFE_ASSERT_SOURCE_DIR}/fsw/inc")
include_directories("${UT_ASSERT_SOURCE_DIR}/inc")

# Create the app module
add_cfe_app(cfe_test
fsw/src/cfe_test.c
fsw/src/es_test.c
)
45 changes: 45 additions & 0 deletions modules/cfe_test/fsw/src/cfe_test.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*************************************************************************
**
** 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: cfe_test.c
**
** Purpose:
** Initialization routine for CFE functional test
** Demonstration of how to register and use the UT assert functions.
**
*************************************************************************/

/*
* Includes
*/

#include "cfe_test.h"

/*
* Initialization function
* Register this test routine with CFE Assert
*/
int32 CFE_Test_Init(int32 LibId)
{
UtTest_Add(ES_Test_AppId, NULL, NULL, "ES AppID");
return CFE_SUCCESS;
}


45 changes: 45 additions & 0 deletions modules/cfe_test/fsw/src/cfe_test.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*************************************************************************
**
** 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: cfe_test.c
**
** Purpose:
** Initialization routine for CFE functional test
** Demonstration of how to register and use the UT assert functions.
**
*************************************************************************/

#ifndef CFE_TEST_H
#define CFE_TEST_H

/*
* Includes
*/

#include <cfe.h>

#include "uttest.h"
#include "utassert.h"

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


#endif /* CFE_TEST_H */
46 changes: 46 additions & 0 deletions modules/cfe_test/fsw/src/es_test.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*************************************************************************
**
** 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_AppId(void)
{
uint32 AppId;
char AppNameBuf[OS_MAX_API_NAME+4];

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");
}

0 comments on commit f061d5d

Please sign in to comment.