From 597921ee8fbcf5556bc57bdd1b11371a70d91469 Mon Sep 17 00:00:00 2001 From: Joseph Hickey Date: Tue, 16 Jun 2020 13:53:48 -0400 Subject: [PATCH 1/2] Fix #168, add PSP coverage test example Implement a basic example of PSP coverage test. --- CMakeLists.txt | 3 +- fsw/ut-stubs/CMakeLists.txt | 2 - unit-test-coverage/.gitignore | 7 + unit-test-coverage/CMakeLists.txt | 38 ++++ .../mcp750-vxworks/CMakeLists.txt | 63 ++++++ .../mcp750-vxworks/adaptors/CMakeLists.txt | 33 +++ .../adaptors/inc/ut-adaptor-bootrec.h | 32 +++ .../adaptors/src/ut-adaptor-bootrec.c | 47 ++++ .../src/coveragetest-cfe-psp-start.c | 150 +++++++++++++ .../src/coveragetest-cfe-psp-support.c | 103 +++++++++ .../src/coveragetest-psp-mcp750-vxworks.c | 69 ++++++ .../src/coveragetest-psp-mcp750-vxworks.h | 55 +++++ .../adaptors/inc/ut-adaptor-exceptions.h | 33 +++ .../adaptors/src/ut-adaptor-exceptions.c | 54 +++++ .../shared/inc/coveragetest-psp-shared.h | 35 +++ .../coveragetest-cfe-psp-exceptionstorage.c | 174 +++++++++++++++ unit-test-coverage/ut-stubs/CMakeLists.txt | 60 ++++++ .../ut-stubs/inc/PCS_arch_ppc_esfPpc.h | 26 +++ .../ut-stubs/inc/PCS_arch_ppc_vxPpcLib.h | 41 ++++ .../ut-stubs/inc/PCS_basetypes.h | 31 +++ unit-test-coverage/ut-stubs/inc/PCS_blkIo.h | 24 +++ .../ut-stubs/inc/PCS_cacheLib.h | 22 ++ .../ut-stubs/inc/PCS_cfe_configdata.h | 37 ++++ .../ut-stubs/inc/PCS_dosFsLib.h | 29 +++ .../ut-stubs/inc/PCS_drv_hdisk_ataDrv.h | 26 +++ .../ut-stubs/inc/PCS_errnoLib.h | 24 +++ unit-test-coverage/ut-stubs/inc/PCS_excLib.h | 24 +++ unit-test-coverage/ut-stubs/inc/PCS_fppLib.h | 26 +++ unit-test-coverage/ut-stubs/inc/PCS_mcpx750.h | 29 +++ .../ut-stubs/inc/PCS_moduleLib.h | 41 ++++ unit-test-coverage/ut-stubs/inc/PCS_ramDrv.h | 27 +++ .../ut-stubs/inc/PCS_rebootLib.h | 24 +++ unit-test-coverage/ut-stubs/inc/PCS_stdarg.h | 28 +++ unit-test-coverage/ut-stubs/inc/PCS_stdio.h | 39 ++++ unit-test-coverage/ut-stubs/inc/PCS_stdlib.h | 31 +++ unit-test-coverage/ut-stubs/inc/PCS_string.h | 33 +++ unit-test-coverage/ut-stubs/inc/PCS_sysLib.h | 33 +++ .../ut-stubs/inc/PCS_sys_types.h | 29 +++ unit-test-coverage/ut-stubs/inc/PCS_taskLib.h | 95 +++++++++ unit-test-coverage/ut-stubs/inc/PCS_unistd.h | 42 ++++ unit-test-coverage/ut-stubs/inc/PCS_usrLib.h | 23 ++ unit-test-coverage/ut-stubs/inc/PCS_vxLib.h | 22 ++ unit-test-coverage/ut-stubs/inc/PCS_vxWorks.h | 77 +++++++ .../ut-stubs/inc/PCS_xbdBlkDev.h | 28 +++ .../ut-stubs/inc/PCS_xbdRamDisk.h | 23 ++ unit-test-coverage/ut-stubs/inc/README.md | 63 ++++++ .../ut-stubs/override_inc/arch/ppc/esfPpc.h | 23 ++ .../ut-stubs/override_inc/arch/ppc/vxPpcLib.h | 43 ++++ .../ut-stubs/override_inc/blkIo.h | 26 +++ .../ut-stubs/override_inc/cacheLib.h | 23 ++ .../ut-stubs/override_inc/dosFsLib.h | 31 +++ .../ut-stubs/override_inc/drv/hdisk/ataDrv.h | 26 +++ .../ut-stubs/override_inc/errnoLib.h | 25 +++ .../ut-stubs/override_inc/excLib.h | 24 +++ .../ut-stubs/override_inc/fppLib.h | 23 ++ .../ut-stubs/override_inc/mcpx750.h | 33 +++ .../ut-stubs/override_inc/moduleLib.h | 30 +++ .../ut-stubs/override_inc/ramDrv.h | 26 +++ .../ut-stubs/override_inc/rebootLib.h | 26 +++ .../ut-stubs/override_inc/stdarg.h | 26 +++ .../ut-stubs/override_inc/stdio.h | 39 ++++ .../ut-stubs/override_inc/stdlib.h | 30 +++ .../ut-stubs/override_inc/string.h | 33 +++ .../ut-stubs/override_inc/sys/types.h | 27 +++ .../ut-stubs/override_inc/sysLib.h | 38 ++++ .../ut-stubs/override_inc/taskLib.h | 47 ++++ .../ut-stubs/override_inc/unistd.h | 42 ++++ .../ut-stubs/override_inc/usrLib.h | 24 +++ .../ut-stubs/override_inc/vxLib.h | 23 ++ .../ut-stubs/override_inc/vxWorks.h | 53 +++++ .../ut-stubs/override_inc/xbdBlkDev.h | 31 +++ .../ut-stubs/override_inc/xbdRamDisk.h | 24 +++ .../ut-stubs/src/cfe-configdata-stubs.c | 86 ++++++++ .../ut-stubs/src/libc-stdio-stubs.c | 197 +++++++++++++++++ .../ut-stubs/src/libc-stdlib-stubs.c | 197 +++++++++++++++++ .../ut-stubs/src/libc-string-stubs.c | 201 ++++++++++++++++++ .../ut-stubs/src/vxworks-ataDrv-stubs.c | 21 ++ .../ut-stubs/src/vxworks-cacheLib-stubs.c | 21 ++ .../ut-stubs/src/vxworks-excLib-stubs.c | 21 ++ .../ut-stubs/src/vxworks-fppLib-stubs.c | 21 ++ .../ut-stubs/src/vxworks-mcpx750-stubs.c | 20 ++ .../ut-stubs/src/vxworks-moduleLib-stubs.c | 46 ++++ .../ut-stubs/src/vxworks-rebootLib-stubs.c | 21 ++ .../ut-stubs/src/vxworks-sysLib-stubs.c | 64 ++++++ .../ut-stubs/src/vxworks-taskLib-stubs.c | 172 +++++++++++++++ .../ut-stubs/src/vxworks-vxLib-stubs.c | 45 ++++ ut-stubs/CMakeLists.txt | 2 + {fsw/ut-stubs => ut-stubs}/ut_psp_stubs.c | 0 88 files changed, 3883 insertions(+), 3 deletions(-) delete mode 100644 fsw/ut-stubs/CMakeLists.txt create mode 100644 unit-test-coverage/.gitignore create mode 100644 unit-test-coverage/CMakeLists.txt create mode 100644 unit-test-coverage/mcp750-vxworks/CMakeLists.txt create mode 100644 unit-test-coverage/mcp750-vxworks/adaptors/CMakeLists.txt create mode 100644 unit-test-coverage/mcp750-vxworks/adaptors/inc/ut-adaptor-bootrec.h create mode 100644 unit-test-coverage/mcp750-vxworks/adaptors/src/ut-adaptor-bootrec.c create mode 100644 unit-test-coverage/mcp750-vxworks/src/coveragetest-cfe-psp-start.c create mode 100644 unit-test-coverage/mcp750-vxworks/src/coveragetest-cfe-psp-support.c create mode 100644 unit-test-coverage/mcp750-vxworks/src/coveragetest-psp-mcp750-vxworks.c create mode 100644 unit-test-coverage/mcp750-vxworks/src/coveragetest-psp-mcp750-vxworks.h create mode 100644 unit-test-coverage/shared/adaptors/inc/ut-adaptor-exceptions.h create mode 100644 unit-test-coverage/shared/adaptors/src/ut-adaptor-exceptions.c create mode 100644 unit-test-coverage/shared/inc/coveragetest-psp-shared.h create mode 100644 unit-test-coverage/shared/src/coveragetest-cfe-psp-exceptionstorage.c create mode 100644 unit-test-coverage/ut-stubs/CMakeLists.txt create mode 100644 unit-test-coverage/ut-stubs/inc/PCS_arch_ppc_esfPpc.h create mode 100644 unit-test-coverage/ut-stubs/inc/PCS_arch_ppc_vxPpcLib.h create mode 100644 unit-test-coverage/ut-stubs/inc/PCS_basetypes.h create mode 100644 unit-test-coverage/ut-stubs/inc/PCS_blkIo.h create mode 100644 unit-test-coverage/ut-stubs/inc/PCS_cacheLib.h create mode 100644 unit-test-coverage/ut-stubs/inc/PCS_cfe_configdata.h create mode 100644 unit-test-coverage/ut-stubs/inc/PCS_dosFsLib.h create mode 100644 unit-test-coverage/ut-stubs/inc/PCS_drv_hdisk_ataDrv.h create mode 100644 unit-test-coverage/ut-stubs/inc/PCS_errnoLib.h create mode 100644 unit-test-coverage/ut-stubs/inc/PCS_excLib.h create mode 100644 unit-test-coverage/ut-stubs/inc/PCS_fppLib.h create mode 100644 unit-test-coverage/ut-stubs/inc/PCS_mcpx750.h create mode 100644 unit-test-coverage/ut-stubs/inc/PCS_moduleLib.h create mode 100644 unit-test-coverage/ut-stubs/inc/PCS_ramDrv.h create mode 100644 unit-test-coverage/ut-stubs/inc/PCS_rebootLib.h create mode 100644 unit-test-coverage/ut-stubs/inc/PCS_stdarg.h create mode 100644 unit-test-coverage/ut-stubs/inc/PCS_stdio.h create mode 100644 unit-test-coverage/ut-stubs/inc/PCS_stdlib.h create mode 100644 unit-test-coverage/ut-stubs/inc/PCS_string.h create mode 100644 unit-test-coverage/ut-stubs/inc/PCS_sysLib.h create mode 100644 unit-test-coverage/ut-stubs/inc/PCS_sys_types.h create mode 100644 unit-test-coverage/ut-stubs/inc/PCS_taskLib.h create mode 100644 unit-test-coverage/ut-stubs/inc/PCS_unistd.h create mode 100644 unit-test-coverage/ut-stubs/inc/PCS_usrLib.h create mode 100644 unit-test-coverage/ut-stubs/inc/PCS_vxLib.h create mode 100644 unit-test-coverage/ut-stubs/inc/PCS_vxWorks.h create mode 100644 unit-test-coverage/ut-stubs/inc/PCS_xbdBlkDev.h create mode 100644 unit-test-coverage/ut-stubs/inc/PCS_xbdRamDisk.h create mode 100644 unit-test-coverage/ut-stubs/inc/README.md create mode 100644 unit-test-coverage/ut-stubs/override_inc/arch/ppc/esfPpc.h create mode 100644 unit-test-coverage/ut-stubs/override_inc/arch/ppc/vxPpcLib.h create mode 100644 unit-test-coverage/ut-stubs/override_inc/blkIo.h create mode 100644 unit-test-coverage/ut-stubs/override_inc/cacheLib.h create mode 100644 unit-test-coverage/ut-stubs/override_inc/dosFsLib.h create mode 100644 unit-test-coverage/ut-stubs/override_inc/drv/hdisk/ataDrv.h create mode 100644 unit-test-coverage/ut-stubs/override_inc/errnoLib.h create mode 100644 unit-test-coverage/ut-stubs/override_inc/excLib.h create mode 100644 unit-test-coverage/ut-stubs/override_inc/fppLib.h create mode 100644 unit-test-coverage/ut-stubs/override_inc/mcpx750.h create mode 100644 unit-test-coverage/ut-stubs/override_inc/moduleLib.h create mode 100644 unit-test-coverage/ut-stubs/override_inc/ramDrv.h create mode 100644 unit-test-coverage/ut-stubs/override_inc/rebootLib.h create mode 100644 unit-test-coverage/ut-stubs/override_inc/stdarg.h create mode 100644 unit-test-coverage/ut-stubs/override_inc/stdio.h create mode 100644 unit-test-coverage/ut-stubs/override_inc/stdlib.h create mode 100644 unit-test-coverage/ut-stubs/override_inc/string.h create mode 100644 unit-test-coverage/ut-stubs/override_inc/sys/types.h create mode 100644 unit-test-coverage/ut-stubs/override_inc/sysLib.h create mode 100644 unit-test-coverage/ut-stubs/override_inc/taskLib.h create mode 100644 unit-test-coverage/ut-stubs/override_inc/unistd.h create mode 100644 unit-test-coverage/ut-stubs/override_inc/usrLib.h create mode 100644 unit-test-coverage/ut-stubs/override_inc/vxLib.h create mode 100644 unit-test-coverage/ut-stubs/override_inc/vxWorks.h create mode 100644 unit-test-coverage/ut-stubs/override_inc/xbdBlkDev.h create mode 100644 unit-test-coverage/ut-stubs/override_inc/xbdRamDisk.h create mode 100644 unit-test-coverage/ut-stubs/src/cfe-configdata-stubs.c create mode 100644 unit-test-coverage/ut-stubs/src/libc-stdio-stubs.c create mode 100644 unit-test-coverage/ut-stubs/src/libc-stdlib-stubs.c create mode 100644 unit-test-coverage/ut-stubs/src/libc-string-stubs.c create mode 100644 unit-test-coverage/ut-stubs/src/vxworks-ataDrv-stubs.c create mode 100644 unit-test-coverage/ut-stubs/src/vxworks-cacheLib-stubs.c create mode 100644 unit-test-coverage/ut-stubs/src/vxworks-excLib-stubs.c create mode 100644 unit-test-coverage/ut-stubs/src/vxworks-fppLib-stubs.c create mode 100644 unit-test-coverage/ut-stubs/src/vxworks-mcpx750-stubs.c create mode 100644 unit-test-coverage/ut-stubs/src/vxworks-moduleLib-stubs.c create mode 100644 unit-test-coverage/ut-stubs/src/vxworks-rebootLib-stubs.c create mode 100644 unit-test-coverage/ut-stubs/src/vxworks-sysLib-stubs.c create mode 100644 unit-test-coverage/ut-stubs/src/vxworks-taskLib-stubs.c create mode 100644 unit-test-coverage/ut-stubs/src/vxworks-vxLib-stubs.c create mode 100644 ut-stubs/CMakeLists.txt rename {fsw/ut-stubs => ut-stubs}/ut_psp_stubs.c (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 24ec09f6..ffe77156 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/fsw/ut-stubs/CMakeLists.txt b/fsw/ut-stubs/CMakeLists.txt deleted file mode 100644 index 4fe0a02d..00000000 --- a/fsw/ut-stubs/CMakeLists.txt +++ /dev/null @@ -1,2 +0,0 @@ -include_directories(${osal_MISSION_DIR}/ut_assert/inc) -add_library(ut_psp-${CFE_SYSTEM_PSPNAME}_stubs ut_psp_stubs.c) diff --git a/unit-test-coverage/.gitignore b/unit-test-coverage/.gitignore new file mode 100644 index 00000000..69f05c8b --- /dev/null +++ b/unit-test-coverage/.gitignore @@ -0,0 +1,7 @@ +*~ +*.o +*.gcov +*.gcda +*.gcno +*.exe +*_log.txt diff --git a/unit-test-coverage/CMakeLists.txt b/unit-test-coverage/CMakeLists.txt new file mode 100644 index 00000000..d9836875 --- /dev/null +++ b/unit-test-coverage/CMakeLists.txt @@ -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}) + diff --git a/unit-test-coverage/mcp750-vxworks/CMakeLists.txt b/unit-test-coverage/mcp750-vxworks/CMakeLists.txt new file mode 100644 index 00000000..4e359b8c --- /dev/null +++ b/unit-test-coverage/mcp750-vxworks/CMakeLists.txt @@ -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_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() + diff --git a/unit-test-coverage/mcp750-vxworks/adaptors/CMakeLists.txt b/unit-test-coverage/mcp750-vxworks/adaptors/CMakeLists.txt new file mode 100644 index 00000000..d6b2f777 --- /dev/null +++ b/unit-test-coverage/mcp750-vxworks/adaptors/CMakeLists.txt @@ -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 +) diff --git a/unit-test-coverage/mcp750-vxworks/adaptors/inc/ut-adaptor-bootrec.h b/unit-test-coverage/mcp750-vxworks/adaptors/inc/ut-adaptor-bootrec.h new file mode 100644 index 00000000..f87b4b91 --- /dev/null +++ b/unit-test-coverage/mcp750-vxworks/adaptors/inc/ut-adaptor-bootrec.h @@ -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 + +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_ */ + diff --git a/unit-test-coverage/mcp750-vxworks/adaptors/src/ut-adaptor-bootrec.c b/unit-test-coverage/mcp750-vxworks/adaptors/src/ut-adaptor-bootrec.c new file mode 100644 index 00000000..181c95f5 --- /dev/null +++ b/unit-test-coverage/mcp750-vxworks/adaptors/src/ut-adaptor-bootrec.c @@ -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 +#include + + +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; +} + + diff --git a/unit-test-coverage/mcp750-vxworks/src/coveragetest-cfe-psp-start.c b/unit-test-coverage/mcp750-vxworks/src/coveragetest-cfe-psp-start.c new file mode 100644 index 00000000..990aa105 --- /dev/null +++ b/unit-test-coverage/mcp750-vxworks/src/coveragetest-cfe-psp-start.c @@ -0,0 +1,150 @@ +/* + * + * 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 coveragetest-binsem.c + * \ingroup vxworks + * \author joseph.p.hickey@nasa.gov + * + */ + + +#include "coveragetest-psp-mcp750-vxworks.h" +#include "ut-adaptor-bootrec.h" + +#include + +#include +#include +#include +#include + +extern void UT_OS_Application_Startup(void); +extern void UT_OS_Application_Run(void); + +uint32 UT_ReservedMemBuffer[256]; + +typedef struct +{ + uint32 StartType; + uint32 StartSubtype; +} PSP_UT_StartType_t; + +/* + * A hook function that can check/verify the reset sub type + */ +static int32 Test_Hook_ResetSubType(void *UserObj, int32 StubRetcode, uint32 CallCount, const UT_StubContext_t *Context) +{ + PSP_UT_StartType_t *UserBuffer = UserObj; + UserBuffer->StartType = UT_Hook_GetArgValueByName(Context, "StartType", uint32); + UserBuffer->StartSubtype = UT_Hook_GetArgValueByName(Context, "StartSubtype", uint32); + return StubRetcode; +} + +void Test_OS_Application_Startup(void) +{ + /* + * Test Case For: + * void OS_Application_Startup(void) + * + * NOTE: The UT assert library itself defines OS_Application_Startup + * To avoid conflict with the UT assert, the unit under test is renamed + * to "UT_OS_Application_Startup" using a preprocessor definition + */ + PSP_UT_StartType_t StartType; + + /* Install a hook function to grab the start type parameters from the system main call */ + UT_SetHookFunction(UT_KEY(PCS_SystemMain), Test_Hook_ResetSubType, &StartType); + UT_Setup_ReservedMem_BootRec(); + + /* nominal */ + UT_SetDataBuffer(UT_KEY(PCS_sysMemTop), UT_ReservedMemBuffer, sizeof(UT_ReservedMemBuffer), false); + UT_OS_Application_Startup(); + UtAssert_INT32_EQ(UT_GetStubCount(UT_KEY(OS_printf)), 4); + UtAssert_INT32_EQ(UT_GetStubCount(UT_KEY(PCS_SystemMain)), 1); + UtAssert_INT32_EQ(StartType.StartType, CFE_PSP_RST_TYPE_POWERON); + UtAssert_INT32_EQ(StartType.StartSubtype, CFE_PSP_RST_SUBTYPE_UNDEFINED_RESET); + + /* failure of OS_API_Init */ + UT_SetForceFail(UT_KEY(OS_API_Init), OS_ERROR); + UT_OS_Application_Startup(); + UtAssert_INT32_EQ(UT_GetStubCount(UT_KEY(PCS_exit)), 1); + UT_ClearForceFail(UT_KEY(OS_API_Init)); + + /* failure of OS_FileSysAddFixedMap - an extra OS_printf */ + UT_SetForceFail(UT_KEY(OS_FileSysAddFixedMap), OS_ERROR); + UT_OS_Application_Startup(); + UtAssert_INT32_EQ(UT_GetStubCount(UT_KEY(OS_printf)), 9); + UtAssert_INT32_EQ(UT_GetStubCount(UT_KEY(PCS_SystemMain)), 2); + UT_ClearForceFail(UT_KEY(OS_FileSysAddFixedMap)); + + /* coverage for each of the reset types */ + *PCS_SYS_REG_BLRR = PCS_SYS_REG_BLRR_PWRON; + UT_OS_Application_Startup(); + UtAssert_INT32_EQ(UT_GetStubCount(UT_KEY(PCS_SystemMain)), 3); + UtAssert_INT32_EQ(StartType.StartType, CFE_PSP_RST_TYPE_POWERON); + UtAssert_INT32_EQ(StartType.StartSubtype, CFE_PSP_RST_SUBTYPE_POWER_CYCLE); + + *PCS_SYS_REG_BLRR = PCS_SYS_REG_BLRR_PBRST; + UT_OS_Application_Startup(); + UtAssert_INT32_EQ(UT_GetStubCount(UT_KEY(PCS_SystemMain)), 4); + UtAssert_INT32_EQ(StartType.StartType, CFE_PSP_RST_TYPE_POWERON); + UtAssert_INT32_EQ(StartType.StartSubtype, CFE_PSP_RST_SUBTYPE_PUSH_BUTTON); + + *PCS_SYS_REG_BLRR = PCS_SYS_REG_BLRR_FBTN; + UT_OS_Application_Startup(); + UtAssert_INT32_EQ(UT_GetStubCount(UT_KEY(PCS_SystemMain)), 5); + UtAssert_INT32_EQ(StartType.StartType, CFE_PSP_RST_SUBTYPE_PUSH_BUTTON); + UtAssert_INT32_EQ(StartType.StartSubtype, 3); + + *PCS_SYS_REG_BLRR = PCS_SYS_REG_BLRR_WDT2; + UT_OS_Application_Startup(); + UtAssert_INT32_EQ(UT_GetStubCount(UT_KEY(PCS_SystemMain)), 6); + UtAssert_INT32_EQ(StartType.StartType, CFE_PSP_RST_TYPE_PROCESSOR); + UtAssert_INT32_EQ(StartType.StartSubtype, CFE_PSP_RST_SUBTYPE_HW_WATCHDOG); + + *PCS_SYS_REG_BLRR = PCS_SYS_REG_BLRR_SWSRST; + UT_OS_Application_Startup(); + UtAssert_INT32_EQ(UT_GetStubCount(UT_KEY(PCS_SystemMain)), 7); + UtAssert_INT32_EQ(StartType.StartType, CFE_PSP_RST_TYPE_PROCESSOR); + UtAssert_INT32_EQ(StartType.StartSubtype, CFE_PSP_RST_SUBTYPE_RESET_COMMAND); + + *PCS_SYS_REG_BLRR = PCS_SYS_REG_BLRR_SWHRST; + UT_Set_ReservedMem_BootType(CFE_PSP_RST_TYPE_POWERON); + UT_OS_Application_Startup(); + UtAssert_INT32_EQ(UT_GetStubCount(UT_KEY(PCS_SystemMain)), 8); + UtAssert_INT32_EQ(StartType.StartType, CFE_PSP_RST_TYPE_POWERON); + UtAssert_INT32_EQ(StartType.StartSubtype, CFE_PSP_RST_SUBTYPE_RESET_COMMAND); + + UT_Set_ReservedMem_BootType(CFE_PSP_RST_TYPE_PROCESSOR); + UT_OS_Application_Startup(); + UtAssert_INT32_EQ(UT_GetStubCount(UT_KEY(PCS_SystemMain)), 9); + UtAssert_INT32_EQ(StartType.StartType, CFE_PSP_RST_TYPE_PROCESSOR); + UtAssert_INT32_EQ(StartType.StartSubtype, CFE_PSP_RST_SUBTYPE_RESET_COMMAND); + +} + +void Test_OS_Application_Run(void) +{ + /* + * Test Case For: + * void OS_Application_Run(void) + * + * NOTE: The UT assert library itself defines OS_Application_Run + * To avoid conflict with the UT assert, the unit under test is renamed + * to "UT_OS_Application_Run" using a preprocessor definition + */ + + /* The function currently contains an infinite loop so cannot be tested now */ +} + diff --git a/unit-test-coverage/mcp750-vxworks/src/coveragetest-cfe-psp-support.c b/unit-test-coverage/mcp750-vxworks/src/coveragetest-cfe-psp-support.c new file mode 100644 index 00000000..a43b4539 --- /dev/null +++ b/unit-test-coverage/mcp750-vxworks/src/coveragetest-cfe-psp-support.c @@ -0,0 +1,103 @@ +/* + * + * 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 coveragetest-binsem.c + * \ingroup vxworks + * \author joseph.p.hickey@nasa.gov + * + */ + + +#include "coveragetest-psp-mcp750-vxworks.h" +#include "ut-adaptor-bootrec.h" + +#include + +#include +#include +#include +#include "PCS_cfe_configdata.h" + +void Test_CFE_PSP_Restart(void) +{ + /* + * Test Case For: + * void CFE_PSP_Restart(uint32 reset_type) + */ + + UT_Setup_ReservedMem_BootRec(); + CFE_PSP_Restart(CFE_PSP_RST_TYPE_PROCESSOR); + UtAssert_INT32_EQ(UT_Get_ReservedMem_BootType(), CFE_PSP_RST_TYPE_PROCESSOR); + UtAssert_INT32_EQ(UT_GetStubCount(UT_KEY(PCS_cacheTextUpdate)), 1); + UtAssert_INT32_EQ(UT_GetStubCount(UT_KEY(PCS_reboot)), 1); + + UT_Setup_ReservedMem_BootRec(); + CFE_PSP_Restart(CFE_PSP_RST_TYPE_POWERON); + UtAssert_INT32_EQ(UT_Get_ReservedMem_BootType(), CFE_PSP_RST_TYPE_POWERON); + UtAssert_INT32_EQ(UT_GetStubCount(UT_KEY(PCS_cacheTextUpdate)), 2); + UtAssert_INT32_EQ(UT_GetStubCount(UT_KEY(PCS_reboot)), 2); +} + +void Test_CFE_PSP_Panic(void) +{ + /* + * Test Case For: + * void CFE_PSP_Panic(int32 ErrorCode) + */ + CFE_PSP_Panic(0); + UtAssert_INT32_EQ(UT_GetStubCount(UT_KEY(PCS_exit)), 1); +} + +void Test_CFE_PSP_FlushCaches(void) +{ + /* + * Test Case For: + * void CFE_PSP_FlushCaches(uint32 type, void* address, uint32 size) + */ + + CFE_PSP_FlushCaches(0, NULL, 0); + UtAssert_INT32_EQ(UT_GetStubCount(UT_KEY(PCS_cacheTextUpdate)), 0); + CFE_PSP_FlushCaches(1, NULL, 0); + UtAssert_INT32_EQ(UT_GetStubCount(UT_KEY(PCS_cacheTextUpdate)), 1); +} + +void Test_CFE_PSP_GetProcessorId(void) +{ + /* + * Test Case For: + * uint32 CFE_PSP_GetProcessorId (void) + */ + + /* + * Note - the data structure used here is declared as "const" internally so + * there is no way to modify the value at runtime, even in unit test. + */ + UtAssert_INT32_EQ(CFE_PSP_GetProcessorId(), PCS_CONFIG_CPUNUMBER); +} + +void Test_CFE_PSP_GetSpacecraftId(void) +{ + /* + * Test Case For: + * uint32 CFE_PSP_GetSpacecraftId (void) + */ + + /* + * Note - the data structure used here is declared as "const" internally so + * there is no way to modify the value at runtime, even in unit test. + */ + UtAssert_INT32_EQ(CFE_PSP_GetSpacecraftId(), PCS_CONFIG_SPACECRAFT); + +} + diff --git a/unit-test-coverage/mcp750-vxworks/src/coveragetest-psp-mcp750-vxworks.c b/unit-test-coverage/mcp750-vxworks/src/coveragetest-psp-mcp750-vxworks.c new file mode 100644 index 00000000..2cb50510 --- /dev/null +++ b/unit-test-coverage/mcp750-vxworks/src/coveragetest-psp-mcp750-vxworks.c @@ -0,0 +1,69 @@ +/* + * + * 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 coveragetest-binsem.c + * \ingroup vxworks + * \author joseph.p.hickey@nasa.gov + * + */ + + +#include "coveragetest-psp-mcp750-vxworks.h" + + +/* Psp_Test_Setup + * + * Purpose: + * Called by the unit test tool to set up the app prior to each test + */ +void Psp_Test_Setup(void) +{ + UT_ResetState(0); +} + +/* + * Test_Teardown + * + * Purpose: + * Called by the unit test tool to tear down the app after each test + */ +void Psp_Test_Teardown(void) +{ + +} + +/* UtTest_Setup + * + * Purpose: + * Registers the test cases to execute with the unit test tool + */ +void UtTest_Setup(void) +{ + ADD_TEST(OS_Application_Run); + ADD_TEST(OS_Application_Startup); + + ADD_TEST(CFE_PSP_Restart); + ADD_TEST(CFE_PSP_Panic); + ADD_TEST(CFE_PSP_FlushCaches); + ADD_TEST(CFE_PSP_GetProcessorId); + ADD_TEST(CFE_PSP_GetSpacecraftId); + + ADD_TEST(CFE_PSP_Exception_GetBuffer); + ADD_TEST(CFE_PSP_Exception_GetNextContextBuffer); + ADD_TEST(CFE_PSP_Exception_GetSummary); + ADD_TEST(CFE_PSP_Exception_CopyContext); + +} + + diff --git a/unit-test-coverage/mcp750-vxworks/src/coveragetest-psp-mcp750-vxworks.h b/unit-test-coverage/mcp750-vxworks/src/coveragetest-psp-mcp750-vxworks.h new file mode 100644 index 00000000..aad7e935 --- /dev/null +++ b/unit-test-coverage/mcp750-vxworks/src/coveragetest-psp-mcp750-vxworks.h @@ -0,0 +1,55 @@ +/* + * + * 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 psp-mcp750-vxworks-coveragetest.h + * \ingroup vxworks + * \author joseph.p.hickey@nasa.gov + * + */ + +#ifndef INCLUDE_PSP_MCP750_VXWORKS_COVERAGETEST_H_ +#define INCLUDE_PSP_MCP750_VXWORKS_COVERAGETEST_H_ + +#include +#include +#include + +#include + +#define ADD_TEST(test) UtTest_Add((Test_ ## test), Psp_Test_Setup, Psp_Test_Teardown, #test) + +/* Psp_Test_Setup + * + * Purpose: + * Called by the unit test tool to set up the app prior to each test + */ +void Psp_Test_Setup(void); +void Psp_Test_Teardown(void); + + +/* + * Test routine dedicated to coverage of each of the PSP implementation functions + */ +void Test_CFE_PSP_Restart(void); +void Test_CFE_PSP_Panic(void); +void Test_CFE_PSP_FlushCaches(void); +void Test_CFE_PSP_GetProcessorId(void); +void Test_CFE_PSP_GetSpacecraftId(void); + +void Test_OS_Application_Startup(void); +void Test_OS_Application_Run(void); + + +#endif /* INCLUDE_PSP_MCP750_VXWORKS_COVERAGETEST_H_ */ + diff --git a/unit-test-coverage/shared/adaptors/inc/ut-adaptor-exceptions.h b/unit-test-coverage/shared/adaptors/inc/ut-adaptor-exceptions.h new file mode 100644 index 00000000..ee251c25 --- /dev/null +++ b/unit-test-coverage/shared/adaptors/inc/ut-adaptor-exceptions.h @@ -0,0 +1,33 @@ +/* + * + * 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-exceptions.h + * \ingroup adaptors + * \author joseph.p.hickey@nasa.gov + * + */ + +#ifndef INCLUDE_UT_ADAPTOR_EXCEPTIONS_H_ +#define INCLUDE_UT_ADAPTOR_EXCEPTIONS_H_ + +#include +#include + +uint32 UT_Get_Exception_MaxEntries(void); +size_t UT_Get_Exception_Size(void); +uint32 UT_Get_Exception_Id(struct CFE_PSP_Exception_LogData* Buffer); +void UT_Generate_Exception_Context(struct CFE_PSP_Exception_LogData* Buffer, size_t Size); + +#endif /* INCLUDE_UT_ADAPTOR_EXCEPTIONS_H_ */ + diff --git a/unit-test-coverage/shared/adaptors/src/ut-adaptor-exceptions.c b/unit-test-coverage/shared/adaptors/src/ut-adaptor-exceptions.c new file mode 100644 index 00000000..438c1a57 --- /dev/null +++ b/unit-test-coverage/shared/adaptors/src/ut-adaptor-exceptions.c @@ -0,0 +1,54 @@ +/* + * + * 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-exceptions.c + * \ingroup adaptors + * \author joseph.p.hickey@nasa.gov + * + */ + +#include "ut-adaptor-exceptions.h" +#include +#include + +#define CFE_PSP_MAX_EXCEPTION_ENTRIES 4 +#define CFE_PSP_MAX_EXCEPTION_BACKTRACE_SIZE 16 + +uint32 UT_Get_Exception_MaxEntries(void) +{ + return CFE_PSP_MAX_EXCEPTION_ENTRIES; +} + +size_t UT_Get_Exception_Size(void) +{ + return sizeof(CFE_PSP_Exception_ContextDataEntry_t); +} + +void UT_Generate_Exception_Context(struct CFE_PSP_Exception_LogData* Buffer, size_t Size) +{ + size_t i; + uint8 *Dest = (uint8*)&Buffer->context_info; + for(i=0; i < Size && i < sizeof(Buffer->context_info); ++i) + { + *Dest = i & 0xFF; + } + Buffer->context_size = i; +} + +uint32 UT_Get_Exception_Id(struct CFE_PSP_Exception_LogData* Buffer) +{ + return Buffer->context_id; +} + + diff --git a/unit-test-coverage/shared/inc/coveragetest-psp-shared.h b/unit-test-coverage/shared/inc/coveragetest-psp-shared.h new file mode 100644 index 00000000..0701909e --- /dev/null +++ b/unit-test-coverage/shared/inc/coveragetest-psp-shared.h @@ -0,0 +1,35 @@ +/* + * + * 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 psp-shared-coveragetest.h + * \ingroup vxworks + * \author joseph.p.hickey@nasa.gov + * + */ + +#ifndef INCLUDE_PSP_SHARED_COVERAGETEST_H_ +#define INCLUDE_PSP_SHARED_COVERAGETEST_H_ + +#include +#include +#include + +void Test_CFE_PSP_Exception_GetBuffer(void); +void Test_CFE_PSP_Exception_GetNextContextBuffer(void); +void Test_CFE_PSP_Exception_GetSummary(void); +void Test_CFE_PSP_Exception_CopyContext(void); + + +#endif /* INCLUDE_PSP_SHARED_COVERAGETEST_H_ */ + diff --git a/unit-test-coverage/shared/src/coveragetest-cfe-psp-exceptionstorage.c b/unit-test-coverage/shared/src/coveragetest-cfe-psp-exceptionstorage.c new file mode 100644 index 00000000..87c6c3f8 --- /dev/null +++ b/unit-test-coverage/shared/src/coveragetest-cfe-psp-exceptionstorage.c @@ -0,0 +1,174 @@ +/* + * + * 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 coveragetest-binsem.c + * \ingroup vxworks + * \author joseph.p.hickey@nasa.gov + * + */ + +#include "utassert.h" +#include "utstubs.h" +#include "ut-adaptor-exceptions.h" + +#include +#include + +#ifdef jphfix +#include +#include +#include +#include "PCS_cfe_configdata.h" +#endif + + +void Test_CFE_PSP_Exception_GetBuffer(void) +{ + /* + * Test Case For: + * CFE_PSP_Exception_LogData_t* CFE_PSP_Exception_GetBuffer(uint32 seq) + */ + struct CFE_PSP_Exception_LogData* Ptr0; + struct CFE_PSP_Exception_LogData* Ptr1; + + Ptr0 = CFE_PSP_Exception_GetBuffer(0); + UtAssert_True(Ptr0 != NULL, "CFE_PSP_Exception_GetBuffer(0) (%p) != NULL", (void*)Ptr0); + Ptr1 = CFE_PSP_Exception_GetBuffer(1); + UtAssert_True(Ptr1 != NULL, "CFE_PSP_Exception_GetBuffer(1) (%p) != NULL", (void*)Ptr1); + + UtAssert_True(Ptr0 != Ptr1, "CFE_PSP_Exception_GetBuffer(0) (%p) != CFE_PSP_Exception_GetBuffer(1) (%p)", + (void*)Ptr0, (void*)Ptr1); + +} +void Test_CFE_PSP_Exception_GetNextContextBuffer(void) +{ + /* + * Test Case For: + * + * void CFE_PSP_Exception_Reset(void) + * CFE_PSP_Exception_LogData_t* CFE_PSP_Exception_GetNextContextBuffer(void) + * void CFE_PSP_Exception_WriteComplete(void) + * uint32 CFE_PSP_Exception_GetCount(void) + */ + uint32 NumEntries; + uint32 Count; + + CFE_PSP_Exception_Reset(); + UtAssert_ZERO(CFE_PSP_Exception_GetCount()); + NumEntries = UT_Get_Exception_MaxEntries(); + + for (Count = 1; Count <= NumEntries; ++Count) + { + UtAssert_NOT_NULL(CFE_PSP_Exception_GetNextContextBuffer()); + CFE_PSP_Exception_WriteComplete(); + + UtAssert_UINT32_EQ(CFE_PSP_Exception_GetCount(), Count); + } + + /* Final call should return NULL */ + UtAssert_NULL(CFE_PSP_Exception_GetNextContextBuffer()); + CFE_PSP_Exception_Reset(); + UtAssert_ZERO(CFE_PSP_Exception_GetCount()); +} + +void Test_CFE_PSP_Exception_GetSummary(void) +{ + /* + * Test Case For: + * int32 CFE_PSP_Exception_GetSummary(uint32 *ContextLogId, uint32 *TaskId, char *ReasonBuf, uint32 ReasonSize) + */ + char ReasonBuf[128]; + uint32 LogId; + uint32 TaskId; + uint32 TestId; + + /* Nominal - no exceptions pending should return CFE_PSP_NO_EXCEPTION_DATA */ + CFE_PSP_Exception_Reset(); + UtAssert_INT32_EQ(CFE_PSP_Exception_GetSummary(&LogId, &TaskId, ReasonBuf, sizeof(ReasonBuf)), CFE_PSP_NO_EXCEPTION_DATA); + + + /* Set up an entry and then run again */ + TestId = 2857; + UT_SetDataBuffer(UT_KEY(OS_TaskFindIdBySystemData), &TestId, sizeof(TestId), false); + UtAssert_NOT_NULL(CFE_PSP_Exception_GetNextContextBuffer()); + CFE_PSP_Exception_WriteComplete(); + UtAssert_INT32_EQ(CFE_PSP_Exception_GetSummary(&LogId, &TaskId, ReasonBuf, sizeof(ReasonBuf)), CFE_PSP_SUCCESS); + UtAssert_NONZERO(LogId); + UtAssert_UINT32_EQ(TaskId, TestId); + UtAssert_ZERO(CFE_PSP_Exception_GetCount()); + + /* Get an entry with failure to obtain task ID */ + UtAssert_NOT_NULL(CFE_PSP_Exception_GetNextContextBuffer()); + CFE_PSP_Exception_WriteComplete(); + UT_SetForceFail(UT_KEY(OS_TaskFindIdBySystemData), OS_ERROR); + UtAssert_INT32_EQ(CFE_PSP_Exception_GetSummary(&LogId, &TaskId, ReasonBuf, sizeof(ReasonBuf)), CFE_PSP_SUCCESS); + UT_ClearForceFail(UT_KEY(OS_TaskFindIdBySystemData)); + UtAssert_NONZERO(LogId); + UtAssert_ZERO(TaskId); + + UtAssert_NOT_NULL(CFE_PSP_Exception_GetNextContextBuffer()); + CFE_PSP_Exception_WriteComplete(); + UtAssert_INT32_EQ(CFE_PSP_Exception_GetSummary(&LogId, &TaskId, NULL, 0), CFE_PSP_SUCCESS); + + UtAssert_NOT_NULL(CFE_PSP_Exception_GetNextContextBuffer()); + CFE_PSP_Exception_WriteComplete(); + UtAssert_INT32_EQ(CFE_PSP_Exception_GetSummary(&LogId, NULL, ReasonBuf, sizeof(ReasonBuf)), CFE_PSP_SUCCESS); +} + +void Test_CFE_PSP_Exception_CopyContext(void) +{ + /* + * Test Case For: + * int32 CFE_PSP_Exception_CopyContext(uint32 ContextLogId, void *ContextBuf, uint32 ContextSize) + */ + struct CFE_PSP_Exception_LogData* Ptr; + uint32 LogId; + uint32 NumEntries; + uint32 Count; + uint32 SmallBuf[1]; + uint32 LargeBuf[4]; + + CFE_PSP_Exception_Reset(); + UtAssert_INT32_EQ(CFE_PSP_Exception_CopyContext(0, SmallBuf, sizeof(SmallBuf)), CFE_PSP_NO_EXCEPTION_DATA); + + Ptr = CFE_PSP_Exception_GetNextContextBuffer(); + UtAssert_True(Ptr != NULL, "CFE_PSP_Exception_GetNextContextBuffer() (%p) != NULL", (void*)Ptr); + LogId = UT_Get_Exception_Id(Ptr); + UT_Generate_Exception_Context(Ptr, sizeof(LargeBuf)); + CFE_PSP_Exception_WriteComplete(); + UtAssert_NONZERO(LogId); + + /* Read first entry - remove from ring */ + UtAssert_INT32_EQ(CFE_PSP_Exception_GetSummary(NULL, NULL, NULL, 0), CFE_PSP_SUCCESS); + + /* Passing in a too-small buffer will work but will truncate the data */ + UtAssert_INT32_EQ(CFE_PSP_Exception_CopyContext(LogId, SmallBuf, sizeof(SmallBuf)), sizeof(SmallBuf)); + UtAssert_STUB_COUNT(OS_printf, 1); + + UtAssert_INT32_EQ(CFE_PSP_Exception_CopyContext(LogId, LargeBuf, sizeof(LargeBuf)), sizeof(LargeBuf)); + UtAssert_STUB_COUNT(OS_printf, 1); + + /* Test wrap-around/overwrite */ + /* Fill the remainder of entries */ + NumEntries = UT_Get_Exception_MaxEntries(); + for (Count = 0; Count < NumEntries; ++Count) + { + CFE_PSP_Exception_GetNextContextBuffer(); + CFE_PSP_Exception_WriteComplete(); + } + + UtAssert_UINT32_EQ(CFE_PSP_Exception_GetCount(), NumEntries); + UtAssert_INT32_EQ(CFE_PSP_Exception_CopyContext(LogId, SmallBuf, sizeof(SmallBuf)), CFE_PSP_NO_EXCEPTION_DATA); +} + diff --git a/unit-test-coverage/ut-stubs/CMakeLists.txt b/unit-test-coverage/ut-stubs/CMakeLists.txt new file mode 100644 index 00000000..edb75797 --- /dev/null +++ b/unit-test-coverage/ut-stubs/CMakeLists.txt @@ -0,0 +1,60 @@ +# ---------------------------------------- +# Stub libraries for coverage testing +# ---------------------------------------- + +# This provides suitable "stub" implementations of every +# function call used internally by the various OSAL modules +# for which there is not a stub already defined. +# +# (Note this is not the public OSAL API - that is stubbed separately) +# +# This includes: +# - Stub versions of C library calls defined per ANSI C89/C99 +# i.e. memset, strcmp, etc - these should be relevant for all +# supported operating systems as they are standard C +# - Stub versions of internal "shared" OSAL implementation functions +# i.e. everything declared in the internal API. These are needed by +# any coverage test referencing on the shared/ng OSAL layer. +# + +# The "ut_libc_stubs" target provides stub versions of C library calls. +# They are prefixed with "OCS_" and target code must be recompiled to +# call the OCS_ version of the syscall instead of the regular syscall. +# This is because in some circumstances for these calls the stub actually +# needs to invoke the real version or else weird things happen. +# This library includes stubs from all supported operating systems. This +# is generally OK as we do not use any actual OS system headers +# +# These files are generally organized to match whatever header file +# defines the function. For instance, POSIX defines the "mqueue.h" +# header file which in turn provides mq_open, mq_close, etc. So +# the OCS_mq_open, OCS_mq_close declarations are in overrides/mqueue.h, and +# the respective implementation is in posix-mqueue-stubs.c. +# +# This keeps things relatively organized, and by keeping the source files +# relatively small and targeted like this the linker should only pull in +# the OCS functions that are actually used. +# +add_library(ut_psp_libc_stubs STATIC EXCLUDE_FROM_ALL + src/libc-stdio-stubs.c + src/libc-stdlib-stubs.c + src/libc-string-stubs.c + src/vxworks-ataDrv-stubs.c + src/vxworks-cacheLib-stubs.c + src/vxworks-moduleLib-stubs.c + src/vxworks-taskLib-stubs.c + src/vxworks-excLib-stubs.c + src/vxworks-fppLib-stubs.c + src/vxworks-mcpx750-stubs.c + src/vxworks-rebootLib-stubs.c + src/vxworks-sysLib-stubs.c + src/vxworks-vxLib-stubs.c +) + +target_include_directories(ut_libc_stubs PUBLIC + ${CMAKE_CURRENT_SOURCE_DIR}/inc +) + +add_library(ut_psp_cfe_stubs STATIC EXCLUDE_FROM_ALL + src/cfe-configdata-stubs.c +) \ No newline at end of file diff --git a/unit-test-coverage/ut-stubs/inc/PCS_arch_ppc_esfPpc.h b/unit-test-coverage/ut-stubs/inc/PCS_arch_ppc_esfPpc.h new file mode 100644 index 00000000..dea48cda --- /dev/null +++ b/unit-test-coverage/ut-stubs/inc/PCS_arch_ppc_esfPpc.h @@ -0,0 +1,26 @@ +/* PSP coverage stub replacement for esfPpc.h */ +#ifndef _PSP_STUB_ESFPPC_H_ +#define _PSP_STUB_ESFPPC_H_ + +#include + +/* ----------------------------------------- */ +/* constants normally defined in esfPpc.h */ +/* ----------------------------------------- */ + +/* ----------------------------------------- */ +/* types normally defined in esfPpc.h */ +/* ----------------------------------------- */ + +/* ----------------------------------------- */ +/* prototypes normally declared in esfPpc.h */ +/* ----------------------------------------- */ + +typedef struct +{ + uint32_t pad[32]; +} PCS_ESFPPC; + + +#endif /* _PSP_STUB_ESFPPC_H_ */ + diff --git a/unit-test-coverage/ut-stubs/inc/PCS_arch_ppc_vxPpcLib.h b/unit-test-coverage/ut-stubs/inc/PCS_arch_ppc_vxPpcLib.h new file mode 100644 index 00000000..77ff3095 --- /dev/null +++ b/unit-test-coverage/ut-stubs/inc/PCS_arch_ppc_vxPpcLib.h @@ -0,0 +1,41 @@ +/* PSP coverage stub replacement for vxPpcLib.h */ +#ifndef _PSP_STUB_VXPPCLIB_H_ +#define _PSP_STUB_VXPPCLIB_H_ + +#include + +/* ----------------------------------------- */ +/* constants normally defined in vxPpcLib.h */ +/* ----------------------------------------- */ + +#define PCS_PPC_MSR_EE 0x2101 +#define PCS_PPC_MSR_FP 0x2102 +#define PCS_PPC_MSR_ME 0x2104 +#define PCS_PPC_MSR_FE0 0x2108 +#define PCS_PPC_MSR_FE1 0x2110 +#define PCS_PPC_MSR_DR 0x2120 + +#define PCS_PPC_FPSCR_VE 0x2201 +#define PCS_PPC_FPSCR_OE 0x2202 +#define PCS_PPC_FPSCR_NI 0x2204 +#define PCS_PPC_FPSCR_ZE 0x2208 +#define PCS_PPC_FPSCR_XE 0x2210 +#define PCS_PPC_FPSCR_UE 0x2220 + + +/* ----------------------------------------- */ +/* types normally defined in vxPpcLib.h */ +/* ----------------------------------------- */ + +/* ----------------------------------------- */ +/* prototypes normally declared in vxPpcLib.h */ +/* ----------------------------------------- */ +extern void PCS_vxTimeBaseGet (uint32_t *u, uint32_t *l); +extern void PCS_vxMsrSet (uint32_t); +extern uint32_t PCS_vxMsrGet (void); +extern void PCS_vxFpscrSet (uint32_t); +extern uint32_t PCS_vxFpscrGet (void); +extern uint32_t PCS_vxDecGet (void); + +#endif /* _PSP_STUB_VXPPCLIB_H_ */ + diff --git a/unit-test-coverage/ut-stubs/inc/PCS_basetypes.h b/unit-test-coverage/ut-stubs/inc/PCS_basetypes.h new file mode 100644 index 00000000..3845781e --- /dev/null +++ b/unit-test-coverage/ut-stubs/inc/PCS_basetypes.h @@ -0,0 +1,31 @@ +/* + * 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. + */ + +/* PSP coverage stub basic data types */ +#ifndef _PSP_STUB_BASETYPES_H_ +#define _PSP_STUB_BASETYPES_H_ + +/* + * NOTE: These header files are intentionally _not_ overridden + * in the replacement/override header directory, so this should + * pull in the actual (native system) version of these files. + * + * It is important to pull in these definitions first before any + * potential re-mapping (#define) statements are done. + */ + +#include /* for correct size_t and ptrdiff_t types */ +#include /* for correct fixed-width integer types */ +#include /* for correct INT_MAX, etc. */ +#include /* for correct boolean semantics */ + + +#endif /* _PSP_STUB_BASETYPES_H_ */ + diff --git a/unit-test-coverage/ut-stubs/inc/PCS_blkIo.h b/unit-test-coverage/ut-stubs/inc/PCS_blkIo.h new file mode 100644 index 00000000..04ca49c5 --- /dev/null +++ b/unit-test-coverage/ut-stubs/inc/PCS_blkIo.h @@ -0,0 +1,24 @@ +/* + * 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. + */ + +/* PSP coverage stub basic data types */ +#ifndef _PSP_STUB_BLKIO_H_ +#define _PSP_STUB_BLKIO_H_ + +#include +#include + +/* The module and blk_dev types are used in several headers */ +typedef struct PCS_BLK_DEV { int bd; } PCS_BLK_DEV; +typedef PCS_BLK_DEV* PCS_BLK_DEV_ID; + + +#endif /* _PSP_STUB_BLKIO_H_ */ + diff --git a/unit-test-coverage/ut-stubs/inc/PCS_cacheLib.h b/unit-test-coverage/ut-stubs/inc/PCS_cacheLib.h new file mode 100644 index 00000000..bea12788 --- /dev/null +++ b/unit-test-coverage/ut-stubs/inc/PCS_cacheLib.h @@ -0,0 +1,22 @@ +/* PSP coverage stub replacement for cacheLib.h */ +#ifndef _PSP_STUB_CACHELIB_H_ +#define _PSP_STUB_CACHELIB_H_ + +#include +#include + +/* ----------------------------------------- */ +/* constants normally defined in cacheLib.h */ +/* ----------------------------------------- */ + +/* ----------------------------------------- */ +/* types normally defined in cacheLib.h */ +/* ----------------------------------------- */ + +/* ----------------------------------------- */ +/* prototypes normally declared in cacheLib.h */ +/* ----------------------------------------- */ +extern PCS_STATUS PCS_cacheTextUpdate (void * adrs, size_t bytes); + +#endif /* _PSP_STUB_CACHELIB_H_ */ + diff --git a/unit-test-coverage/ut-stubs/inc/PCS_cfe_configdata.h b/unit-test-coverage/ut-stubs/inc/PCS_cfe_configdata.h new file mode 100644 index 00000000..756485a4 --- /dev/null +++ b/unit-test-coverage/ut-stubs/inc/PCS_cfe_configdata.h @@ -0,0 +1,37 @@ +#ifndef _PSP_STUB_CFE_CONFIGDATA_H_ +#define _PSP_STUB_CFE_CONFIGDATA_H_ + +#include + + +#define PCS_CONFIG_MISSIONVERSION "UT-mission" +#define PCS_CONFIG_CFEVERSION "UT-CFE" +#define PCS_CONFIG_OSALVERSION "UT-OSAL" +#define PCS_CONFIG_CONFIGSTR "UT-config" +#define PCS_CONFIG_DATESTR "UT-date" +#define PCS_CONFIG_USERSTR "UT-user" +#define PCS_CONFIG_CPUNAME "UT-cpuname" +#define PCS_CONFIG_CPUNUMBER 111 +#define PCS_CONFIG_SPACECRAFT 222 + + +/** + * Stub for the main system entry function implemented in CFE ES + */ +void PCS_SystemMain(uint32 StartType, uint32 StartSubtype, uint32 ModeId, const char *StartFilePath); + +/** + * Stub for 1Hz ISR function implemented in CFE TIME + */ +void PCS_System1HzISR(void); + + +/** + * Stub for notification function implemented in CFE ES + */ +void PCS_SystemNotify(void); + + + +#endif /* _PSP_STUB_CFE_CONFIGDATA_H_ */ + diff --git a/unit-test-coverage/ut-stubs/inc/PCS_dosFsLib.h b/unit-test-coverage/ut-stubs/inc/PCS_dosFsLib.h new file mode 100644 index 00000000..fcb366ea --- /dev/null +++ b/unit-test-coverage/ut-stubs/inc/PCS_dosFsLib.h @@ -0,0 +1,29 @@ +/* PSP coverage stub replacement for dosFsLib.h */ +#ifndef _PSP_STUB_DOSFSLIB_H_ +#define _PSP_STUB_DOSFSLIB_H_ + +#include +#include + +/* ----------------------------------------- */ +/* constants normally defined in dosFsLib.h */ +/* ----------------------------------------- */ +#define PCS_DOS_CHK_ONLY 0x00000001 +#define PCS_DOS_CHK_REPAIR 0x00000002 +#define PCS_DOS_CHK_VERB_0 0x0000ff00 /* verbosity level/flags */ +#define PCS_DOS_CHK_VERB_SILENT PCS_DOS_CHK_VERB_0 +#define PCS_DOS_OPT_BLANK 0x0002 /* create a clean boot block */ + +/* ----------------------------------------- */ +/* types normally defined in dosFsLib.h */ +/* ----------------------------------------- */ + +/* ----------------------------------------- */ +/* prototypes normally declared in dosFsLib.h */ +/* ----------------------------------------- */ +extern PCS_STATUS PCS_dosFsVolFormat(char *path, int opt, PCS_FUNCPTR pPromptFunc); + + + +#endif /* _PSP_STUB_DOSFSLIB_H_ */ + diff --git a/unit-test-coverage/ut-stubs/inc/PCS_drv_hdisk_ataDrv.h b/unit-test-coverage/ut-stubs/inc/PCS_drv_hdisk_ataDrv.h new file mode 100644 index 00000000..1b8d68ee --- /dev/null +++ b/unit-test-coverage/ut-stubs/inc/PCS_drv_hdisk_ataDrv.h @@ -0,0 +1,26 @@ +/* PSP coverage stub replacement for drv/hdisk/ataDrv.h */ +#ifndef _PSP_STUB_DRV_HDISK_ATADRV_H_ +#define _PSP_STUB_DRV_HDISK_ATADRV_H_ + +#include +#include +#include +#include + +/* ----------------------------------------- */ +/* constants normally defined in drv/hdisk/ataDrv.h */ +/* ----------------------------------------- */ + +/* ----------------------------------------- */ +/* types normally defined in drv/hdisk/ataDrv.h */ +/* ----------------------------------------- */ + +/* ----------------------------------------- */ +/* prototypes normally declared in drv/hdisk/ataDrv.h */ +/* ----------------------------------------- */ +extern PCS_device_t PCS_ataXbdDevCreate (int ctrl, int drive, unsigned int nBlks, unsigned int offset, const char *); + + + +#endif /* _PSP_STUB_DRV_HDISK_ATADRV_H_ */ + diff --git a/unit-test-coverage/ut-stubs/inc/PCS_errnoLib.h b/unit-test-coverage/ut-stubs/inc/PCS_errnoLib.h new file mode 100644 index 00000000..6ee7338d --- /dev/null +++ b/unit-test-coverage/ut-stubs/inc/PCS_errnoLib.h @@ -0,0 +1,24 @@ +/* PSP coverage stub replacement for errnoLib.h */ +#ifndef _PSP_STUB_ERRNOLIB_H_ +#define _PSP_STUB_ERRNOLIB_H_ + +#include +#include + +/* ----------------------------------------- */ +/* constants normally defined in errnoLib.h */ +/* ----------------------------------------- */ + +/* ----------------------------------------- */ +/* types normally defined in errnoLib.h */ +/* ----------------------------------------- */ + +/* ----------------------------------------- */ +/* prototypes normally declared in errnoLib.h */ +/* ----------------------------------------- */ + +extern int PCS_errnoGet (void); + + +#endif /* _PSP_STUB_ERRNOLIB_H_ */ + diff --git a/unit-test-coverage/ut-stubs/inc/PCS_excLib.h b/unit-test-coverage/ut-stubs/inc/PCS_excLib.h new file mode 100644 index 00000000..564b1f3a --- /dev/null +++ b/unit-test-coverage/ut-stubs/inc/PCS_excLib.h @@ -0,0 +1,24 @@ +/* PSP coverage stub replacement for excLib.h */ +#ifndef _PSP_STUB_EXCLIB_H_ +#define _PSP_STUB_EXCLIB_H_ + +#include +#include + +/* ----------------------------------------- */ +/* constants normally defined in excLib.h */ +/* ----------------------------------------- */ + +/* ----------------------------------------- */ +/* types normally defined in excLib.h */ +/* ----------------------------------------- */ + +/* ----------------------------------------- */ +/* prototypes normally declared in excLib.h */ +/* ----------------------------------------- */ + +extern void PCS_excHookAdd (void (*Hook)(PCS_TASK_ID, int, void *)); + + +#endif /* _PSP_STUB_EXCLIB_H_ */ + diff --git a/unit-test-coverage/ut-stubs/inc/PCS_fppLib.h b/unit-test-coverage/ut-stubs/inc/PCS_fppLib.h new file mode 100644 index 00000000..678e7e36 --- /dev/null +++ b/unit-test-coverage/ut-stubs/inc/PCS_fppLib.h @@ -0,0 +1,26 @@ +/* PSP coverage stub replacement for fppLib.h */ +#ifndef _PSP_STUB_FPPLIB_H_ +#define _PSP_STUB_FPPLIB_H_ + +#include + +/* ----------------------------------------- */ +/* constants normally defined in fppLib.h */ +/* ----------------------------------------- */ + +/* ----------------------------------------- */ +/* types normally defined in fppLib.h */ +/* ----------------------------------------- */ + +typedef struct +{ + unsigned long context[4]; +} PCS_FP_CONTEXT; + +/* ----------------------------------------- */ +/* prototypes normally declared in fppLib.h */ +/* ----------------------------------------- */ +extern void PCS_fppSave (PCS_FP_CONTEXT *fpc); + +#endif /* _PSP_STUB_FPPLIB_H_ */ + diff --git a/unit-test-coverage/ut-stubs/inc/PCS_mcpx750.h b/unit-test-coverage/ut-stubs/inc/PCS_mcpx750.h new file mode 100644 index 00000000..c768a432 --- /dev/null +++ b/unit-test-coverage/ut-stubs/inc/PCS_mcpx750.h @@ -0,0 +1,29 @@ +/* PSP coverage stub replacement for mcpx750.h */ +#ifndef _PSP_STUB_MCPX750_H_ +#define _PSP_STUB_MCPX750_H_ + +#include + +/* ----------------------------------------- */ +/* constants normally defined in mcpx750.h */ +/* ----------------------------------------- */ +#define PCS_SYS_REG_BLRR_PWRON 0x01 +#define PCS_SYS_REG_BLRR_PBRST 0x02 +#define PCS_SYS_REG_BLRR_FBTN 0x04 +#define PCS_SYS_REG_BLRR_WDT2 0x08 +#define PCS_SYS_REG_BLRR_SWSRST 0x10 +#define PCS_SYS_REG_BLRR_SWHRST 0x20 + +extern uint32_t *PCS_SYS_REG_BLRR; + +/* ----------------------------------------- */ +/* types normally defined in mcpx750.h */ +/* ----------------------------------------- */ + +/* ----------------------------------------- */ +/* prototypes normally declared in mcpx750.h */ +/* ----------------------------------------- */ + + +#endif /* _PSP_STUB_MCPX750_H_ */ + diff --git a/unit-test-coverage/ut-stubs/inc/PCS_moduleLib.h b/unit-test-coverage/ut-stubs/inc/PCS_moduleLib.h new file mode 100644 index 00000000..bee1fce6 --- /dev/null +++ b/unit-test-coverage/ut-stubs/inc/PCS_moduleLib.h @@ -0,0 +1,41 @@ +/* PSP coverage stub replacement for moduleLib.h */ +#ifndef _PSP_STUB_MODULELIB_H_ +#define _PSP_STUB_MODULELIB_H_ + +#include +#include + +/* ----------------------------------------- */ +/* constants normally defined in moduleLib.h */ +/* ----------------------------------------- */ + +/* ----------------------------------------- */ +/* types normally defined in moduleLib.h */ +/* ----------------------------------------- */ +typedef struct PCS_MODULE { int m; } PCS_MODULE; +typedef PCS_MODULE* PCS_MODULE_ID; + +typedef struct PCS_MODULE_INFO +{ + struct + { + unsigned long textAddr; + unsigned long textSize; + unsigned long dataAddr; + unsigned long dataSize; + unsigned long bssAddr; + unsigned long bssSize; + } segInfo; + +} PCS_MODULE_INFO; + +/* ----------------------------------------- */ +/* prototypes normally declared in moduleLib.h */ +/* ----------------------------------------- */ + +extern PCS_STATUS PCS_moduleInfoGet(PCS_MODULE_ID moduleId, PCS_MODULE_INFO * pModuleInfo); +extern PCS_MODULE_ID PCS_moduleFindByName (const char *moduleName); + + +#endif /* _PSP_STUB_MODULELIB_H_ */ + diff --git a/unit-test-coverage/ut-stubs/inc/PCS_ramDrv.h b/unit-test-coverage/ut-stubs/inc/PCS_ramDrv.h new file mode 100644 index 00000000..c0dac8d9 --- /dev/null +++ b/unit-test-coverage/ut-stubs/inc/PCS_ramDrv.h @@ -0,0 +1,27 @@ +/* PSP coverage stub replacement for ramDrv.h */ +#ifndef _PSP_STUB_RAMDRV_H_ +#define _PSP_STUB_RAMDRV_H_ + +#include +#include +#include + +/* ----------------------------------------- */ +/* constants normally defined in ramDrv.h */ +/* ----------------------------------------- */ + +/* ----------------------------------------- */ +/* types normally defined in ramDrv.h */ +/* ----------------------------------------- */ + +/* ----------------------------------------- */ +/* prototypes normally declared in ramDrv.h */ +/* ----------------------------------------- */ +extern PCS_BLK_DEV *PCS_ramDevCreate (char *ramAddr, int bytesPerSec, int secPerTrack, + int nSectors, int secOffset); + + + + +#endif /* _PSP_STUB_RAMDRV_H_ */ + diff --git a/unit-test-coverage/ut-stubs/inc/PCS_rebootLib.h b/unit-test-coverage/ut-stubs/inc/PCS_rebootLib.h new file mode 100644 index 00000000..2f75f0f9 --- /dev/null +++ b/unit-test-coverage/ut-stubs/inc/PCS_rebootLib.h @@ -0,0 +1,24 @@ +/* PSP coverage stub replacement for rebootLib.h */ +#ifndef _PSP_STUB_REBOOTLIB_H_ +#define _PSP_STUB_REBOOTLIB_H_ + +#include + +/* ----------------------------------------- */ +/* constants normally defined in rebootLib.h */ +/* ----------------------------------------- */ +#define PCS_BOOT_CLEAR 0x2401 +#define PCS_BOOT_NORMAL 0x2402 + +/* ----------------------------------------- */ +/* types normally defined in rebootLib.h */ +/* ----------------------------------------- */ + +/* ----------------------------------------- */ +/* prototypes normally declared in rebootLib.h */ +/* ----------------------------------------- */ +extern void PCS_reboot(int); + + +#endif /* _PSP_STUB_REBOOTLIB_H_ */ + diff --git a/unit-test-coverage/ut-stubs/inc/PCS_stdarg.h b/unit-test-coverage/ut-stubs/inc/PCS_stdarg.h new file mode 100644 index 00000000..fc668bfc --- /dev/null +++ b/unit-test-coverage/ut-stubs/inc/PCS_stdarg.h @@ -0,0 +1,28 @@ +/* PSP coverage stub replacement for stdarg.h */ +#ifndef _PSP_STUB_STDARG_H_ +#define _PSP_STUB_STDARG_H_ + +#include + +/* ----------------------------------------- */ +/* constants normally defined in stdarg.h */ +/* ----------------------------------------- */ + +/* ----------------------------------------- */ +/* types normally defined in stdarg.h */ +/* ----------------------------------------- */ +typedef struct { void *p; } PCS_va_list; + + + +/* ----------------------------------------- */ +/* prototypes normally declared in stdarg.h */ +/* ----------------------------------------- */ + +#define PCS_va_start(ap, last) ap.p = &last +#define PCS_va_end(ap) + + + +#endif /* _PSP_STUB_STDARG_H_ */ + diff --git a/unit-test-coverage/ut-stubs/inc/PCS_stdio.h b/unit-test-coverage/ut-stubs/inc/PCS_stdio.h new file mode 100644 index 00000000..2cb93c8a --- /dev/null +++ b/unit-test-coverage/ut-stubs/inc/PCS_stdio.h @@ -0,0 +1,39 @@ +/* PSP coverage stub replacement for stdio.h */ +#ifndef _PSP_STUB_STDIO_H_ +#define _PSP_STUB_STDIO_H_ + +#include +#include + +/* ----------------------------------------- */ +/* constants normally defined in stdio.h */ +/* ----------------------------------------- */ + +/* ----------------------------------------- */ +/* types normally defined in stdio.h */ +/* ----------------------------------------- */ +typedef struct PCS_FILE PCS_FILE; + + +/* ----------------------------------------- */ +/* prototypes normally declared in stdio.h */ +/* ----------------------------------------- */ + +extern int PCS_fclose (PCS_FILE * stream); +extern char *PCS_fgets (char * s, int n, PCS_FILE * stream); +extern PCS_FILE *PCS_fopen (const char * filename, const char * modes); +extern int PCS_fputs (const char * s, PCS_FILE * stream); +extern int PCS_remove (const char * filename); +extern int PCS_rename (const char * old, const char * nw); +extern int PCS_snprintf (char * s, size_t maxlen, const char * format, ...); +extern int PCS_vsnprintf (char * s, size_t maxlen, const char * format, PCS_va_list arg); +extern int PCS_printf (const char * format, ...); +extern int PCS_putchar (int c); + +extern PCS_FILE* PCS_stdin; +extern PCS_FILE* PCS_stdout; +extern PCS_FILE* PCS_stderr; + + +#endif /* _PSP_STUB_STDIO_H_ */ + diff --git a/unit-test-coverage/ut-stubs/inc/PCS_stdlib.h b/unit-test-coverage/ut-stubs/inc/PCS_stdlib.h new file mode 100644 index 00000000..42ba094d --- /dev/null +++ b/unit-test-coverage/ut-stubs/inc/PCS_stdlib.h @@ -0,0 +1,31 @@ +/* PSP coverage stub replacement for stdlib.h */ +#ifndef _PSP_STUB_STDLIB_H_ +#define _PSP_STUB_STDLIB_H_ + +#include + +/* ----------------------------------------- */ +/* constants normally defined in stdlib.h */ +/* ----------------------------------------- */ + +#define PCS_EXIT_SUCCESS 0x0100 +#define PCS_EXIT_FAILURE 0x0101 + + +/* ----------------------------------------- */ +/* types normally defined in stdlib.h */ +/* ----------------------------------------- */ + +/* ----------------------------------------- */ +/* prototypes normally declared in stdlib.h */ +/* ----------------------------------------- */ + +extern void PCS_exit (int status); +extern unsigned long int PCS_strtoul (const char * nptr, char ** endptr, int base); +extern int PCS_system (const char * command); +extern void *PCS_malloc(size_t sz); +extern void PCS_free(void *ptr); + + +#endif /* _PSP_STUB_STDLIB_H_ */ + diff --git a/unit-test-coverage/ut-stubs/inc/PCS_string.h b/unit-test-coverage/ut-stubs/inc/PCS_string.h new file mode 100644 index 00000000..b7aceaa4 --- /dev/null +++ b/unit-test-coverage/ut-stubs/inc/PCS_string.h @@ -0,0 +1,33 @@ +/* PSP coverage stub replacement for string.h */ +#ifndef _PSP_STUB_STRING_H_ +#define _PSP_STUB_STRING_H_ + +#include + +/* ----------------------------------------- */ +/* constants normally defined in string.h */ +/* ----------------------------------------- */ + +/* ----------------------------------------- */ +/* types normally defined in string.h */ +/* ----------------------------------------- */ + +/* ----------------------------------------- */ +/* prototypes normally declared in string.h */ +/* ----------------------------------------- */ + +extern void *PCS_memcpy (void * dest, const void * src, size_t n); +extern void *PCS_memset (void * s, int c, size_t n); +extern int PCS_strcmp (const char * s1, const char * s2); +extern char *PCS_strcpy (char * dest, const char * src); +extern size_t PCS_strlen (const char * s); +extern int PCS_strncmp (const char * s1, const char * s2, size_t n); +extern char *PCS_strncpy (char * dest, const char * src, size_t n); +extern char *PCS_strchr(const char *s, int c); +extern char *PCS_strrchr (const char * s, int c); +extern char *PCS_strcat(char *dest, const char *src); +extern char *PCS_strncat(char *dest, const char *src, size_t n); +extern char *PCS_strerror(int errnum); + +#endif /* _PSP_STUB_STRING_H_ */ + diff --git a/unit-test-coverage/ut-stubs/inc/PCS_sysLib.h b/unit-test-coverage/ut-stubs/inc/PCS_sysLib.h new file mode 100644 index 00000000..ef5b2389 --- /dev/null +++ b/unit-test-coverage/ut-stubs/inc/PCS_sysLib.h @@ -0,0 +1,33 @@ +/* PSP coverage stub replacement for sysLib.h */ +#ifndef _PSP_STUB_SYSLIB_H_ +#define _PSP_STUB_SYSLIB_H_ + +#include +#include + +/* ----------------------------------------- */ +/* constants normally defined in sysLib.h */ +/* ----------------------------------------- */ + +/* ----------------------------------------- */ +/* types normally defined in sysLib.h */ +/* ----------------------------------------- */ + +/* ----------------------------------------- */ +/* prototypes normally declared in sysLib.h */ +/* ----------------------------------------- */ +extern int PCS_sysClkRateGet(void); +extern char *PCS_sysMemTop (void); + +extern void PCS_PciOutByte (uint32_t address, uint8_t data); +extern void PCS_PciOutLong (uint32_t address, uint32_t data); +extern void PCS_sysPciWrite32 (uint32_t address, uint32_t data); +extern void PCS_sysPciRead32 (uint32_t address, uint32_t *data); + + +extern unsigned int PCS_GetWrsKernelTextStart(void); +extern unsigned int PCS_GetWrsKernelTextEnd (void); + + +#endif /* _PSP_STUB_SYSLIB_H_ */ + diff --git a/unit-test-coverage/ut-stubs/inc/PCS_sys_types.h b/unit-test-coverage/ut-stubs/inc/PCS_sys_types.h new file mode 100644 index 00000000..3fbbf80c --- /dev/null +++ b/unit-test-coverage/ut-stubs/inc/PCS_sys_types.h @@ -0,0 +1,29 @@ +/* PSP coverage stub replacement for sys/types.h */ +#ifndef _PSP_STUB_SYS_TYPES_H_ +#define _PSP_STUB_SYS_TYPES_H_ + +#include + +/* ----------------------------------------- */ +/* constants normally defined in sys/types.h */ +/* ----------------------------------------- */ + +/* ----------------------------------------- */ +/* types normally defined in sys/types.h */ +/* ----------------------------------------- */ +typedef ptrdiff_t PCS_ssize_t; +typedef size_t PCS_off_t; +typedef unsigned int PCS_mode_t; +typedef long PCS_time_t; +typedef int PCS_pid_t; +typedef int PCS_gid_t; +typedef int PCS_uid_t; + +/* ----------------------------------------- */ +/* prototypes normally declared in sys/types.h */ +/* ----------------------------------------- */ + + + +#endif /* _PSP_STUB_SYS_TYPES_H_ */ + diff --git a/unit-test-coverage/ut-stubs/inc/PCS_taskLib.h b/unit-test-coverage/ut-stubs/inc/PCS_taskLib.h new file mode 100644 index 00000000..9042afed --- /dev/null +++ b/unit-test-coverage/ut-stubs/inc/PCS_taskLib.h @@ -0,0 +1,95 @@ +/* PSP coverage stub replacement for taskLib.h */ +#ifndef _PSP_STUB_TASKLIB_H_ +#define _PSP_STUB_TASKLIB_H_ + +#include +#include + +/* ----------------------------------------- */ +/* constants normally defined in taskLib.h */ +/* ----------------------------------------- */ +#define PCS_VX_FP_TASK 0x1b01 /* execute with floating-point coprocessor support. */ + + +/* ----------------------------------------- */ +/* types normally defined in taskLib.h */ +/* ----------------------------------------- */ +typedef struct PCS_WIND_TCB +{ + int data; +} PCS_WIND_TCB; + +typedef struct PCS_WIND_TCB* PCS_TASK_ID; + +typedef struct PCS_TASK_DESC +{ + PCS_TASK_ID tid; +} PCS_TASK_DESC; + + +/* ----------------------------------------- */ +/* prototypes normally declared in taskInfo.h */ +/* ----------------------------------------- */ + +extern const char *PCS_taskName(PCS_TASK_ID task_id); +extern PCS_TASK_ID PCS_taskNameToId(const char *name); +extern PCS_TASK_ID PCS_taskIdDefault(PCS_TASK_ID task_id); +extern PCS_BOOL PCS_taskIsReady(PCS_TASK_ID task_id); +extern PCS_BOOL PCS_taskIsSuspended (PCS_TASK_ID task_id); +extern PCS_STATUS PCS_taskGetInfo(PCS_TASK_ID task_id, PCS_TASK_DESC *desc); + + + +/* ----------------------------------------- */ +/* prototypes normally declared in taskLib.h */ +/* ----------------------------------------- */ + +extern PCS_STATUS PCS_taskActivate(PCS_TASK_ID tid); +extern void PCS_taskExit(int code); +extern PCS_TASK_ID PCS_taskIdSelf(void); +extern PCS_STATUS PCS_taskDelay(int ticks); +extern PCS_STATUS PCS_taskDelete(PCS_TASK_ID tid); +extern PCS_STATUS PCS_taskDeleteForce(PCS_TASK_ID tid); +extern PCS_STATUS PCS_taskSuspend(PCS_TASK_ID tid); +extern PCS_STATUS PCS_taskResume(PCS_TASK_ID tid); +extern PCS_STATUS PCS_taskPrioritySet(PCS_TASK_ID tid, int newPriority); +extern PCS_TASK_ID PCS_taskSpawn(char * name, + int priority, + int options, + int stackSize, + PCS_FUNCPTR entryPt, + int arg1, + int arg2, + int arg3, + int arg4, + int arg5, + int arg6, + int arg7, + int arg8, + int arg9, + int arg10); + +PCS_STATUS PCS_taskInit(PCS_WIND_TCB *pTcb, + char *name, + int priority, + int options, + char * pStackBase, + int stackSize, + PCS_FUNCPTR entryPt, + int arg1, + int arg2, + int arg3, + int arg4, + int arg5, + int arg6, + int arg7, + int arg8, + int arg9, + int arg10 +); + +PCS_WIND_TCB *PCS_taskTcb(PCS_TASK_ID tid); + + +#endif /* _PSP_STUB_TASKLIB_H_ */ + diff --git a/unit-test-coverage/ut-stubs/inc/PCS_unistd.h b/unit-test-coverage/ut-stubs/inc/PCS_unistd.h new file mode 100644 index 00000000..e2c91f4b --- /dev/null +++ b/unit-test-coverage/ut-stubs/inc/PCS_unistd.h @@ -0,0 +1,42 @@ +/* PSP coverage stub replacement for unistd.h */ +#ifndef _PSP_STUB_UNISTD_H_ +#define _PSP_STUB_UNISTD_H_ + +#include +#include + +/* ----------------------------------------- */ +/* constants normally defined in unistd.h */ +/* ----------------------------------------- */ + +#define PCS_SEEK_SET 0x1C01 +#define PCS_SEEK_CUR 0x1C02 +#define PCS_SEEK_END 0x1C03 +#define PCS_STDIN_FILENO 0x1C04 +#define PCS_STDOUT_FILENO 0x1C05 +#define PCS_STDERR_FILENO 0x1C06 + + +/* ----------------------------------------- */ +/* types normally defined in unistd.h */ +/* ----------------------------------------- */ + +/* ----------------------------------------- */ +/* prototypes normally declared in unistd.h */ +/* ----------------------------------------- */ + +extern int PCS_close (int fd); +extern PCS_gid_t PCS_getegid (void); +extern PCS_uid_t PCS_geteuid (void); +extern long int PCS_gethostid (void); +extern int PCS_gethostname (char * name, size_t len); +extern PCS_pid_t PCS_getpid (void); +extern PCS_off_t PCS_lseek (int fd, PCS_off_t offset, int whence); +extern PCS_ssize_t PCS_read (int fd, void * buf, size_t nbytes); +extern int PCS_rmdir (const char * path); +extern long int PCS_sysconf (int name); +extern PCS_ssize_t PCS_write (int fd, const void * buf, size_t n); + + +#endif /* _PSP_STUB_UNISTD_H_ */ + diff --git a/unit-test-coverage/ut-stubs/inc/PCS_usrLib.h b/unit-test-coverage/ut-stubs/inc/PCS_usrLib.h new file mode 100644 index 00000000..a14ebb73 --- /dev/null +++ b/unit-test-coverage/ut-stubs/inc/PCS_usrLib.h @@ -0,0 +1,23 @@ +/* PSP coverage stub replacement for usrLib.h */ +#ifndef _PSP_STUB_USRLIB_H_ +#define _PSP_STUB_USRLIB_H_ + +#include +#include + +/* ----------------------------------------- */ +/* constants normally defined in usrLib.h */ +/* ----------------------------------------- */ + +/* ----------------------------------------- */ +/* types normally defined in usrLib.h */ +/* ----------------------------------------- */ + +/* ----------------------------------------- */ +/* prototypes normally declared in usrLib.h */ +/* ----------------------------------------- */ + + + +#endif /* _PSP_STUB_USRLIB_H_ */ + diff --git a/unit-test-coverage/ut-stubs/inc/PCS_vxLib.h b/unit-test-coverage/ut-stubs/inc/PCS_vxLib.h new file mode 100644 index 00000000..5501d93b --- /dev/null +++ b/unit-test-coverage/ut-stubs/inc/PCS_vxLib.h @@ -0,0 +1,22 @@ +/* PSP coverage stub replacement for vxLib.h */ +#ifndef _PSP_STUB_VXLIB_H_ +#define _PSP_STUB_VXLIB_H_ + +#include + +/* ----------------------------------------- */ +/* constants normally defined in vxLib.h */ +/* ----------------------------------------- */ + +/* ----------------------------------------- */ +/* types normally defined in vxLib.h */ +/* ----------------------------------------- */ + +/* ----------------------------------------- */ +/* prototypes normally declared in vxLib.h */ +/* ----------------------------------------- */ + + + +#endif /* _PSP_STUB_VXLIB_H_ */ + diff --git a/unit-test-coverage/ut-stubs/inc/PCS_vxWorks.h b/unit-test-coverage/ut-stubs/inc/PCS_vxWorks.h new file mode 100644 index 00000000..bf422816 --- /dev/null +++ b/unit-test-coverage/ut-stubs/inc/PCS_vxWorks.h @@ -0,0 +1,77 @@ +/* + * + * 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 PCS_vxWorks.h + * \ingroup ut-stubs + * \author joseph.p.hickey@nasa.gov + * PSP coverage stub replacement for vxWorks.h + */ + +#ifndef INCLUDE_OCS_VXWORKS_H_ +#define INCLUDE_OCS_VXWORKS_H_ + +#include + +/* ----------------------------------------- */ +/* constants normally defined in vxWorks.h */ +/* ----------------------------------------- */ +enum +{ + PCS_ERROR = -1, + PCS_OK = 0 +}; + +enum +{ + PCS_WAIT_FOREVER = -1, + PCS_NO_WAIT = 0 +}; + + + +/* ----------------------------------------- */ +/* types normally defined in vxWorks.h */ +/* ----------------------------------------- */ +typedef int PCS_STATUS; +typedef bool PCS_BOOL; +typedef unsigned int PCS_UINT; +typedef int8_t PCS_INT8; +typedef uint8_t PCS_UINT8; +typedef int16_t PCS_INT16; +typedef uint16_t PCS_UINT16; +typedef int32_t PCS_INT32; +typedef uint32_t PCS_UINT32; + +typedef long PCS_Vx_usr_arg_t; + +/* Function pointers are used in many VxWorks modules. */ +/* + * NOTE: The FUNCPTR type in the actual library may be defined + * without arguments, e.g. "int (*FUNCPTR)()". This is acceptable + * by some compilers but generally incompatible with the + * "-Wstrict-prototype" gcc warning option. So in this override it + * is defined as a int argument. This means that application code + * may need to cast it at the time of use (which is generally done anyway). + */ +typedef int (*PCS_FUNCPTR)(int); +typedef void (*PCS_VOIDFUNCPTR)(void); + + +/* ----------------------------------------- */ +/* prototypes normally declared in vxWorks.h */ +/* ----------------------------------------- */ + + +#endif /* INCLUDE_OCS_VXWORKS_H_ */ + diff --git a/unit-test-coverage/ut-stubs/inc/PCS_xbdBlkDev.h b/unit-test-coverage/ut-stubs/inc/PCS_xbdBlkDev.h new file mode 100644 index 00000000..47cebe76 --- /dev/null +++ b/unit-test-coverage/ut-stubs/inc/PCS_xbdBlkDev.h @@ -0,0 +1,28 @@ +/* PSP coverage stub replacement for xbdBlkDev.h */ +#ifndef _PSP_STUB_XBDBLKDEV_H_ +#define _PSP_STUB_XBDBLKDEV_H_ + +#include +#include +#include + +/* ----------------------------------------- */ +/* constants normally defined in xbdBlkDev.h */ +/* ----------------------------------------- */ +#define PCS_NULLDEV ((PCS_device_t)0) + +/* ----------------------------------------- */ +/* types normally defined in xbdBlkDev.h */ +/* ----------------------------------------- */ +typedef int PCS_device_t; + +/* ----------------------------------------- */ +/* prototypes normally declared in xbdBlkDev.h */ +/* ----------------------------------------- */ +extern PCS_device_t PCS_xbdBlkDevCreateSync (PCS_BLK_DEV *bd, const char *name); +extern PCS_STATUS PCS_xbdBlkDevDelete (PCS_device_t dev, PCS_BLK_DEV **ppbd); + + + +#endif /* _PSP_STUB_XBDBLKDEV_H_ */ + diff --git a/unit-test-coverage/ut-stubs/inc/PCS_xbdRamDisk.h b/unit-test-coverage/ut-stubs/inc/PCS_xbdRamDisk.h new file mode 100644 index 00000000..cd586db0 --- /dev/null +++ b/unit-test-coverage/ut-stubs/inc/PCS_xbdRamDisk.h @@ -0,0 +1,23 @@ +/* PSP coverage stub replacement for xbdRamDisk.h */ +#ifndef _PSP_STUB_XBDRAMDISK_H_ +#define _PSP_STUB_XBDRAMDISK_H_ + +#include +#include + +/* ----------------------------------------- */ +/* constants normally defined in xbdRamDisk.h */ +/* ----------------------------------------- */ + +/* ----------------------------------------- */ +/* types normally defined in xbdRamDisk.h */ +/* ----------------------------------------- */ + +/* ----------------------------------------- */ +/* prototypes normally declared in xbdRamDisk.h */ +/* ----------------------------------------- */ + + + +#endif /* _PSP_STUB_XBDRAMDISK_H_ */ + diff --git a/unit-test-coverage/ut-stubs/inc/README.md b/unit-test-coverage/ut-stubs/inc/README.md new file mode 100644 index 00000000..720a7bff --- /dev/null +++ b/unit-test-coverage/ut-stubs/inc/README.md @@ -0,0 +1,63 @@ +ABOUT THE SYSTEM HEADER OVERRIDES +================================= + +The "overrides" directory contain replacement versions of many system-provided +header files. All replacement functions and types are identified using an +`OCS_` prefix. + +The header file that a particular source will use depends on the +way that the compiler include path is set up. This is intentional. + +1. For test support code: + +This refers to all code _other_ than the unit actually being tested, including +stub function implementations and test configuration. + +All coverage test recipes should include `ut-stubs/inc` in the INCLUDE_DIRECTORIES. +These prototypes can be explicitly obtained by putting an `overrides/` prefix +on the #include statement, for instance: + + #include <-- Gets the regular system version as usual + #include <-- Gets this replacement OCS version + +Note that the two shouldn't conflict, so it is possible to include both where needed. + +2. For code units under test: + +When compiling the actual unit under test with coverage instrumentation, +the CMake recipe should add "ut-stubs/inc/overrides" into the INCLUDE_DIRECTORIES. +This way, all source files compiled will find these replacements instead of +the regular system header file. So a statement like: + + #include <-- Gets this replacement OCS version + +This way it is possible to simply recompile the original source files and all the +included system headers will be transparently replaced with these override versions. + +When using the file in this way, one must also provide a companion macro to +divert the actual usage to the OCS namespace as well. For instance: + + #define fputs OCS_fputs + +Will cause all references to `fputs` in the subsequent code to refer to `OCS_fputs` +instead. + +Important Notes +--------------- + +Some notable exclusions exist to this general pattern. These are cases where +attempting to provide a reasonable alternate for the system header file would +be very difficult to do in a portable manner, so we must allow the system +header to be used. These cases are: + + stdint.h : Fixed-width types need to be correct for the host CPU. + limits.h : The MIN/MAX macros need to be correct + stddef.h : Macros like offsetof() and size_t/ptrdiff_t must be correct for the CPU + stdbool.h : Preserves correct boolean semantics + + +Note that header files from all supported platforms (VxWorks, Rtems, Posix) may +all be placed here. Since the files are empty placeholders, they simply need to +exist, and there is no need to duplicate this entire tree for every OS since they +will overlap considerably. + \ No newline at end of file diff --git a/unit-test-coverage/ut-stubs/override_inc/arch/ppc/esfPpc.h b/unit-test-coverage/ut-stubs/override_inc/arch/ppc/esfPpc.h new file mode 100644 index 00000000..9424fa62 --- /dev/null +++ b/unit-test-coverage/ut-stubs/override_inc/arch/ppc/esfPpc.h @@ -0,0 +1,23 @@ +/* + * 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. + */ + +/* PSP coverage stub replacement for fenv.h */ +#ifndef _PSP_OVERRIDE_ESFPPC_H_ +#define _PSP_OVERRIDE_ESFPPC_H_ + +#include + +/* ----------------------------------------- */ +/* mappings for declarations in fenv.h */ +/* ----------------------------------------- */ +#define ESFPPC PCS_ESFPPC + + +#endif /* _PSP_OVERRIDE_ESFPPC_H_ */ diff --git a/unit-test-coverage/ut-stubs/override_inc/arch/ppc/vxPpcLib.h b/unit-test-coverage/ut-stubs/override_inc/arch/ppc/vxPpcLib.h new file mode 100644 index 00000000..4a443f6c --- /dev/null +++ b/unit-test-coverage/ut-stubs/override_inc/arch/ppc/vxPpcLib.h @@ -0,0 +1,43 @@ +/* + * 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. + */ + +/* PSP coverage stub replacement for vxPpcLib.h */ +#ifndef _PSP_OVERRIDE_VXPPCLIB_H_ +#define _PSP_OVERRIDE_VXPPCLIB_H_ + +#include + +/* ----------------------------------------- */ +/* mappings for declarations in vxPpcLib.h */ +/* ----------------------------------------- */ +#define _PPC_MSR_EE PCS_PPC_MSR_EE +#define _PPC_MSR_FP PCS_PPC_MSR_FP +#define _PPC_MSR_ME PCS_PPC_MSR_ME +#define _PPC_MSR_FE0 PCS_PPC_MSR_FE0 +#define _PPC_MSR_FE1 PCS_PPC_MSR_FE1 +#define _PPC_MSR_DR PCS_PPC_MSR_DR + +#define _PPC_FPSCR_VE PCS_PPC_FPSCR_VE +#define _PPC_FPSCR_OE PCS_PPC_FPSCR_OE +#define _PPC_FPSCR_NI PCS_PPC_FPSCR_NI +#define _PPC_FPSCR_ZE PCS_PPC_FPSCR_ZE +#define _PPC_FPSCR_XE PCS_PPC_FPSCR_XE +#define _PPC_FPSCR_UE PCS_PPC_FPSCR_UE + + +#define vxTimeBaseGet PCS_vxTimeBaseGet + +#define vxMsrSet PCS_vxMsrSet +#define vxMsrGet PCS_vxMsrGet +#define vxFpscrSet PCS_vxFpscrSet +#define vxFpscrGet PCS_vxFpscrGet +#define vxDecGet PCS_vxDecGet + +#endif /* _PSP_OVERRIDE_VXPPCLIB_H_ */ diff --git a/unit-test-coverage/ut-stubs/override_inc/blkIo.h b/unit-test-coverage/ut-stubs/override_inc/blkIo.h new file mode 100644 index 00000000..2e615e6d --- /dev/null +++ b/unit-test-coverage/ut-stubs/override_inc/blkIo.h @@ -0,0 +1,26 @@ +/* + * 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. + */ + +/* PSP coverage stub replacement for blkIo.h */ +#ifndef _PSP_OVERRIDE_BLKIO_H_ +#define _PSP_OVERRIDE_BLKIO_H_ + +#include +#include + +/* ---------------------------------------*/ +/* mappings for declarations in blkIo.h */ +/* ---------------------------------------*/ +#define NULLDEV PCS_NULLDEV +#define BLK_DEV PCS_BLK_DEV +#define BLK_DEV_ID PCS_BLK_DEV_ID + + +#endif /* _PSP_OVERRIDE_BLKIO_H_ */ diff --git a/unit-test-coverage/ut-stubs/override_inc/cacheLib.h b/unit-test-coverage/ut-stubs/override_inc/cacheLib.h new file mode 100644 index 00000000..865e5ddc --- /dev/null +++ b/unit-test-coverage/ut-stubs/override_inc/cacheLib.h @@ -0,0 +1,23 @@ +/* + * 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. + */ + +/* PSP coverage stub replacement for cacheLib.h */ +#ifndef _PSP_OVERRIDE_CACHELIB_H_ +#define _PSP_OVERRIDE_CACHELIB_H_ + +#include + +/* ----------------------------------------- */ +/* mappings for declarations in cacheLib.h */ +/* ----------------------------------------- */ +#define cacheTextUpdate PCS_cacheTextUpdate + + +#endif /* _PSP_OVERRIDE_CACHELIB_H_ */ diff --git a/unit-test-coverage/ut-stubs/override_inc/dosFsLib.h b/unit-test-coverage/ut-stubs/override_inc/dosFsLib.h new file mode 100644 index 00000000..673b66f2 --- /dev/null +++ b/unit-test-coverage/ut-stubs/override_inc/dosFsLib.h @@ -0,0 +1,31 @@ +/* + * 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. + */ + +/* PSP coverage stub replacement for dosFsLib.h */ +#ifndef _PSP_OVERRIDE_DOSFSLIB_H_ +#define _PSP_OVERRIDE_DOSFSLIB_H_ + +#include +#include + +/* ----------------------------------------- */ +/* mappings for declarations in dosFsLib.h */ +/* ----------------------------------------- */ +#define DOS_CHK_ONLY PCS_DOS_CHK_ONLY +#define DOS_CHK_REPAIR PCS_DOS_CHK_REPAIR +#define DOS_CHK_VERB_0 PCS_DOS_CHK_VERB_0 +#define DOS_CHK_VERB_SILENT PCS_DOS_CHK_VERB_SILENT +#define DOS_OPT_BLANK PCS_DOS_OPT_BLANK + +#define dosFsVolFormat PCS_dosFsVolFormat + + + +#endif /* _PSP_OVERRIDE_DOSFSLIB_H_ */ diff --git a/unit-test-coverage/ut-stubs/override_inc/drv/hdisk/ataDrv.h b/unit-test-coverage/ut-stubs/override_inc/drv/hdisk/ataDrv.h new file mode 100644 index 00000000..af875f76 --- /dev/null +++ b/unit-test-coverage/ut-stubs/override_inc/drv/hdisk/ataDrv.h @@ -0,0 +1,26 @@ +/* + * 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. + */ + +/* PSP coverage stub replacement for drv/hdisk/ataDrv.h */ +#ifndef _PSP_OVERRIDE_DRV_HDISK_ATADRV_H_ +#define _PSP_OVERRIDE_DRV_HDISK_ATADRV_H_ + +#include +#include +#include + +/* ----------------------------------------- */ +/* mappings for declarations in drv/hdisk/ataDrv.h */ +/* ----------------------------------------- */ +#define ataDevCreate PCS_ataDevCreate +#define ataXbdDevCreate PCS_ataXbdDevCreate + + +#endif /* _PSP_OVERRIDE_DRV_HDISK_ATADRV_H_ */ diff --git a/unit-test-coverage/ut-stubs/override_inc/errnoLib.h b/unit-test-coverage/ut-stubs/override_inc/errnoLib.h new file mode 100644 index 00000000..04be9c0c --- /dev/null +++ b/unit-test-coverage/ut-stubs/override_inc/errnoLib.h @@ -0,0 +1,25 @@ +/* + * 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. + */ + +/* PSP coverage stub replacement for errnoLib.h */ +#ifndef _PSP_OVERRIDE_ERRNOLIB_H_ +#define _PSP_OVERRIDE_ERRNOLIB_H_ + +#include +#include + + +/* ----------------------------------------- */ +/* mappings for declarations in errnoLib.h */ +/* ----------------------------------------- */ +#define errnoGet PCS_errnoGet + + +#endif /* _PSP_OVERRIDE_ERRNOLIB_H_ */ diff --git a/unit-test-coverage/ut-stubs/override_inc/excLib.h b/unit-test-coverage/ut-stubs/override_inc/excLib.h new file mode 100644 index 00000000..74e7162a --- /dev/null +++ b/unit-test-coverage/ut-stubs/override_inc/excLib.h @@ -0,0 +1,24 @@ +/* + * 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. + */ + +/* PSP coverage stub replacement for excLib.h */ +#ifndef _PSP_OVERRIDE_EXCLIB_H_ +#define _PSP_OVERRIDE_EXCLIB_H_ + +#include +#include + + +/* ----------------------------------------- */ +/* mappings for declarations in excLib.h */ +/* ----------------------------------------- */ +#define excHookAdd PCS_excHookAdd + +#endif /* _PSP_OVERRIDE_EXCLIB_H_ */ diff --git a/unit-test-coverage/ut-stubs/override_inc/fppLib.h b/unit-test-coverage/ut-stubs/override_inc/fppLib.h new file mode 100644 index 00000000..29bf1a38 --- /dev/null +++ b/unit-test-coverage/ut-stubs/override_inc/fppLib.h @@ -0,0 +1,23 @@ +/* + * 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. + */ + +/* PSP coverage stub replacement for fppLib.h */ +#ifndef _PSP_OVERRIDE_FPPLIB_H_ +#define _PSP_OVERRIDE_FPPLIB_H_ + +#include + +/* ----------------------------------------- */ +/* mappings for declarations in fppLib.h */ +/* ----------------------------------------- */ +#define FP_CONTEXT PCS_FP_CONTEXT +#define fppSave PCS_fppSave + +#endif /* _PSP_OVERRIDE_FPPLIB_H_ */ diff --git a/unit-test-coverage/ut-stubs/override_inc/mcpx750.h b/unit-test-coverage/ut-stubs/override_inc/mcpx750.h new file mode 100644 index 00000000..29855f71 --- /dev/null +++ b/unit-test-coverage/ut-stubs/override_inc/mcpx750.h @@ -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. + */ + +/* PSP coverage stub replacement for mcpx750.h */ +#ifndef _PSP_OVERRIDE_MCPX750_H_ +#define _PSP_OVERRIDE_MCPX750_H_ + +#include + +/* ----------------------------------------- */ +/* mappings for declarations in mcpx750.h */ +/* ----------------------------------------- */ +#define SYS_REG_BLRR PCS_SYS_REG_BLRR +#define SYS_REG_BLRR_PWRON PCS_SYS_REG_BLRR_PWRON +#define SYS_REG_BLRR_PBRST PCS_SYS_REG_BLRR_PBRST +#define SYS_REG_BLRR_FBTN PCS_SYS_REG_BLRR_FBTN +#define SYS_REG_BLRR_WDT2 PCS_SYS_REG_BLRR_WDT2 +#define SYS_REG_BLRR_SWSRST PCS_SYS_REG_BLRR_SWSRST +#define SYS_REG_BLRR_SWHRST PCS_SYS_REG_BLRR_SWHRST + +#define PCI_OUT_BYTE PCS_PciOutByte +#define PCI_OUT_LONG PCS_PciOutLong +#define sysPciWrite32 PCS_sysPciWrite32 +#define sysPciRead32 PCS_sysPciRead32 + +#endif /* _PSP_OVERRIDE_MCPX750_H_ */ diff --git a/unit-test-coverage/ut-stubs/override_inc/moduleLib.h b/unit-test-coverage/ut-stubs/override_inc/moduleLib.h new file mode 100644 index 00000000..3a550e8a --- /dev/null +++ b/unit-test-coverage/ut-stubs/override_inc/moduleLib.h @@ -0,0 +1,30 @@ +/* + * 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. + */ + +/* PSP coverage stub replacement for moduleLib.h */ +#ifndef _PSP_OVERRIDE_MODULELIB_H_ +#define _PSP_OVERRIDE_MODULELIB_H_ + +#include +#include + +/* ----------------------------------------- */ +/* mappings for declarations in moduleLib.h */ +/* ----------------------------------------- */ + +#define MODULE_ID PCS_MODULE_ID +#define MODULE_INFO PCS_MODULE_INFO + +#define moduleInfoGet PCS_moduleInfoGet +#define moduleFindByName PCS_moduleFindByName + + +#endif /* _PSP_OVERRIDE_MODULELIB_H_ */ + diff --git a/unit-test-coverage/ut-stubs/override_inc/ramDrv.h b/unit-test-coverage/ut-stubs/override_inc/ramDrv.h new file mode 100644 index 00000000..67327faa --- /dev/null +++ b/unit-test-coverage/ut-stubs/override_inc/ramDrv.h @@ -0,0 +1,26 @@ +/* + * 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. + */ + +/* PSP coverage stub replacement for ramDrv.h */ +#ifndef _PSP_OVERRIDE_RAMDRV_H_ +#define _PSP_OVERRIDE_RAMDRV_H_ + +#include +#include +#include + +/* ----------------------------------------- */ +/* mappings for declarations in ramDrv.h */ +/* ----------------------------------------- */ + +#define ramDevCreate PCS_ramDevCreate + + +#endif /* _PSP_OVERRIDE_RAMDRV_H_ */ diff --git a/unit-test-coverage/ut-stubs/override_inc/rebootLib.h b/unit-test-coverage/ut-stubs/override_inc/rebootLib.h new file mode 100644 index 00000000..da481701 --- /dev/null +++ b/unit-test-coverage/ut-stubs/override_inc/rebootLib.h @@ -0,0 +1,26 @@ +/* + * 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. + */ + +/* PSP coverage stub replacement for rebootLib.h */ +#ifndef _PSP_OVERRIDE_REBOOTLIB_H_ +#define _PSP_OVERRIDE_REBOOTLIB_H_ + +#include + +/* ----------------------------------------- */ +/* mappings for declarations in rebootLib.h */ +/* ----------------------------------------- */ +#define BOOT_CLEAR PCS_BOOT_CLEAR +#define BOOT_NORMAL PCS_BOOT_NORMAL + +#define reboot PCS_reboot + + +#endif /* _PSP_OVERRIDE_REBOOTLIB_H_ */ diff --git a/unit-test-coverage/ut-stubs/override_inc/stdarg.h b/unit-test-coverage/ut-stubs/override_inc/stdarg.h new file mode 100644 index 00000000..adc2f3e8 --- /dev/null +++ b/unit-test-coverage/ut-stubs/override_inc/stdarg.h @@ -0,0 +1,26 @@ +/* + * 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. + */ + +/* PSP coverage stub replacement for stdarg.h */ +#ifndef _PSP_OVERRIDE_STDARG_H_ +#define _PSP_OVERRIDE_STDARG_H_ + +#include + +/* ----------------------------------------- */ +/* mappings for declarations in stdarg.h */ +/* ----------------------------------------- */ + +#define va_list PCS_va_list +#define va_start(ap, last) PCS_va_start(ap, last) +#define va_end(ap) PCS_va_end(ap) + + +#endif /* _PSP_OVERRIDE_STDARG_H_ */ diff --git a/unit-test-coverage/ut-stubs/override_inc/stdio.h b/unit-test-coverage/ut-stubs/override_inc/stdio.h new file mode 100644 index 00000000..61431b01 --- /dev/null +++ b/unit-test-coverage/ut-stubs/override_inc/stdio.h @@ -0,0 +1,39 @@ +/* + * 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. + */ + +/* PSP coverage stub replacement for stdio.h */ +#ifndef _PSP_OVERRIDE_STDIO_H_ +#define _PSP_OVERRIDE_STDIO_H_ + +#include + +/* ----------------------------------------- */ +/* mappings for declarations in stdio.h */ +/* ----------------------------------------- */ + +#define FILE PCS_FILE +#define fclose PCS_fclose +#define fgets PCS_fgets +#define fopen PCS_fopen +#define fputs PCS_fputs +#define remove PCS_remove +#define rename PCS_rename +#define snprintf PCS_snprintf +#define vsnprintf PCS_vsnprintf +#define printf(...) PCS_printf(__VA_ARGS__) +#define putchar PCS_putchar + +#define stdin PCS_stdin +#define stdout PCS_stdout +#define stderr PCS_stderr + + +#endif /* _PSP_OVERRIDE_STDIO_H_ */ + diff --git a/unit-test-coverage/ut-stubs/override_inc/stdlib.h b/unit-test-coverage/ut-stubs/override_inc/stdlib.h new file mode 100644 index 00000000..72c76e12 --- /dev/null +++ b/unit-test-coverage/ut-stubs/override_inc/stdlib.h @@ -0,0 +1,30 @@ +/* + * 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. + */ + +/* PSP coverage stub replacement for stdlib.h */ +#ifndef _PSP_OVERRIDE_STDLIB_H_ +#define _PSP_OVERRIDE_STDLIB_H_ + +#include + +/* ----------------------------------------- */ +/* mappings for declarations in stdlib.h */ +/* ----------------------------------------- */ + +#define EXIT_SUCCESS PCS_EXIT_SUCCESS +#define EXIT_FAILURE PCS_EXIT_FAILURE +#define exit PCS_exit +#define strtoul PCS_strtoul +#define system PCS_system +#define malloc PCS_malloc +#define free PCS_free + + +#endif /* _PSP_OVERRIDE_STDLIB_H_ */ diff --git a/unit-test-coverage/ut-stubs/override_inc/string.h b/unit-test-coverage/ut-stubs/override_inc/string.h new file mode 100644 index 00000000..247e4a9e --- /dev/null +++ b/unit-test-coverage/ut-stubs/override_inc/string.h @@ -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. + */ + +/* PSP coverage stub replacement for string.h */ +#ifndef _PSP_OVERRIDE_STRING_H_ +#define _PSP_OVERRIDE_STRING_H_ + +#include + +/* ----------------------------------------- */ +/* mappings for declarations in string.h */ +/* ----------------------------------------- */ +#define memcpy PCS_memcpy +#define memset PCS_memset +#define strcmp PCS_strcmp +#define strcpy PCS_strcpy +#define strlen PCS_strlen +#define strncmp PCS_strncmp +#define strncpy PCS_strncpy +#define strchr PCS_strchr +#define strrchr PCS_strrchr +#define strcat PCS_strcat +#define strncat PCS_strncat +#define strerror PCS_strerror + +#endif /* _PSP_OVERRIDE_STRING_H_ */ diff --git a/unit-test-coverage/ut-stubs/override_inc/sys/types.h b/unit-test-coverage/ut-stubs/override_inc/sys/types.h new file mode 100644 index 00000000..3c32cb45 --- /dev/null +++ b/unit-test-coverage/ut-stubs/override_inc/sys/types.h @@ -0,0 +1,27 @@ +/* + * 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. + */ + +/* PSP coverage stub replacement for sys/types.h */ +#ifndef _PSP_OVERRIDE_SYS_TYPES_H_ +#define _PSP_OVERRIDE_SYS_TYPES_H_ + +#include + +/* ----------------------------------------- */ +/* mappings for declarations in sys/types.h */ +/* ----------------------------------------- */ +#define ssize_t PCS_ssize_t +#define off_t PCS_off_t +#define mode_t PCS_mode_t +#define pid_t PCS_pid_t +#define gid_t PCS_gid_t +#define uid_t PCS_uid_t + +#endif /* _PSP_OVERRIDE_SYS_TYPES_H_ */ diff --git a/unit-test-coverage/ut-stubs/override_inc/sysLib.h b/unit-test-coverage/ut-stubs/override_inc/sysLib.h new file mode 100644 index 00000000..49cffb4c --- /dev/null +++ b/unit-test-coverage/ut-stubs/override_inc/sysLib.h @@ -0,0 +1,38 @@ +/* + * 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. + */ + +/* PSP coverage stub replacement for sysLib.h */ +#ifndef _PSP_OVERRIDE_SYSLIB_H_ +#define _PSP_OVERRIDE_SYSLIB_H_ + +#include +#include + +/* ----------------------------------------- */ +/* mappings for declarations in sysLib.h */ +/* ----------------------------------------- */ +#define sysClkRateGet PCS_sysClkRateGet +#define sysMemTop PCS_sysMemTop + +/* + * These PCI accessors are related to sysLib but the prototype does not necessarily appear in this file + */ +#define PciOutByte PCS_PciOutByte +#define PciOutLong PCS_PciOutLong +#define sysPciWrite32 PCS_sysPciWrite32 +#define sysPciRead32 PCS_sysPciRead32 + +/* + * These definitions are part of BSP integration which does not have a header file + */ +#define GetWrsKernelTextStart PCS_GetWrsKernelTextStart +#define GetWrsKernelTextEnd PCS_GetWrsKernelTextEnd + +#endif /* _PSP_OVERRIDE_SYSLIB_H_ */ diff --git a/unit-test-coverage/ut-stubs/override_inc/taskLib.h b/unit-test-coverage/ut-stubs/override_inc/taskLib.h new file mode 100644 index 00000000..9469e54e --- /dev/null +++ b/unit-test-coverage/ut-stubs/override_inc/taskLib.h @@ -0,0 +1,47 @@ +/* + * 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. + */ + +/* PSP coverage stub replacement for taskLib.h */ +#ifndef _PSP_OVERRIDE_TASKLIB_H_ +#define _PSP_OVERRIDE_TASKLIB_H_ + +#include +#include + +/* ----------------------------------------- */ +/* mappings for declarations in taskLib.h */ +/* ----------------------------------------- */ +#define VX_FP_TASK PCS_VX_FP_TASK +#define TASK_ID PCS_TASK_ID +#define WIND_TCB PCS_WIND_TCB +#define TASK_DESC PCS_TASK_DESC + +#define taskName PCS_taskName +#define taskNameToId PCS_taskNameToId +#define taskIdDefault PCS_taskIdDefault +#define taskIsReady PCS_taskIsReady +#define taskIsSuspended PCS_taskIsSuspended +#define taskGetInfo PCS_taskGetInfo + +#define taskActivate PCS_taskActivate +#define taskExit PCS_taskExit +#define taskIdSelf PCS_taskIdSelf +#define taskDelay PCS_taskDelay +#define taskDelete PCS_taskDelete +#define taskDeleteForce PCS_taskDeleteForce +#define taskSuspend PCS_taskSuspend +#define taskResume PCS_taskResume +#define taskPrioritySet PCS_taskPrioritySet +#define taskSpawn PCS_taskSpawn +#define taskInit PCS_taskInit +#define taskTcb PCS_taskTcb + + +#endif /* _PSP_OVERRIDE_TASKLIB_H_ */ diff --git a/unit-test-coverage/ut-stubs/override_inc/unistd.h b/unit-test-coverage/ut-stubs/override_inc/unistd.h new file mode 100644 index 00000000..107d9fea --- /dev/null +++ b/unit-test-coverage/ut-stubs/override_inc/unistd.h @@ -0,0 +1,42 @@ +/* + * 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. + */ + +/* PSP coverage stub replacement for unistd.h */ +#ifndef _PSP_OVERRIDE_UNISTD_H_ +#define _PSP_OVERRIDE_UNISTD_H_ + +#include + +/* ----------------------------------------- */ +/* mappings for declarations in unistd.h */ +/* ----------------------------------------- */ + +#define SEEK_SET PCS_SEEK_SET +#define SEEK_CUR PCS_SEEK_CUR +#define SEEK_END PCS_SEEK_END +#define STDIN_FILENO PCS_STDIN_FILENO +#define STDOUT_FILENO PCS_STDOUT_FILENO +#define STDERR_FILENO PCS_STDERR_FILENO + +#define close PCS_close +#define getegid PCS_getegid +#define geteuid PCS_geteuid +#define gethostid PCS_gethostid +#define gethostname PCS_gethostname +#define getpid PCS_getpid +#define lseek PCS_lseek +#define read PCS_read +#define rmdir PCS_rmdir +#define sysconf PCS_sysconf +#define write PCS_write + + +#endif /* _PSP_OVERRIDE_UNISTD_H_ */ + diff --git a/unit-test-coverage/ut-stubs/override_inc/usrLib.h b/unit-test-coverage/ut-stubs/override_inc/usrLib.h new file mode 100644 index 00000000..2a4dea5b --- /dev/null +++ b/unit-test-coverage/ut-stubs/override_inc/usrLib.h @@ -0,0 +1,24 @@ +/* + * 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. + */ + +/* PSP coverage stub replacement for usrLib.h */ +#ifndef _PSP_OVERRIDE_USRLIB_H_ +#define _PSP_OVERRIDE_USRLIB_H_ + +#include +#include + +/* ----------------------------------------- */ +/* mappings for declarations in usrLib.h */ +/* ----------------------------------------- */ + + + +#endif /* _PSP_OVERRIDE_USRLIB_H_ */ diff --git a/unit-test-coverage/ut-stubs/override_inc/vxLib.h b/unit-test-coverage/ut-stubs/override_inc/vxLib.h new file mode 100644 index 00000000..a62edb5f --- /dev/null +++ b/unit-test-coverage/ut-stubs/override_inc/vxLib.h @@ -0,0 +1,23 @@ +/* + * 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. + */ + +/* PSP coverage stub replacement for vxLib.h */ +#ifndef _PSP_OVERRIDE_VXLIB_H_ +#define _PSP_OVERRIDE_VXLIB_H_ + +#include +#include + +/* ----------------------------------------- */ +/* mappings for declarations in vxLib.h */ +/* ----------------------------------------- */ + + +#endif /* _PSP_OVERRIDE_VXLIB_H_ */ diff --git a/unit-test-coverage/ut-stubs/override_inc/vxWorks.h b/unit-test-coverage/ut-stubs/override_inc/vxWorks.h new file mode 100644 index 00000000..40aefd0c --- /dev/null +++ b/unit-test-coverage/ut-stubs/override_inc/vxWorks.h @@ -0,0 +1,53 @@ +/* + * + * 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 vxWorks.h + * \ingroup ut-stubs + * \author joseph.p.hickey@nasa.gov + * + */ + +#ifndef INCLUDE_VXWORKS_H_ +#define INCLUDE_VXWORKS_H_ + +#include + +#define IMPORT + +/* ----------------------------------------- */ +/* mappings for declarations in vxWorks.h */ +/* ----------------------------------------- */ +#define ERROR PCS_ERROR +#define OK PCS_OK +#define WAIT_FOREVER PCS_WAIT_FOREVER +#define NO_WAIT PCS_NO_WAIT + + +#define STATUS PCS_STATUS +#define BOOL PCS_BOOL +#define FUNCPTR PCS_FUNCPTR +#define VOIDFUNCPTR PCS_VOIDFUNCPTR + +#define UINT PCS_UINT +#define INT8 PCS_INT8 +#define UINT8 PCS_UINT8 +#define INT16 PCS_INT16 +#define UINT16 PCS_UINT16 +#define INT32 PCS_INT32 +#define UINT32 PCS_UINT32 + +#define _Vx_usr_arg_t PCS_Vx_usr_arg_t + +#endif /* INCLUDE_VXWORKS_H_ */ + diff --git a/unit-test-coverage/ut-stubs/override_inc/xbdBlkDev.h b/unit-test-coverage/ut-stubs/override_inc/xbdBlkDev.h new file mode 100644 index 00000000..b2067a86 --- /dev/null +++ b/unit-test-coverage/ut-stubs/override_inc/xbdBlkDev.h @@ -0,0 +1,31 @@ +/* + * 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. + */ + +/* PSP coverage stub replacement for xbdBlkDev.h */ +#ifndef _PSP_OVERRIDE_XBDBLKDEV_H_ +#define _PSP_OVERRIDE_XBDBLKDEV_H_ + +#include +#include +#include + +/* ----------------------------------------- */ +/* mappings for declarations in xbdBlkDev.h */ +/* ----------------------------------------- */ + +#define NULLDEV PCS_NULLDEV +#define device_t PCS_device_t +#define xbdBlkDevCreateSync PCS_xbdBlkDevCreateSync +#define xbdBlkDevDelete PCS_xbdBlkDevDelete + + + +#endif /* _PSP_OVERRIDE_XBDBLKDEV_H_ */ + diff --git a/unit-test-coverage/ut-stubs/override_inc/xbdRamDisk.h b/unit-test-coverage/ut-stubs/override_inc/xbdRamDisk.h new file mode 100644 index 00000000..86d52655 --- /dev/null +++ b/unit-test-coverage/ut-stubs/override_inc/xbdRamDisk.h @@ -0,0 +1,24 @@ +/* + * 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. + */ + +/* PSP coverage stub replacement for xbdRamDisk.h */ +#ifndef _PSP_OVERRIDE_XBDRAMDISK_H_ +#define _PSP_OVERRIDE_XBDRAMDISK_H_ + +#include +#include + +/* ----------------------------------------- */ +/* mappings for declarations in xbdRamDisk.h */ +/* ----------------------------------------- */ + + + +#endif /* _PSP_OVERRIDE_XBDRAMDISK_H_ */ diff --git a/unit-test-coverage/ut-stubs/src/cfe-configdata-stubs.c b/unit-test-coverage/ut-stubs/src/cfe-configdata-stubs.c new file mode 100644 index 00000000..0a46ec4c --- /dev/null +++ b/unit-test-coverage/ut-stubs/src/cfe-configdata-stubs.c @@ -0,0 +1,86 @@ +/* + * 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. + */ + +/* PSP coverage stub replacement for string.h */ +#include +#include +#include +#include "utstubs.h" + +#include +#include + +#include + +Target_CfeConfigData GLOBAL_CFE_CONFIGDATA = +{ + + /** + * 1Hz ISR entry point. Called from PSP once per second on HW clock. + */ + .System1HzISR = PCS_System1HzISR, + + /** + * Main CFE entry point. Called from PSP startup code. + */ + .SystemMain = PCS_SystemMain, + + /** + * Notification function. Called from PSP after async event handling. + */ + .SystemNotify = PCS_SystemNotify +}; + +Target_ConfigData GLOBAL_CONFIGDATA = +{ + .MissionVersion = PCS_CONFIG_MISSIONVERSION, + .CfeVersion = PCS_CONFIG_CFEVERSION, + .OsalVersion = PCS_CONFIG_OSALVERSION, + .Config = PCS_CONFIG_CONFIGSTR, + .Date = PCS_CONFIG_DATESTR, + .User = PCS_CONFIG_USERSTR, + .Default_CpuName = PCS_CONFIG_CPUNAME, + .Default_CpuId = PCS_CONFIG_CPUNUMBER, + .Default_SpacecraftId = PCS_CONFIG_SPACECRAFT, + .CfeConfig = &GLOBAL_CFE_CONFIGDATA, + .PspConfig = &GLOBAL_PSP_CONFIGDATA +}; + + + +/** + * Stub for the main system entry function implemented in CFE ES + */ +void PCS_SystemMain(uint32 StartType, uint32 StartSubtype, uint32 ModeId, const char *StartFilePath) +{ + UT_Stub_RegisterContextGenericArg(UT_KEY(PCS_SystemMain), StartType); + UT_Stub_RegisterContextGenericArg(UT_KEY(PCS_SystemMain), StartSubtype); + UT_Stub_RegisterContextGenericArg(UT_KEY(PCS_SystemMain), ModeId); + UT_Stub_RegisterContextGenericArg(UT_KEY(PCS_SystemMain), StartFilePath); + UT_DEFAULT_IMPL(PCS_SystemMain); +} + +/** + * Stub for 1Hz ISR function implemented in CFE TIME + */ +void PCS_System1HzISR(void) +{ + UT_DEFAULT_IMPL(PCS_System1HzISR); +} + + +/** + * Stub for notification function implemented in CFE ES + */ +void PCS_SystemNotify(void) +{ + UT_DEFAULT_IMPL(PCS_SystemNotify); +} + diff --git a/unit-test-coverage/ut-stubs/src/libc-stdio-stubs.c b/unit-test-coverage/ut-stubs/src/libc-stdio-stubs.c new file mode 100644 index 00000000..e9c69eed --- /dev/null +++ b/unit-test-coverage/ut-stubs/src/libc-stdio-stubs.c @@ -0,0 +1,197 @@ +/* + * 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. + */ + +/* PSP coverage stub replacement for stdio.h */ +#include +#include +#include +#include "utstubs.h" + +#include + +struct PCS_FILE +{ + int f; +}; + +#define PCS_STDIO_MAX_SIZE 0x01000000 + +int PCS_fclose (PCS_FILE * stream) +{ + int32 Status; + + Status = UT_DEFAULT_IMPL(PCS_fclose); + + return Status; +} + +char *PCS_fgets (char * s, int n, PCS_FILE * stream) +{ + int32 Status; + uint32 CopySize; + + Status = UT_DEFAULT_IMPL_RC(PCS_fgets, PCS_STDIO_MAX_SIZE); + + if (Status > 0) + { + if (Status > n) + { + CopySize = n; + } + else + { + CopySize = Status; + } + + CopySize = UT_Stub_CopyToLocal(UT_KEY(PCS_fgets), s, CopySize); + + if (CopySize != 0) + { + Status = CopySize; + } + else if (Status <= n) + { + memset(s, 'x', Status); + } + else if (UT_GetStubCount(UT_KEY(PCS_fgets) < 4)) + { + memset(s, 'x', n); + Status = n; + } + else + { + Status = 0; + } + } + + if (Status <= 0) + { + return NULL; + } + + return s; +} + +PCS_FILE *PCS_fopen (const char * filename, const char * modes) +{ + int32 Status; + PCS_FILE *retval; + static PCS_FILE FOPEN_FP = { 0 }; + + Status = UT_DEFAULT_IMPL(PCS_fopen); + + if (Status == 0) + { + retval = &FOPEN_FP; + } + else + { + retval = NULL; + } + + return retval; +} + +int PCS_fputs (const char * s, PCS_FILE * stream) +{ + int32 Status; + + Status = UT_DEFAULT_IMPL(PCS_fputs); + + return Status; +} + +int PCS_putchar (int c) +{ + int32 Status; + + Status = UT_DEFAULT_IMPL(PCS_putchar); + + return Status; +} + + +int PCS_remove (const char * filename) +{ + int32 Status; + + Status = UT_DEFAULT_IMPL(PCS_remove); + + return Status; +} + +int PCS_rename (const char * old, const char * nw) +{ + int32 Status; + + Status = UT_DEFAULT_IMPL(PCS_rename); + + return Status; +} + +int PCS_snprintf (char * s, size_t maxlen, const char * format, ...) +{ + int32 Status; + int actual = 0; + va_list ap; + + Status = UT_DEFAULT_IMPL(PCS_snprintf); + + /* need to actually _do_ the snprintf */ + if (Status >= 0) + { + va_start(ap, format); + actual = vsnprintf(s,maxlen,format,ap); + va_end(ap); + } + + if (Status != 0) + { + actual = Status; + } + + return actual; +} + +int PCS_vsnprintf (char * s, size_t maxlen, const char * format, PCS_va_list arg) +{ + int32 Status; + int actual = 0; + + Status = UT_DEFAULT_IMPL(PCS_vsnprintf); + + /* need to actually _do_ something here - + * cannot do the real vsnprintf because we lost the args. */ + if (Status >= 0) + { + actual = snprintf(s,maxlen,"%s",format); + } + + if (Status != 0) + { + actual = Status; + } + + return actual; +} + +int PCS_printf (const char * format, ...) +{ + return UT_DEFAULT_IMPL(PCS_printf); +} + + +static PCS_FILE LOCAL_FP[3] = { { 10 }, { 11 }, { 12 } }; + +PCS_FILE* PCS_stdin = &LOCAL_FP[0]; +PCS_FILE* PCS_stdout = &LOCAL_FP[1]; +PCS_FILE* PCS_stderr = &LOCAL_FP[2]; + + diff --git a/unit-test-coverage/ut-stubs/src/libc-stdlib-stubs.c b/unit-test-coverage/ut-stubs/src/libc-stdlib-stubs.c new file mode 100644 index 00000000..399b7ced --- /dev/null +++ b/unit-test-coverage/ut-stubs/src/libc-stdlib-stubs.c @@ -0,0 +1,197 @@ +/* + * 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. + */ + +/* PSP coverage stub replacement for stdlib.h */ +#include +#include +#include +#include "utstubs.h" +#include "utassert.h" + +#include + +/* + * The malloc emulator relies on two magic numbers; + * one at the start of the pool, one for each block allocated. + * + * Note that the malloc emulator is not a real allocator, + * it only allocates sequential blocks and does not recover + * the space after free. + */ +#define MPOOL_START_SIGNATURE 0x8a458c6b +#define MPOOL_BLOCK_SIGNATURE 0x3ef65721 +#define MPOOL_ALIGN 16 + +struct MPOOL_REC +{ + cpuaddr BlockAddr; + uint32 Magic; + uint32 Size; +}; + + + +void PCS_exit(int c) +{ + UT_DEFAULT_IMPL(PCS_exit); + + /* + * This call is never supposed to return, but this stub will. + * The application therefore must handle a return from exit() + * + * TBD: IT would be nice if this could use a setjmp-like + * method to avoid returning here. + */ +} + +unsigned long int PCS_strtoul (const char * nptr, char ** endptr, int base) +{ + int32 Status; + unsigned long Result = 0; + + Status = UT_DEFAULT_IMPL_RC(PCS_strtoul, -1); + + if (Status < 0) + { + /* do the real op */ + Result = strtoul(nptr, endptr, base); + } + else + { + Result = Status; + } + + return Result; + +} + +int PCS_system (const char * command) +{ + return UT_DEFAULT_IMPL(PCS_system); +} + +void *PCS_malloc(size_t sz) +{ + int32 Status; + void *PoolPtr; + cpuaddr PoolStart; + cpuaddr PoolEnd; + cpuaddr NextBlock; + size_t NextSize; + uint32 PoolSize; + uint32 CallCnt; + struct MPOOL_REC *Rec; + + Rec = NULL; + CallCnt = UT_GetStubCount(UT_KEY(PCS_malloc)); + UT_GetDataBuffer(UT_KEY(PCS_malloc), &PoolPtr, &PoolSize, NULL); + + if (PoolPtr != NULL) + { + PoolStart = (cpuaddr)PoolPtr; + PoolEnd = PoolStart + PoolSize; + PoolStart = (PoolStart + MPOOL_ALIGN - 1) & ~((cpuaddr)MPOOL_ALIGN - 1); + PoolSize = PoolEnd - PoolStart; + + if (PoolSize > (MPOOL_ALIGN * 2)) + { + Rec = (struct MPOOL_REC*)PoolStart; + NextBlock = PoolStart + MPOOL_ALIGN; + PoolSize -= MPOOL_ALIGN; + if (CallCnt == 0) + { + Rec->Magic = MPOOL_START_SIGNATURE; + Rec->Size = 0; + Rec->BlockAddr = NextBlock; + } + else if (Rec->Magic != MPOOL_START_SIGNATURE) + { + UtAssert_Failed("PCS_malloc() heap corruption detected"); + } + } + } + + Status = UT_DEFAULT_IMPL(PCS_malloc); + + if (Status != 0 || Rec == NULL) + { + return NULL; + } + + NextSize = Rec->Size + sz + MPOOL_ALIGN; + if (NextSize > PoolSize) + { + /* + * This indicates that the application is trying to allocate + * a block larger than the pool. It typically means that the + * emulated heap size is too small, so it is prudent to generate + * a message. + */ + UtAssert_Failed("PCS_malloc() heap has been exhausted"); + return NULL; + } + + NextSize = (NextSize + MPOOL_ALIGN - 1) & ~((size_t)MPOOL_ALIGN); + NextBlock = Rec->BlockAddr + MPOOL_ALIGN; + Rec->BlockAddr += NextSize; + Rec->Size += NextSize; + + Rec = (struct MPOOL_REC*)(NextBlock - sizeof(struct MPOOL_REC)); + Rec->BlockAddr = NextBlock; + Rec->Magic = MPOOL_BLOCK_SIGNATURE; + Rec->Size = sz; + + return ((void*)NextBlock); +} + +void PCS_free(void *ptr) +{ + int32 Status; + cpuaddr BlockAddr; + void *PoolPtr; + uint32 PoolSize; + struct MPOOL_REC *Rec; + + /* + * If there is a data buffer associated with free() then this + * will sanity-check that the block being freed came from that heap. + */ + UT_GetDataBuffer(UT_KEY(PCS_free), &PoolPtr, &PoolSize, NULL); + + Status = UT_DEFAULT_IMPL(PCS_free); + if (Status == 0 && PoolPtr != NULL) + { + BlockAddr = (cpuaddr)ptr; + if (BlockAddr < (cpuaddr)PoolPtr || BlockAddr >= ((cpuaddr)PoolPtr + PoolSize)) + { + UtAssert_Failed("PCS_free(): Heap corruption -- Non-Heap pointer"); + } + else + { + Rec = (struct MPOOL_REC*)(BlockAddr - sizeof(struct MPOOL_REC)); + if (Rec->Magic == MPOOL_BLOCK_SIGNATURE) + { + Rec->Magic = ~MPOOL_BLOCK_SIGNATURE; + } + else if (Rec->Magic == ~MPOOL_BLOCK_SIGNATURE) + { + UtAssert_Failed("PCS_free(): Heap corruption -- Double free detected"); + } + else + { + UtAssert_Failed("PCS_free(): Heap corruption -- Corrupted block detected"); + } + } + } + + +} + + diff --git a/unit-test-coverage/ut-stubs/src/libc-string-stubs.c b/unit-test-coverage/ut-stubs/src/libc-string-stubs.c new file mode 100644 index 00000000..40de07a6 --- /dev/null +++ b/unit-test-coverage/ut-stubs/src/libc-string-stubs.c @@ -0,0 +1,201 @@ +/* + * 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. + */ + +/* PSP coverage stub replacement for string.h */ +#include +#include +#include +#include "utstubs.h" + +#include + +void* PCS_memset(void * s, int c, size_t n) +{ + int32 Status; + void *Result; + + Status = UT_DEFAULT_IMPL(PCS_memset); + + if (Status == 0) + { + Result = memset(s, c, n); + } + else + { + Result = NULL; + } + + return Result; +} + +void *PCS_memcpy (void * dest, const void * src, size_t n) +{ + int32 Status; + void *Result; + + Status = UT_DEFAULT_IMPL(PCS_memcpy); + + if (Status == 0) + { + Result = memcpy(dest, src, n); + } + else + { + Result = NULL; + } + + return Result; +} + +char *PCS_strchr(const char *s, int c) +{ + int32 Status; + + Status = UT_DEFAULT_IMPL(PCS_strchr); + + if (Status == 0) + { + /* "nominal" response */ + return strchr(s,c); + } + if (Status < 0) + { + return (char*)0; + } + + return (char*)&s[Status-1]; +} + +char *PCS_strrchr(const char *s, int c) +{ + int32 Status; + + Status = UT_DEFAULT_IMPL(PCS_strrchr); + + if (Status == 0) + { + /* "nominal" response */ + return strrchr(s,c); + } + if (Status < 0) + { + return (char*)0; + } + + return (char*)&s[Status-1]; +} + +size_t PCS_strlen(const char *s) +{ + int32 Status; + + Status = UT_DEFAULT_IMPL_RC(PCS_strlen, strlen(s)); + + return Status; +} + +char *PCS_strcat(char *dest, const char *src) +{ + int32 Status; + + Status = UT_DEFAULT_IMPL(PCS_strcat); + + if (Status == 0) + { + /* "nominal" response */ + return strcat(dest,src); + } + + return (char*)0; +} + +char *PCS_strncat(char *dest, const char *src, size_t size) +{ + int32 Status; + + Status = UT_DEFAULT_IMPL(PCS_strncat); + + if (Status == 0) + { + /* "nominal" response */ + return strncat(dest,src,size); + } + + return (char*)0; +} + +int PCS_strncmp(const char *s1, const char *s2, size_t size) +{ + int32 Status; + + Status = UT_DEFAULT_IMPL_RC(PCS_strncmp, strncmp(s1,s2,size)); + + return Status; +} + +int PCS_strcmp(const char *s1, const char *s2) +{ + int32 Status; + + Status = UT_DEFAULT_IMPL_RC(PCS_strcmp, strcmp(s1,s2)); + + return Status; +} + +char *PCS_strcpy(char *dst, const char *src) +{ + int32 Status; + + Status = UT_DEFAULT_IMPL(PCS_strcpy); + + if (Status == 0) + { + /* "nominal" response */ + return strcpy(dst,src); + } + + return (char*)0; +} + +char *PCS_strncpy(char *dst, const char *src, size_t size) +{ + int32 Status; + + Status = UT_DEFAULT_IMPL(PCS_strncpy); + + if (Status == 0) + { + /* "nominal" response */ + return strncpy(dst,src,size); + } + + return (char*)0; +} + +char *PCS_strerror(int errnum) +{ + static char str[16]; + int32 Status; + + Status = UT_DEFAULT_IMPL(PCS_strerror); + + if (Status != 0) + { + return NULL; + } + + /* "nominal" response */ + snprintf(str,sizeof(str),"UT_ERR_%d", errnum); + return str; +} + + + + diff --git a/unit-test-coverage/ut-stubs/src/vxworks-ataDrv-stubs.c b/unit-test-coverage/ut-stubs/src/vxworks-ataDrv-stubs.c new file mode 100644 index 00000000..ac6f2ca1 --- /dev/null +++ b/unit-test-coverage/ut-stubs/src/vxworks-ataDrv-stubs.c @@ -0,0 +1,21 @@ +/* + * 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. + */ + +/* PSP coverage stub replacement for ataDrv.h */ +#include +#include +#include "utstubs.h" + +#include + +PCS_device_t PCS_ataXbdDevCreate (int ctrl, int drive, unsigned int nBlks, unsigned int offset, const char *name) +{ + return UT_DEFAULT_IMPL(PCS_ataXbdDevCreate); +} diff --git a/unit-test-coverage/ut-stubs/src/vxworks-cacheLib-stubs.c b/unit-test-coverage/ut-stubs/src/vxworks-cacheLib-stubs.c new file mode 100644 index 00000000..55a04d06 --- /dev/null +++ b/unit-test-coverage/ut-stubs/src/vxworks-cacheLib-stubs.c @@ -0,0 +1,21 @@ +/* + * 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. + */ + +/* PSP coverage stub replacement for cacheLib.h */ +#include +#include +#include "utstubs.h" + +#include + +PCS_STATUS PCS_cacheTextUpdate (void * adrs, size_t bytes) +{ + return UT_DEFAULT_IMPL(PCS_cacheTextUpdate); +} diff --git a/unit-test-coverage/ut-stubs/src/vxworks-excLib-stubs.c b/unit-test-coverage/ut-stubs/src/vxworks-excLib-stubs.c new file mode 100644 index 00000000..2c31b1d8 --- /dev/null +++ b/unit-test-coverage/ut-stubs/src/vxworks-excLib-stubs.c @@ -0,0 +1,21 @@ +/* + * 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. + */ + +/* PSP coverage stub replacement for excLib.h */ +#include +#include +#include "utstubs.h" + +#include + +void PCS_excHookAdd (void (*Hook)(PCS_TASK_ID, int, void *)) +{ + UT_DEFAULT_IMPL(PCS_excHookAdd); +} diff --git a/unit-test-coverage/ut-stubs/src/vxworks-fppLib-stubs.c b/unit-test-coverage/ut-stubs/src/vxworks-fppLib-stubs.c new file mode 100644 index 00000000..e0db7063 --- /dev/null +++ b/unit-test-coverage/ut-stubs/src/vxworks-fppLib-stubs.c @@ -0,0 +1,21 @@ +/* + * 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. + */ + +/* PSP coverage stub replacement for fppLib.h */ +#include +#include +#include "utstubs.h" + +#include + +void PCS_fppSave (PCS_FP_CONTEXT *fpc) +{ + UT_DEFAULT_IMPL(PCS_fppSave); +} diff --git a/unit-test-coverage/ut-stubs/src/vxworks-mcpx750-stubs.c b/unit-test-coverage/ut-stubs/src/vxworks-mcpx750-stubs.c new file mode 100644 index 00000000..6c1d67d5 --- /dev/null +++ b/unit-test-coverage/ut-stubs/src/vxworks-mcpx750-stubs.c @@ -0,0 +1,20 @@ +/* + * 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. + */ + +/* PSP coverage stub replacement for memPartLib.h */ +#include +#include +#include "utstubs.h" + +#include + +static uint32_t PCS_SYS_REG_BLRR_VALUE; + +uint32_t *PCS_SYS_REG_BLRR = &PCS_SYS_REG_BLRR_VALUE; diff --git a/unit-test-coverage/ut-stubs/src/vxworks-moduleLib-stubs.c b/unit-test-coverage/ut-stubs/src/vxworks-moduleLib-stubs.c new file mode 100644 index 00000000..793340de --- /dev/null +++ b/unit-test-coverage/ut-stubs/src/vxworks-moduleLib-stubs.c @@ -0,0 +1,46 @@ +/* + * 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. + */ + +/* PSP coverage stub replacement for moduleLib.h */ +#include +#include +#include "utstubs.h" + +#include + +PCS_MODULE_ID PCS_moduleFindByName (const char *moduleName) +{ + PCS_MODULE_ID retval; + int32 Status; + + retval = NULL; + Status = UT_DEFAULT_IMPL(PCS_moduleFindByName); + if (Status == 0) + { + UT_Stub_CopyToLocal(UT_KEY(PCS_moduleFindByName), &retval, sizeof(retval)); + } + + return retval; +} + +PCS_STATUS PCS_moduleInfoGet(PCS_MODULE_ID moduleId, PCS_MODULE_INFO * pModuleInfo) +{ + int32 Status; + + Status = UT_DEFAULT_IMPL(PCS_moduleInfoGet); + + if (Status == 0 && + UT_Stub_CopyToLocal(UT_KEY(PCS_moduleInfoGet), pModuleInfo, sizeof(*pModuleInfo)) < sizeof(*pModuleInfo)) + { + memset(pModuleInfo, 0, sizeof(*pModuleInfo)); + } + + return Status; +} diff --git a/unit-test-coverage/ut-stubs/src/vxworks-rebootLib-stubs.c b/unit-test-coverage/ut-stubs/src/vxworks-rebootLib-stubs.c new file mode 100644 index 00000000..ee1b141e --- /dev/null +++ b/unit-test-coverage/ut-stubs/src/vxworks-rebootLib-stubs.c @@ -0,0 +1,21 @@ +/* + * 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. + */ + +/* PSP coverage stub replacement for rebootLib.h */ +#include +#include +#include "utstubs.h" + +#include + +void PCS_reboot(int boottype) +{ + UT_DEFAULT_IMPL(PCS_reboot); +} diff --git a/unit-test-coverage/ut-stubs/src/vxworks-sysLib-stubs.c b/unit-test-coverage/ut-stubs/src/vxworks-sysLib-stubs.c new file mode 100644 index 00000000..387a1e1d --- /dev/null +++ b/unit-test-coverage/ut-stubs/src/vxworks-sysLib-stubs.c @@ -0,0 +1,64 @@ +/* + * 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. + */ + +/* PSP coverage stub replacement for sysLib.h */ +#include +#include +#include "utstubs.h" + +#include + +int PCS_sysClkRateGet(void) +{ + return (UT_DEFAULT_IMPL_RC(PCS_sysClkRateGet,10000)); +} +char *PCS_sysMemTop (void) +{ + int32 Status; + char *BufPtr; + + BufPtr = NULL; + Status = UT_DEFAULT_IMPL(PCS_sysMemTop); + if (Status == 0) + { + UT_GetDataBuffer(UT_KEY(PCS_sysMemTop), (void**)&BufPtr, NULL, NULL); + } + + return BufPtr; +} + + +void PCS_PciOutByte (uint32_t address, uint8_t data) +{ + UT_DEFAULT_IMPL(PCS_PciOutByte); +} +void PCS_PciOutLong (uint32_t address, uint32_t data) +{ + UT_DEFAULT_IMPL(PCS_PciOutLong); +} +void PCS_sysPciWrite32 (uint32_t address, uint32_t data) +{ + UT_DEFAULT_IMPL(PCS_sysPciWrite32); +} +void PCS_sysPciRead32 (uint32_t address, uint32_t *data) +{ + UT_DEFAULT_IMPL(PCS_sysPciRead32); +} + + +unsigned int PCS_GetWrsKernelTextStart(void) +{ + return (UT_DEFAULT_IMPL(PCS_GetWrsKernelTextStart)); +} + +unsigned int PCS_GetWrsKernelTextEnd (void) +{ + return (UT_DEFAULT_IMPL(PCS_GetWrsKernelTextEnd)); +} diff --git a/unit-test-coverage/ut-stubs/src/vxworks-taskLib-stubs.c b/unit-test-coverage/ut-stubs/src/vxworks-taskLib-stubs.c new file mode 100644 index 00000000..a6b8712b --- /dev/null +++ b/unit-test-coverage/ut-stubs/src/vxworks-taskLib-stubs.c @@ -0,0 +1,172 @@ +/* + * 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. + */ + +/* PSP coverage stub replacement for taskLib.h */ +#include +#include +#include "utstubs.h" + +#include +#include + +static PCS_WIND_TCB PCS_LOCAL_TASK = { 0 }; + +const char *PCS_taskName(PCS_TASK_ID task_id) +{ + const char *retval; + int32 Status; + + retval = NULL; + Status = UT_DEFAULT_IMPL(PCS_taskName); + if (Status == 0) + { + UT_Stub_CopyToLocal(UT_KEY(PCS_taskName), &retval, sizeof(retval)); + } + + return retval; + +} +void PCS_taskExit(int code) +{ + UT_DEFAULT_IMPL(PCS_taskExit); +} +PCS_TASK_ID PCS_taskIdSelf(void) +{ + int32 Status; + + Status = UT_DEFAULT_IMPL(PCS_taskIdSelf); + if (Status != 0) + { + return ((PCS_TASK_ID)PCS_ERROR); + } + + return &PCS_LOCAL_TASK; +} +PCS_TASK_ID PCS_taskNameToId(const char *name) +{ + int32 Status; + + Status = UT_DEFAULT_IMPL(PCS_taskNameToId); + if (Status != 0) + { + return ((PCS_TASK_ID)PCS_ERROR); + } + + return &PCS_LOCAL_TASK; +} +PCS_STATUS PCS_taskDelay(int ticks) +{ + return (UT_DEFAULT_IMPL(PCS_taskDelay)); +} +PCS_STATUS PCS_taskDelete(PCS_TASK_ID tid) +{ + return (UT_DEFAULT_IMPL(PCS_taskDelete)); +} +PCS_STATUS PCS_taskDeleteForce(PCS_TASK_ID tid) +{ + return (UT_DEFAULT_IMPL(PCS_taskDeleteForce)); +} +PCS_STATUS PCS_taskSuspend(PCS_TASK_ID tid) +{ + return (UT_DEFAULT_IMPL(PCS_taskSuspend)); +} +PCS_STATUS PCS_taskResume(PCS_TASK_ID tid) +{ + return (UT_DEFAULT_IMPL(PCS_taskResume)); +} +PCS_STATUS PCS_taskPrioritySet(PCS_TASK_ID tid, int newPriority) +{ + return (UT_DEFAULT_IMPL(PCS_taskPrioritySet)); +} + +PCS_STATUS PCS_taskInit(PCS_WIND_TCB *pTcb, + char *name, + int priority, + int options, + char * pStackBase, + int stackSize, + PCS_FUNCPTR entryPt, + int arg1, + int arg2, + int arg3, + int arg4, + int arg5, + int arg6, + int arg7, + int arg8, + int arg9, + int arg10 +) +{ + return (UT_DEFAULT_IMPL(PCS_taskInit)); +} + +PCS_TASK_ID PCS_taskSpawn(char * name, + int priority, + int options, + int stackSize, + PCS_FUNCPTR entryPt, + int arg1, + int arg2, + int arg3, + int arg4, + int arg5, + int arg6, + int arg7, + int arg8, + int arg9, + int arg10) + +{ + int32 Status; + + Status = UT_DEFAULT_IMPL(PCS_taskSpawn); + if (Status != 0) + { + return ((PCS_TASK_ID)PCS_ERROR); + } + + return &PCS_LOCAL_TASK; +} + +PCS_STATUS PCS_taskActivate(PCS_TASK_ID tid) +{ + int32 Status; + + Status = UT_DEFAULT_IMPL(PCS_taskActivate); + + return Status; +} + +PCS_WIND_TCB *PCS_taskTcb(PCS_TASK_ID tid) +{ + int32 Status; + PCS_WIND_TCB *LocalTcb; + + Status = UT_DEFAULT_IMPL(PCS_taskTcb); + if (Status != 0) + { + return (NULL); + } + + if (UT_Stub_CopyToLocal(UT_KEY(PCS_taskTcb), &LocalTcb, sizeof(LocalTcb)) < sizeof(LocalTcb)) + { + /* + * On VxWorks the TASK_ID is defined as a direct type cast + * of the TCB address. This is actually documented + * in the API and application code that works with TCBs + * certainly will depend on this being the case. + */ + LocalTcb = (PCS_WIND_TCB *)tid; + } + + return LocalTcb; +} + diff --git a/unit-test-coverage/ut-stubs/src/vxworks-vxLib-stubs.c b/unit-test-coverage/ut-stubs/src/vxworks-vxLib-stubs.c new file mode 100644 index 00000000..b7d33699 --- /dev/null +++ b/unit-test-coverage/ut-stubs/src/vxworks-vxLib-stubs.c @@ -0,0 +1,45 @@ +/* + * 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. + */ + +/* PSP coverage stub replacement for vxLib.h */ +#include +#include +#include "utstubs.h" + +#include +#include + + +void PCS_vxTimeBaseGet (uint32_t *u, uint32_t *l) +{ + UT_DEFAULT_IMPL(PCS_vxTimeBaseGet); + *u = 0; + *l = 0; +} +void PCS_vxMsrSet (uint32_t val) +{ + UT_DEFAULT_IMPL(PCS_vxMsrSet); +} +uint32_t PCS_vxMsrGet (void) +{ + return UT_DEFAULT_IMPL(PCS_vxMsrGet); +} +void PCS_vxFpscrSet (uint32_t val) +{ + UT_DEFAULT_IMPL(PCS_vxFpscrSet); +} +uint32_t PCS_vxFpscrGet (void) +{ + return UT_DEFAULT_IMPL(PCS_vxFpscrGet); +} +uint32_t PCS_vxDecGet (void) +{ + return UT_DEFAULT_IMPL(PCS_vxDecGet); +} diff --git a/ut-stubs/CMakeLists.txt b/ut-stubs/CMakeLists.txt new file mode 100644 index 00000000..6e803585 --- /dev/null +++ b/ut-stubs/CMakeLists.txt @@ -0,0 +1,2 @@ +include_directories(${osal_MISSION_DIR}/ut_assert/inc) +add_library(ut_psp-${CFE_PSP_TARGETNAME}_stubs ut_psp_stubs.c) diff --git a/fsw/ut-stubs/ut_psp_stubs.c b/ut-stubs/ut_psp_stubs.c similarity index 100% rename from fsw/ut-stubs/ut_psp_stubs.c rename to ut-stubs/ut_psp_stubs.c From a53f65cbc7b05f1a2d5dc7e8430787ac17d2ca89 Mon Sep 17 00:00:00 2001 From: "Gerardo E. Cruz-Ortiz" Date: Wed, 5 Aug 2020 15:22:43 -0400 Subject: [PATCH 2/2] Increase version to 1.4.0+dev76 and update readme Set format of version string to a single line and set "development version" to ALL CAPS. --- README.md | 7 ++++++- fsw/mcp750-vxworks/inc/psp_version.h | 6 +++--- fsw/pc-linux/inc/psp_version.h | 6 +++--- fsw/pc-rtems/inc/psp_version.h | 6 +++--- 4 files changed, 15 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index b497d588..92cb1730 100644 --- a/README.md +++ b/README.md @@ -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 + ### 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. @@ -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 -#### Development Build: 1.4.10 +### Development Build: 1.4.10 - Implements full-precision microsecond conversion - See diff --git a/fsw/mcp750-vxworks/inc/psp_version.h b/fsw/mcp750-vxworks/inc/psp_version.h index d379ddff..d8decb74 100644 --- a/fsw/mcp750-vxworks/inc/psp_version.h +++ b/fsw/mcp750-vxworks/inc/psp_version.h @@ -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" /* @@ -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_ */ diff --git a/fsw/pc-linux/inc/psp_version.h b/fsw/pc-linux/inc/psp_version.h index f455e942..c5ed2451 100644 --- a/fsw/pc-linux/inc/psp_version.h +++ b/fsw/pc-linux/inc/psp_version.h @@ -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" /* @@ -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_ */ diff --git a/fsw/pc-rtems/inc/psp_version.h b/fsw/pc-rtems/inc/psp_version.h index a9167369..70ad8862 100644 --- a/fsw/pc-rtems/inc/psp_version.h +++ b/fsw/pc-rtems/inc/psp_version.h @@ -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" /* @@ -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_ */