Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integration candidate 2020-07-29 #184

Merged
merged 3 commits into from
Aug 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ add_library(psp-${CFE_PSP_TARGETNAME} STATIC
)

if (ENABLE_UNIT_TESTS)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/fsw/ut-stubs)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/ut-stubs)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/unit-test-coverage)
endif (ENABLE_UNIT_TESTS)

7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ This is a collection of APIs abstracting platform specific functionality to be l

## Version History

### Development Build: 1.4.0+dev76

- Provide a new framework and perform PSP coverage tests. New coverage test executable is built and several files within PSP are targeted.
- See <https://github.com/nasa/PSP/pull/184>

### Development Build: 1.4.0+dev71

- Restructure code to make more amicable for rebuilding in a unit test environment. No major changes, primarily just shifting code between locations/headers to support unit testing.
Expand Down Expand Up @@ -35,7 +40,7 @@ This is a collection of APIs abstracting platform specific functionality to be l
- Exception handling is now implemented on POSIX. There is no longer a separate handler for SIGINT - it is now treated as an exception and goes through the normal process which ends up "restarting" CFE. On pc-linux causes the process to exit normally. There is now a mechanism to capture the CTRL+C exception code and use it during normal test cycles.
- See <https://github.com/nasa/PSP/pull/160>

#### Development Build: 1.4.10
### Development Build: 1.4.10

- Implements full-precision microsecond conversion
- See <https://github.com/nasa/PSP/pull/155>
Expand Down
6 changes: 3 additions & 3 deletions 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 71
#define CFE_PSP_IMPL_BUILD_NUMBER 76
#define CFE_PSP_IMPL_BUILD_BASELINE "v1.4.0+dev"

/*
Expand Down Expand Up @@ -57,7 +57,7 @@
* See @ref cfsversions for format differences between development and release versions.
*/
#define CFE_PSP_IMPL_VERSION_STRING \
" PSP Development Build\n " CFE_PSP_IMPL_VERSION " (Codename: Bootes)" /* Codename for current development */ \
"\n Last Official Release: psp v1.4.0" /* For full support please use this version */
" PSP Development Build " CFE_PSP_IMPL_VERSION /* Codename for current development */ \
", Last Official Release: psp v1.4.0" /* For full support please use this version */

#endif /* _psp_version_ */
6 changes: 3 additions & 3 deletions 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 71
#define CFE_PSP_IMPL_BUILD_NUMBER 76
#define CFE_PSP_IMPL_BUILD_BASELINE "v1.4.0+dev"

/*
Expand Down Expand Up @@ -57,7 +57,7 @@
* See @ref cfsversions for format differences between development and release versions.
*/
#define CFE_PSP_IMPL_VERSION_STRING \
" PSP Development Build\n " CFE_PSP_IMPL_VERSION " (Codename: Bootes)" /* Codename for current development */ \
"\n Last Official Release: psp v1.4.0" /* For full support please use this version */
" PSP DEVELOPMENT BUILD " CFE_PSP_IMPL_VERSION \
", Last Official Release: psp v1.4.0" /* For full support please use this version */

#endif /* _psp_version_ */
6 changes: 3 additions & 3 deletions 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 71
#define CFE_PSP_IMPL_BUILD_NUMBER 76
#define CFE_PSP_IMPL_BUILD_BASELINE "v1.4.0+dev"

/*
Expand Down Expand Up @@ -57,7 +57,7 @@
* See @ref cfsversions for format differences between development and release versions.
*/
#define CFE_PSP_IMPL_VERSION_STRING \
" PSP Development Build\n " CFE_PSP_IMPL_VERSION " (Codename: Bootes)" /* Codename for current development */ \
"\n Last Official Release: psp v1.4.0" /* For full support please use this version */
" PSP DEVELOPMENT BUILD " CFE_PSP_IMPL_VERSION /* Codename for current development */ \
", Last Official Release: psp v1.4.0" /* For full support please use this version */

#endif /* _psp_version_ */
2 changes: 0 additions & 2 deletions fsw/ut-stubs/CMakeLists.txt

This file was deleted.

7 changes: 7 additions & 0 deletions unit-test-coverage/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
*~
*.o
*.gcov
*.gcda
*.gcno
*.exe
*_log.txt
38 changes: 38 additions & 0 deletions unit-test-coverage/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
######################################################################
#
# CMAKE build recipe for PSP white-box coverage tests
#
######################################################################

