Skip to content

Commit 73c338d

Browse files
authored
Merge pull request #1406 from nasa/integration-candidate
cFE Integration candidate: 2021-04-20
2 parents e80aae9 + c96267c commit 73c338d

25 files changed

+309
-200
lines changed

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,14 @@ The detailed cFE user's guide can be viewed at <https://github.com/nasa/cFS/blob
1010

1111
## Version History
1212

13+
### Development Build: v6.8.0-rc1+dev509
14+
15+
- Separates the list of CFE core interface modules (e.g. core_api) from the list of CFE core implementation modules (e.g. msg). This allows the content of core_api to be expanded to locally include any additional modules the user has added to cFE core via the `MISSION_CORE_MODULES` list.
16+
- Adds documentation for `CFE_ES_RegisterCDS()` regarding clearing.
17+
- Removes the separate CFE "testrunner" module and moves the logic associated with running a test into cfe_assert library. Converts the "testcase" module from a library into an app, by calling into the runner logic that is now inside cfe_assert. Each functional test is a separate app, not a library, so it can be started and stopped via ES command like any other app.
18+
- Removes check on `ENABLE_UNIT_TESTS=true` when building "cfe_assert", it should be built all the time.
19+
- See <https://github.com/nasa/cfe/pull/1406> and <https://github.com/nasa/cfs/pull/248>
20+
1321
### Development Build: v6.8.0-rc1+dev498
1422

1523
- Reports test failures as CFE events. Test status messages are now sent as Events rather than Syslog. This allows for more processing capability, and allows failures to be received externally (e.g. ground system).

