Skip to content

Commit d1f3cde

Browse files
committed
Update #778, add CFE test module
1 parent 75d93fc commit d1f3cde

File tree

6 files changed

+145
-2
lines changed

6 files changed

+145
-2
lines changed

cmake/arch_build.cmake

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,6 @@ function(add_unit_test_exe UT_NAME UT_SRCS)
215215
add_test(${UT_NAME} ${UT_NAME})
216216
endfunction(add_unit_test_exe)
217217

218-
219218
##################################################################
220219
#
221220
# FUNCTION: cfe_exec_do_install

cmake/mission_defaults.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,6 @@ set(psp_SEARCH_PATH ".")
4949
# If ENABLE_UNIT_TEST is enabled, then include the cfe_assert library in
5050
# all targets. This can still be overridden in targets.cmake.
5151
if (ENABLE_UNIT_TESTS)
52-
list(APPEND MISSION_GLOBAL_APPLIST cfe_assert)
52+
list(APPEND MISSION_GLOBAL_APPLIST cfe_assert cfe_test)
5353
endif (ENABLE_UNIT_TESTS)
5454

modules/cfe_test/CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
include_directories("${CFE_ASSERT_SOURCE_DIR}/fsw/inc")
2+
include_directories("${UT_ASSERT_SOURCE_DIR}/inc")
3+
4+
# Create the app module
5+
add_cfe_app(cfe_test
6+
fsw/src/cfe_test.c
7+
fsw/src/es_test.c
8+
)
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/*************************************************************************
2+
**
3+
** GSC-18128-1, "Core Flight Executive Version 6.7"
4+
**
5+
** Copyright (c) 2006-2019 United States Government as represented by
6+
** the Administrator of the National Aeronautics and Space Administration.
7+
** All Rights Reserved.
8+
**
9+
** Licensed under the Apache License, Version 2.0 (the "License");
10+
** you may not use this file except in compliance with the License.
11+
** You may obtain a copy of the License at
12+
**
13+
** http://www.apache.org/licenses/LICENSE-2.0
14+
**
15+
** Unless required by applicable law or agreed to in writing, software
16+
** distributed under the License is distributed on an "AS IS" BASIS,
17+
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18+
** See the License for the specific language governing permissions and
19+
** limitations under the License.
20+
**
21+
** File: cfe_test.c
22+
**
23+
** Purpose:
24+
** Initialization routine for CFE functional test
25+
** Demonstration of how to register and use the UT assert functions.
26+
**
27+
*************************************************************************/
28+
29+
/*
30+
* Includes
31+
*/
32+
33+
#include "cfe_test.h"
34+
35+
/*
36+
* Initialization function
37+
* Register this test routine with CFE Assert
38+
*/
39+
int32 CFE_Test_Init(int32 LibId)
40+
{
41+
UtTest_Add(ES_Test_AppId, NULL, NULL, "ES AppID");
42+
return CFE_SUCCESS;
43+
}
44+
45+
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/*************************************************************************
2+
**
3+
** GSC-18128-1, "Core Flight Executive Version 6.7"
4+
**
5+
** Copyright (c) 2006-2019 United States Government as represented by
6+
** the Administrator of the National Aeronautics and Space Administration.
7+
** All Rights Reserved.
8+
**
9+
** Licensed under the Apache License, Version 2.0 (the "License");
10+
** you may not use this file except in compliance with the License.
11+
** You may obtain a copy of the License at
12+
**
13+
** http://www.apache.org/licenses/LICENSE-2.0
14+
**
15+
** Unless required by applicable law or agreed to in writing, software
16+
** distributed under the License is distributed on an "AS IS" BASIS,
17+
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18+
** See the License for the specific language governing permissions and
19+
** limitations under the License.
20+
**
21+
** File: cfe_test.c
22+
**
23+
** Purpose:
24+
** Initialization routine for CFE functional test
25+
** Demonstration of how to register and use the UT assert functions.
26+
**
27+
*************************************************************************/
28+
29+
#ifndef CFE_TEST_H
30+
#define CFE_TEST_H
31+
32+
/*
33+
* Includes
34+
*/
35+
36+
#include <cfe.h>
37+
38+
#include "uttest.h"
39+
#include "utassert.h"
40+
41+
void ES_Test_AppId(void);
42+
int32 CFE_Test_Init(int32 LibId);
43+
44+
45+
#endif /* CFE_TEST_H */

modules/cfe_test/fsw/src/es_test.c

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/*************************************************************************
2+
**
3+
** GSC-18128-1, "Core Flight Executive Version 6.7"
4+
**
5+
** Copyright (c) 2006-2019 United States Government as represented by
6+
** the Administrator of the National Aeronautics and Space Administration.
7+
** All Rights Reserved.
8+
**
9+
** Licensed under the Apache License, Version 2.0 (the "License");
10+
** you may not use this file except in compliance with the License.
11+
** You may obtain a copy of the License at
12+
**
13+
** http://www.apache.org/licenses/LICENSE-2.0
14+
**
15+
** Unless required by applicable law or agreed to in writing, software
16+
** distributed under the License is distributed on an "AS IS" BASIS,
17+
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18+
** See the License for the specific language governing permissions and
19+
** limitations under the License.
20+
**
21+
** File: es_test.c
22+
**
23+
** Purpose:
24+
** Functional test of basic ES APIs
25+
**
26+
** Demonstration of how to register and use the UT assert functions.
27+
**
28+
*************************************************************************/
29+
30+
/*
31+
* Includes
32+
*/
33+
34+
#include "cfe_test.h"
35+
36+
37+
void ES_Test_AppId(void)
38+
{
39+
uint32 AppId;
40+
char AppNameBuf[OS_MAX_API_NAME+4];
41+
42+
UtAssert_INT32_EQ(CFE_ES_GetAppID(&AppId), CFE_SUCCESS);
43+
UtAssert_INT32_EQ(CFE_ES_GetAppName(AppNameBuf, AppId, sizeof(AppNameBuf)), CFE_SUCCESS);
44+
UtAssert_StrCmp(AppNameBuf, "ASSERT_APP", "CFE_ES_GetAppName() returned ASSERT_APP");
45+
}
46+

0 commit comments

Comments
 (0)