# The following cache variables are recognized:
# PSPCOVERAGE_TARGETS -> the intended PSP module(s) that run on the actual target
#
# Like OSAL coverage testing, the actual underlying OS calls are stubbed out, there
# is no dependency on the actual underlying OS. All coverage tests can be built on
# all platforms regardless of the actual PSP in use for flight software.

project(PSPCOVERAGE C)

# Currently only mcp750-vxworks is implemented a demonstration of how this works.
set(PSPCOVERAGE_TARGETS "mcp750-vxworks" CACHE STRING "PSP target(s) to build coverage tests for (default=all)")

# Check that coverage has been implemented for this PSPTYPE
foreach(PSPTYPE ${PSPCOVERAGE_TARGETS})
if (NOT IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${PSPTYPE})
message(FATAL_ERROR "No coverage tests implemented for ${PSPTYPE}")
endif (NOT IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${PSPTYPE})
endforeach(PSPTYPE ${PSPCOVERAGE_TARGETS})

message(STATUS "PSP Coverage Test Targets: ${PSPCOVERAGE_TARGETS}")

# Utilize the shared UT assert library, along with the standard OSAL includes
include_directories(${UT_ASSERT_SOURCE_DIR}/inc)
include_directories(${PSPCOVERAGE_SOURCE_DIR}/ut-stubs/inc)

add_subdirectory(ut-stubs)

# Build targets for each of the indicated PSPs
foreach(SETNAME ${PSPCOVERAGE_TARGETS})
add_subdirectory(${SETNAME})
endforeach(SETNAME ${PSPCOVERAGE_TARGETS})

63 changes: 63 additions & 0 deletions unit-test-coverage/mcp750-vxworks/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
######################################################################
#
# CMAKE build recipe for mcp750-vxworks PSP white-box coverage tests
#
######################################################################

include_directories("${CFEPSP_SOURCE_DIR}/fsw/mcp750-vxworks/inc")
include_directories("${PSPCOVERAGE_SOURCE_DIR}/shared/inc")

# The target names will be the PSP name with a "ut" prefix
# this is to distinguish these test targets from the FSW targets.
set(CFE_PSP_TARGETNAME "ut-${SETNAME}")
add_subdirectory("${CFEPSP_SOURCE_DIR}/fsw/${SETNAME}" "${CFE_PSP_TARGETNAME}-impl")
add_subdirectory("${CFEPSP_SOURCE_DIR}/fsw/shared" "${CFE_PSP_TARGETNAME}-shared")
add_subdirectory(adaptors)

# as UT assert defines OS_Application_Startup and OS_Application_Run, we need
# to change the ones in this module to a different name.
target_compile_definitions(psp-${CFE_PSP_TARGETNAME}-impl PRIVATE
OS_Application_Startup=UT_OS_Application_Startup
OS_Application_Run=UT_OS_Application_Run
)

# only the actual FSW src file gets the coverage instrumentation
target_compile_options(psp-${CFE_PSP_TARGETNAME}-impl PRIVATE
${UT_COVERAGE_COMPILE_FLAGS}
)
target_compile_options(psp-${CFE_PSP_TARGETNAME}-shared PRIVATE
${UT_COVERAGE_COMPILE_FLAGS}
)

# both the FSW src file and the adaptor file get compiled with override includes
target_include_directories(psp-${CFE_PSP_TARGETNAME}-impl BEFORE PRIVATE
${PSPCOVERAGE_SOURCE_DIR}/ut-stubs/override_inc
)
target_include_directories(psp-${CFE_PSP_TARGETNAME}-shared BEFORE PRIVATE
${PSPCOVERAGE_SOURCE_DIR}/ut-stubs/override_inc
)

add_executable(coverage-${CFE_PSP_TARGETNAME}-testrunner
src/coveragetest-psp-mcp750-vxworks.c
src/coveragetest-cfe-psp-start.c
src/coveragetest-cfe-psp-support.c
${PSPCOVERAGE_SOURCE_DIR}/shared/src/coveragetest-cfe-psp-exceptionstorage.c
$<TARGET_OBJECTS:psp-${CFE_PSP_TARGETNAME}-shared>
$<TARGET_OBJECTS:psp-${CFE_PSP_TARGETNAME}-impl>
)