cmake/arch_build.cmake

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ endfunction(add_cfe_coverage_dependency)
258258
# FUNCTION: add_cfe_coverage_test
259259
#
260260
# Add executable target for coverage testing. This builds the target
261-
# units with extra compiler flags for coverage instrumentation, along with
261+
# units with extra compiler flags for coverage instrumentation, along with
262262
# a "testrunner" executable to run the tests. It also registers
263263
# that testrunner with ctest via the add_test() function.
264264
#
@@ -620,6 +620,7 @@ function(process_arch SYSVAR)
620620
# this may result in "add_subdirectory" of itself which causes a loop. This can happen
621621
# if the variables/lists were modified unexpectedly.
622622
foreach(DEP
623+
${MISSION_CORE_INTERFACES}
623624
${MISSION_CORE_MODULES}
624625
${TGTSYS_${SYSVAR}_PSPMODULES}
625626
${TGTSYS_${SYSVAR}_STATICAPPS}
@@ -632,7 +633,7 @@ function(process_arch SYSVAR)
632633

633634
# Add all core modules
634635
# The osal is handled explicitly (above) since this has special extra config
635-
foreach(DEP ${MISSION_CORE_MODULES})
636+
foreach(DEP ${MISSION_CORE_INTERFACES} ${MISSION_CORE_MODULES})
636637
if(NOT DEP STREQUAL "osal")
637638
message(STATUS "Building Core Module: ${DEP}")
638639
add_subdirectory("${${DEP}_MISSION_DIR}" ${DEP})

cmake/mission_build.cmake

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ function(prepare)
194194
# This reflects all modules for all CPUs. It is set as a usage convenience
195195
# for iterating through the full set of dependencies regardless of which level
196196
# or context each dependency relates to (CFE, PSP, apps, etc).
197-
set(MISSION_DEPS ${MISSION_APPS} ${MISSION_CORE_MODULES} ${MISSION_PSPMODULES})
197+
set(MISSION_DEPS ${MISSION_CORE_INTERFACES} ${MISSION_APPS} ${MISSION_CORE_MODULES} ${MISSION_PSPMODULES})
198198
set(APP_MISSING_COUNT 0)
199199

200200
message(STATUS "Search path for modules: ${MISSION_MODULE_SEARCH_PATH}")
@@ -288,7 +288,7 @@ function(prepare)
288288
"${osal_MISSION_DIR}/src/os/inc/*.h"
289289
"${psp_MISSION_DIR}/psp/fsw/inc/*.h"
290290
)
291-
foreach(MODULE core_api es evs fs msg sb tbl time)
291+
foreach(MODULE core_api ${MISSION_CORE_MODULES})
292292
list(APPEND SUBMODULE_HEADER_PATHS "${${MODULE}_MISSION_DIR}/fsw/inc/*.h")
293293
endforeach()
294294
file(GLOB MISSION_USERGUIDE_HEADERFILES
@@ -371,12 +371,6 @@ function(prepare)
371371
# Add all public include dirs for core components to include path for tools
372372
include_directories(
373373
${core_api_MISSION_DIR}/fsw/inc
374-
#${es_MISSION_DIR}/fsw/inc
375-
#${evs_MISSION_DIR}/fsw/inc
376-
#${fs_MISSION_DIR}/fsw/inc
377-
#${sb_MISSION_DIR}/fsw/inc
378-
#${tbl_MISSION_DIR}/fsw/inc
379-
#${time_MISSION_DIR}/fsw/inc
380374
${osal_MISSION_DIR}/src/os/inc
381375
${psp_MISSION_DIR}/psp/fsw/inc
382376
)

cmake/mission_defaults.cmake

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,23 @@
77
#
88
##################################################################
99

10+
# The "MISSION_CORE_INTERFACES" defines the set of interface libraries
11+
# that comprise CFE core. These are CMake interface libraries that define
12+
# a set of include directories and compile options for all modules,
13+
# including the ubiquitous "cfe.h" header file and all it depends on).
14+
# NOTE: these interfaces are really what defines "CFE core" - changing
15+
# this list is not recommend, as these interface names are important.
16+
set(MISSION_CORE_INTERFACES
17+
core_api # this is the "public" core API that apps use, includes cfe.h and all core headers
18+
core_private # this is the "private" interface that core apps use, but not used by apps
19+
)
20+
1021
# The "MISSION_CORE_MODULES" will be built and statically linked as part
1122
# of the CFE core executable on every target. These can be used to amend
1223
# or override parts of the CFE core on a mission-specific basis.
13-
# The "intf" modules are headers only, and define the interface(s) between components
24+
# NOTE: Everthing in this list becomes part of the "core_api" interface above.
25+
# Missions may add/remove/replace components in this list as needed.
1426
set(MISSION_CORE_MODULES
15-
"core_api"
16-
"core_private"
1727
"es"
1828
"evs"
1929
"fs"
@@ -56,9 +66,13 @@ set(MISSION_MODULE_SEARCH_PATH
5666
set(osal_SEARCH_PATH ".")
5767
set(psp_SEARCH_PATH ".")
5868

59-
# If ENABLE_UNIT_TEST is enabled, then include the cfe_assert library in
60-
# all targets. This can still be overridden in targets.cmake.
69+
# Include "cfe_assert" library in all builds, because it is included
70+
# in the default startup script. It should not have any effect if not
71+
# used.
72+
list(APPEND MISSION_GLOBAL_APPLIST cfe_assert)
73+
74+
# If ENABLE_UNIT_TEST is enabled, then include the cfe_testcase app
6175
if (ENABLE_UNIT_TESTS)
62-
list(APPEND MISSION_GLOBAL_APPLIST cfe_assert cfe_testrunner cfe_testcase)
76+
list(APPEND MISSION_GLOBAL_APPLIST cfe_testcase)
6377
endif (ENABLE_UNIT_TESTS)
6478

cmake/sample_defs/cpu1_cfe_es_startup.scr

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
CFE_LIB, sample_lib, SAMPLE_LIB_Init, SAMPLE_LIB, 0, 0, 0x0, 0;
2-
CFE_APP, sample_app, SAMPLE_APP_Main, SAMPLE_APP, 50, 16384, 0x0, 0;
3-
CFE_APP, ci_lab, CI_Lab_AppMain, CI_LAB_APP, 60, 16384, 0x0, 0;
4-
CFE_APP, to_lab, TO_Lab_AppMain, TO_LAB_APP, 70, 16384, 0x0, 0;
5-
CFE_APP, sch_lab, SCH_Lab_AppMain, SCH_LAB_APP, 80, 16384, 0x0, 0;
1+
CFE_LIB, cfe_assert, CFE_Assert_LibInit, ASSERT_LIB, 0, 0, 0x0, 0;
2+
CFE_LIB, sample_lib, SAMPLE_LIB_Init, SAMPLE_LIB, 0, 0, 0x0, 0;
3+
CFE_APP, sample_app, SAMPLE_APP_Main, SAMPLE_APP, 50, 16384, 0x0, 0;
4+
CFE_APP, ci_lab, CI_Lab_AppMain, CI_LAB_APP, 60, 16384, 0x0, 0;
5+
CFE_APP, to_lab, TO_Lab_AppMain, TO_LAB_APP, 70, 16384, 0x0, 0;
6+
CFE_APP, sch_lab, SCH_Lab_AppMain, SCH_LAB_APP, 80, 16384, 0x0, 0;
67
!
78
! Startup script fields:
89
! 1. Object Type -- CFE_APP for an Application, or CFE_LIB for a library.

cmake/target/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ configure_file(${CFE_SOURCE_DIR}/cmake/cfe_generated_file.h.in ${CMAKE_CURRENT_B
5050

5151
# Generate lists of modules that will be statically linked into this CFE core target
5252
set(GENERATED_ENTRIES_CORE_MODULES)
53-
foreach(DEP ${MISSION_CORE_MODULES})
53+
foreach(DEP core_api ${MISSION_CORE_MODULES})
5454
list(APPEND GENERATED_ENTRIES_CORE_MODULES "{ \"${DEP}\" },\n")
5555
endforeach()
5656

@@ -257,6 +257,8 @@ if (DEFINED ${TGTNAME}_EMBED_FILELIST)
257257
endif (DEFINED ${TGTNAME}_EMBED_FILELIST)
258258

259259
target_link_libraries(core-${TGTNAME}
260+
${MISSION_CORE_INTERFACES}
261+
260262
# The following libs should be included whole, even if they
261263
# do not necessarily resolve any symbols, because they may be needed by apps
262264
${START_WHOLE_ARCHIVE}

docs/README_functionaltest.md

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,25 @@
22

33
This version of CFE includes additional modular libraries and an application
44
to execute functional tests within an unmodified CFE environment. These are
5-
distinct from the unit tests, which are executed separately from CFE in a
5+
distinct from the unit tests, which are executed separately from CFE in a
66
confined (non-CFE, test-specific) environment.
77

88
## Building the modules
99

10-
These modules are built automatically when `ENABLE_UNIT_TESTS` is enabled
10+
These modules are built automatically when `ENABLE_UNIT_TESTS` is enabled
1111
in the build. However, they can be added to any CFE build by adding the
1212
following to the `APPLIST` of any target in `targets.cmake`:
1313

1414
- `cfe_assert`: a CFE-compatible library wrapping the basic UT assert library. This
15-
is the same library that all other unit tests use, but configured to be
15+
is the same library that all other unit tests use, but configured to be
1616
dynamically loaded into the CFE environment, and using CFE syslog for its output.
1717
This must be the first library loaded for any functional test.
1818

1919
- `cfe_testcase`: a CFE-compatible library implementing test cases for CFE core apps.
20-
This must be loaded after `cfe_assert`.
20+
This must be loaded after `cfe_assert`.
2121

22-
- `cfe_testrunner`: a CFE application that actually executes the tests. This is a very
23-
simple app that waits for CFE startup to complete, then executes all registered test
22+
- `cfe_testrunner`: a CFE application that actually executes the tests. This is a very
23+
simple app that waits for CFE startup to complete, then executes all registered test
2424
cases. It also must be loaded after `cfe_assert`.
2525

2626

@@ -29,12 +29,10 @@ cases. It also must be loaded after `cfe_assert`.
2929
To execute tests at startup, the following lines can be added to `cfe_es_startup.scr` on the
3030
designated test target:
3131

32-
CFE_LIB, cfe_assert, CFE_Assert_LibInit, ASSERT_LIB, 0, 0, 0x0, 0;
33-
CFE_APP, cfe_testrunner, CFE_TR_AppMain, TESTRUN_APP, 100, 16384, 0x0, 0;
34-
CFE_LIB, cfe_testcase, CFE_Test_Init, CFETEST_LIB, 0, 0, 0x0, 0;
35-
CFE_LIB, psp_test, PSP_Test_Init, PSPTEST_LIB, 0, 0, 0x0, 0;
32+
CFE_LIB, cfe_assert, CFE_Assert_LibInit, ASSERT_LIB, 0, 0, 0x0, 0;
33+
CFE_APP, cfe_testcase, CFE_TestMain, CFE_TEST_APP, 100, 16384, 0x0, 0;
3634

37-
It is important that `cfe_assert` is loaded first, as all other test libraries depend on
35+
It is important that `cfe_assert` is loaded first, as all other test applications depend on
3836
symbols provided in this library. The order of loading other test cases should not
39-
matter with respect to symbol resolution, but note that test cases will be executed in
40-
the same order that they are registered.
37+
matter with respect to symbol resolution, but note that test apps may be executed in
38+
a different order than they are listed in the startup script.

modules/cfe_assert/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ project(CFE_ASSERT C)
44
add_cfe_app(cfe_assert
55
src/cfe_assert_io.c
66
src/cfe_assert_init.c
7+
src/cfe_assert_runner.c
78
$<TARGET_OBJECTS:ut_assert_pic>
89
)
910

modules/cfe_assert/inc/cfe_assert.h

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
** Includes
3939
*************************************************************************/
4040
#include "common_types.h"
41+
#include "cfe_es_api_typedefs.h"
4142

4243
/************************************************************************
4344
** Type Definitions
@@ -50,19 +51,45 @@ typedef void (*CFE_Assert_StatusCallback_t)(uint8 MessageType, const char *Prefi
5051
*************************************************************************/
5152

5253
/************************************************************************/
53-
/** \brief Application Entry Point Function
54+
/** \brief Library Init Function
5455
**
5556
** \par Description
5657
** This function should be specified in the cfe_es_startup.scr file
57-
** as part of starting this application.
58+
** as part of loading this library.
59+
**
60+
** \par Assumptions, External Events, and Notes:
61+
** None
62+
**
63+
** \return #CFE_SUCCESS if successful, or error code
64+
**
65+
*************************************************************************/
66+
int32 CFE_Assert_LibInit(CFE_ES_LibId_t LibId);
67+
68+
/************************************************************************/
69+
/** \brief Start Test
70+
**
71+
** \par Description
72+
**
73+
** \par Assumptions, External Events, and Notes:
74+
** Must be followed by a call to CFE_Assert_ExecuteTest()
75+
**
76+
** \return None
77+
**
78+
*************************************************************************/
79+
int32 CFE_Assert_RegisterTest(const char *TestName);
80+
81+
/************************************************************************/
82+
/** \brief Execute Test and Exit
83+
**
84+
** \par Description
5885
**
5986
** \par Assumptions, External Events, and Notes:
6087
** None
6188
**
6289
** \return None
6390
**
6491
*************************************************************************/
65-
void CFE_Assert_AppMain(void);
92+
void CFE_Assert_ExecuteTest(void);
6693

6794
/************************************************************************/
6895
/** \brief Register a test status callback

modules/cfe_assert/src/cfe_assert_init.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,22 @@ void CFE_Assert_RegisterCallback(CFE_Assert_StatusCallback_t Callback)
4747
/*
4848
* Initialization Function for this library
4949
*/
50-
int32 CFE_Assert_LibInit(uint32 LibId)
50+
int32 CFE_Assert_LibInit(CFE_ES_LibId_t LibId)
5151
{
52+
int32 status;
53+
54+
memset(&CFE_Assert_Global, 0, sizeof(CFE_Assert_Global));
55+
5256
UtTest_EarlyInit();
5357
UT_BSP_Setup();
5458

59+
status = OS_MutSemCreate(&CFE_Assert_Global.AccessMutex, "CFE_Assert", 0);
60+
if (status != OS_SUCCESS)
61+
{
62+
CFE_ES_WriteToSysLog("%s(): OS_MutSemCreate failed, rc=%d\n", __func__, (int)status);
63+
return CFE_STATUS_EXTERNAL_RESOURCE_FAIL;
64+
}
65+
5566
/*
5667
* Start a test case for all startup logic.
5768
*

0 commit comments

Comments
 (0)