Skip to content

Commit

Permalink
Merge pull request nasa#307 from nasa/integration-candidate
Browse files Browse the repository at this point in the history
psp Integration candidate: 2021-09-07
  • Loading branch information
astrogeco committed Sep 10, 2021
2 parents 6d40816 + e4722da commit 3909d4f
Show file tree
Hide file tree
Showing 10 changed files with 42 additions and 23 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ This is a collection of APIs abstracting platform specific functionality to be l

## Version History


### Development Build: v1.5.0-rc1+dev124

- Relax strict of check before calling "Init" function of module, only check that module type is not invalid
- Remove override of `add_psp_module` for coverage test
- See <https://github.com/nasa/PSP/pull/307> and <https://github.com/nasa/cFS/pull/351>

### Development Build: v1.5.0-rc1+dev118

- Implement Coding Standards in CodeQL
Expand Down
2 changes: 1 addition & 1 deletion fsw/mcp750-vxworks/inc/psp_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
/*
* Development Build Macro Definitions
*/
#define CFE_PSP_IMPL_BUILD_NUMBER 118
#define CFE_PSP_IMPL_BUILD_NUMBER 124
#define CFE_PSP_IMPL_BUILD_BASELINE "v1.5.0-rc1"

/*
Expand Down
2 changes: 1 addition & 1 deletion fsw/pc-linux/inc/psp_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
/*
* Development Build Macro Definitions
*/
#define CFE_PSP_IMPL_BUILD_NUMBER 118
#define CFE_PSP_IMPL_BUILD_NUMBER 124
#define CFE_PSP_IMPL_BUILD_BASELINE "v1.5.0-rc1"

/*
Expand Down
2 changes: 1 addition & 1 deletion fsw/pc-rtems/inc/psp_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
/*
* Development Build Macro Definitions
*/
#define CFE_PSP_IMPL_BUILD_NUMBER 118
#define CFE_PSP_IMPL_BUILD_NUMBER 124
#define CFE_PSP_IMPL_BUILD_BASELINE "v1.5.0-rc1"

/*
Expand Down
2 changes: 1 addition & 1 deletion fsw/shared/src/cfe_psp_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ void CFE_PSP_ModuleInitList(CFE_StaticModuleLoadEntry_t *ListPtr)
while (Entry->Name != NULL)
{
ApiPtr = (CFE_PSP_ModuleApi_t *)Entry->Api;
if ((uint32)ApiPtr->ModuleType == CFE_PSP_MODULE_TYPE_SIMPLE && ApiPtr->Init != NULL)
if ((uint32)ApiPtr->ModuleType != CFE_PSP_MODULE_TYPE_INVALID && ApiPtr->Init != NULL)
{
(*ApiPtr->Init)(CFE_PSP_MODULE_BASE | CFE_PSP_ModuleCount);
}
Expand Down
39 changes: 20 additions & 19 deletions unit-test-coverage/modules/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,33 @@
#
######################################################################

include_directories("${PSPCOVERAGE_SOURCE_DIR}/shared/inc")
include_directories("${PSPCOVERAGE_SOURCE_DIR}/modules/inc")

# redefine the add_psp_module to make a unit test variant
# this needs to name the target differently, so it doesn't conflict with the FSW target.
# this is similar to add_cfe_coverage_test() on the CFE side, but the set of interfaces
# and link libraries is different from that of a CFS app
function(add_psp_module MODULE_NAME)
# Function to simplify adding a coverage test for a PSP module
# This is very similar to the CFE "add_cfe_coverage" function, but
# include directories and link libraries are set up differently for PSP code,
# and it does not depend on having a FSW module by the same name.
function(add_psp_covtest MODULE_NAME TESTCASE_SRC UT_SRCS)

# A consistent name convention for all targets generated by this funtion
set(TEST_NAME "coverage-pspmod-${MODULE_NAME}")
set(OBJECT_TARGET "${TEST_NAME}-object")
set(RUNNER_TARGET "${TEST_NAME}-testrunner")
# Create the module

add_library(${OBJECT_TARGET} OBJECT ${ARGN})
# Compile the source unit(s) under test as a separate library
# This is done so that special coverage-specific compile flags can be used on these files
add_library(${OBJECT_TARGET} OBJECT
${UT_SRCS} ${ARGN}
)

# Apply the UT_COVERAGE_COMPILE_FLAGS to the units under test
# This should enable coverage analysis on platforms that support this
target_compile_options(${OBJECT_TARGET} PRIVATE
${UT_COVERAGE_COMPILE_FLAGS}
)

target_include_directories(${OBJECT_TARGET} PRIVATE
${PSPCOVERAGE_SOURCE_DIR}/ut-stubs/override_inc # overrides for system headers
${PSPCOVERAGE_SOURCE_DIR}/shared/inc
${CFEPSP_SOURCE_DIR}/fsw/inc # PSP public API
${CFEPSP_SOURCE_DIR}/fsw/shared/inc # all PSP shared headers
${CFE_SOURCE_DIR}/cmake/target/inc # for sysconfig headers
Expand All @@ -34,7 +40,7 @@ function(add_psp_module MODULE_NAME)
# Compile a test runner application, which contains the
# actual coverage test code (test cases) and the unit under test
add_executable(${RUNNER_TARGET}
${PSPCOVERAGE_SOURCE_DIR}/modules/src/coveragetest-${MODULE_NAME}.c
${TESTCASE_SRC}
$<TARGET_OBJECTS:${OBJECT_TARGET}>
)

Expand All @@ -49,19 +55,14 @@ function(add_psp_module MODULE_NAME)
ut_assert
)

# Add it to the set of tests to run as part of "make test"
add_test(${TEST_NAME} ${RUNNER_TARGET})
foreach(TGT ${INSTALL_TARGET_LIST})
install(TARGETS ${RUNNER_TARGET} DESTINATION ${TGT}/${UT_INSTALL_SUBDIR})
endforeach()

endfunction(add_psp_module)
endfunction(add_psp_covtest)

# a list of modules for which there is a coverage test implemented
set(UT_PSPMODLIST
timebase_vxworks
)

foreach(UT_PSPMOD ${UT_PSPMODLIST})
add_subdirectory(${CFEPSP_SOURCE_DIR}/fsw/modules/${UT_PSPMOD} ${UT_PSPMOD})
endforeach()

# a list of modules for which there is a coverage test implemented
add_subdirectory(timebase_vxworks)
11 changes: 11 additions & 0 deletions unit-test-coverage/modules/timebase_vxworks/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
######################################################################
#
# CMAKE build recipe for white-box coverage tests of VxWorks timebase module
#
######################################################################

include_directories("${CMAKE_CURRENT_SOURCE_DIR}/inc")

add_psp_covtest(timebase_vxworks src/coveragetest-timebase_vxworks.c
${CFEPSP_SOURCE_DIR}/fsw/modules/timebase_vxworks/cfe_psp_timebase_vxworks.c
)

0 comments on commit 3909d4f

Please sign in to comment.