target_link_libraries(coverage-${CFE_PSP_TARGETNAME}-testrunner
${UT_COVERAGE_LINK_FLAGS}
ut-adaptor-${CFE_PSP_TARGETNAME}
ut_psp_cfe_stubs
ut_psp_libc_stubs
ut_osapi_stubs
ut_assert
)

add_test(coverage-${CFE_PSP_TARGETNAME} coverage-${CFE_PSP_TARGETNAME}-testrunner)

foreach(TGT ${INSTALL_TARGET_LIST})
install(TARGETS coverage-${CFE_PSP_TARGETNAME}-testrunner DESTINATION ${TGTNAME}/${UT_INSTALL_SUBDIR})
endforeach()

33 changes: 33 additions & 0 deletions unit-test-coverage/mcp750-vxworks/adaptors/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#
# Copyright (c) 2019, United States government as represented by the
# administrator of the National Aeronautics Space Administration.
# All rights reserved. This software was created at NASA Goddard
# Space Flight Center pursuant to government contracts.
#
# This is governed by the NASA Open Source Agreement and may be used,
# distributed and modified only according to the terms of that agreement.
#


# "Adaptors" help enable the unit test code to reach functions/objects that
# are otherwise not exposed.

# NOTE: These source files are compile with OVERRIDES on the headers just like
# the FSW code is compiled. This is how it is able to include internal headers
# which otherwise would fail. But that also means that adaptor code cannot call
# any library functions, as this would also reach a stub, not the real function.

add_library(ut-adaptor-${CFE_PSP_TARGETNAME} STATIC
src/ut-adaptor-bootrec.c
${PSPCOVERAGE_SOURCE_DIR}/shared/adaptors/src/ut-adaptor-exceptions.c
)

# the "override_inc" dir contains replacement versions of the C-library include files.
target_include_directories(ut-adaptor-${CFE_PSP_TARGETNAME} BEFORE PRIVATE
${PSPCOVERAGE_SOURCE_DIR}/ut-stubs/override_inc
)

target_include_directories(ut-adaptor-${CFE_PSP_TARGETNAME} PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/inc
${PSPCOVERAGE_SOURCE_DIR}/shared/adaptors/inc
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
*
* Copyright (c) 2020, United States government as represented by the
* administrator of the National Aeronautics Space Administration.
* All rights reserved. This software was created at NASA Goddard
* Space Flight Center pursuant to government contracts.
*
* This is governed by the NASA Open Source Agreement and may be used,
* distributed and modified only according to the terms of that agreement.
*
*/


/**
* \file ut-adaptor-bootrec.h
* \ingroup adaptors
* \author joseph.p.hickey@nasa.gov
*
*/

#ifndef INCLUDE_UT_ADAPTOR_BOOTREC_H_
#define INCLUDE_UT_ADAPTOR_BOOTREC_H_

#include <common_types.h>

void UT_Setup_ReservedMem_BootRec(void);
uint32 UT_Get_ReservedMem_BootType(void);
void UT_Set_ReservedMem_BootType(uint32 reset_type);


#endif /* INCLUDE_UT_ADAPTOR_BOOTREC_H_ */

Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
*
* Copyright (c) 2020, United States government as represented by the
* administrator of the National Aeronautics Space Administration.
* All rights reserved. This software was created at NASA Goddard
* Space Flight Center pursuant to government contracts.
*
* This is governed by the NASA Open Source Agreement and may be used,
* distributed and modified only according to the terms of that agreement.
*
*/


/**
* \file ut-adaptor-bootrec.c
* \ingroup adaptors
* \author joseph.p.hickey@nasa.gov
*
*/

#include "ut-adaptor-bootrec.h"
#include <cfe_psp_config.h>
#include <cfe_psp_memory.h>


static CFE_PSP_ReservedMemoryBootRecord_t UT_BOOTREC;

static const CFE_PSP_ReservedMemoryBootRecord_t UT_DEFAULT_BOOTREC = { 0 };


void UT_Setup_ReservedMem_BootRec(void)
{
UT_BOOTREC = UT_DEFAULT_BOOTREC;
CFE_PSP_ReservedMemoryMap.BootPtr = &UT_BOOTREC;
}

uint32 UT_Get_ReservedMem_BootType(void)
{
return UT_BOOTREC.bsp_reset_type;
}

void UT_Set_ReservedMem_BootType(uint32 reset_type)
{
UT_BOOTREC.bsp_reset_type = reset_type;
}


Loading