diff --git a/CHANGELOG.md b/CHANGELOG.md index c3fad7bc5..8e5f5e828 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## Development Build: v7.0.0-rc4+dev287 +- document CFS component file naming +- Add EVS port timestamp and simplify port selection +- remove else statement that was unreachable by unit tests +- correct fallback file case +- See , , , and + ## Development Build: v7.0.0-rc4+dev276 - improve add_cfe_tables function - add option to link to generated files diff --git a/cmake/global_functions.cmake b/cmake/global_functions.cmake index ba68c447e..46396be1f 100644 --- a/cmake/global_functions.cmake +++ b/cmake/global_functions.cmake @@ -28,14 +28,17 @@ function(cfe_locate_implementation_file OUTPUT_VAR FILE_NAME) cmake_parse_arguments(LOCATEIMPL_ARG "OPTIONAL;ALLOW_LIST" "FALLBACK_FILE" "PREFIX;SUBDIR" ${ARGN}) - # Always check for filename matches directly in the MISSION_DEFS dir - set(IMPL_SEARCH_BASEDIRS "${MISSION_DEFS}/") + set(IMPL_SEARCH_BASEDIRS) # The prefix could also be a subdir, but do not repeat the mission name foreach (PREFIX ${LOCATEIMPL_ARG_PREFIX}) if (NOT "${MISSIONCONFIG}" STREQUAL "${PREFIX}") list(APPEND IMPL_SEARCH_BASEDIRS "${MISSION_DEFS}/${PREFIX}/") endif() endforeach() + # Always check for filename matches directly in the MISSION_DEFS dir + list(APPEND IMPL_SEARCH_BASEDIRS "${MISSION_DEFS}/") + list(REVERSE IMPL_SEARCH_BASEDIRS) + set(ADD_SUBDIRS) foreach (SUBDIR ${LOCATEIMPL_ARG_SUBDIR}) foreach (BASEDIR ${IMPL_SEARCH_BASEDIRS}) @@ -43,17 +46,10 @@ function(cfe_locate_implementation_file OUTPUT_VAR FILE_NAME) endforeach() endforeach() list(APPEND IMPL_SEARCH_BASEDIRS ${ADD_SUBDIRS}) + list(REMOVE_DUPLICATES IMPL_SEARCH_BASEDIRS) # Build the list of possible locations for this file in REVERSE priority order set(IMPL_SEARCH_PATH) - if (LOCATEIMPL_ARG_FALLBACK_FILE) - if (IS_ABSOLUTE "${LOCATEIMPL_ARG_FALLBACK_FILE}") - list(APPEND IMPL_SEARCH_PATH "${LOCATEIMPL_ARG_FALLBACK_FILE}") - else() - list(APPEND IMPL_SEARCH_PATH "${CMAKE_CURRENT_LIST_DIR}/${LOCATEIMPL_ARG_FALLBACK_FILE}") - endif() - endif() - # Check for the existence of the file in each of the dirs foreach(BASEDIR ${IMPL_SEARCH_BASEDIRS}) list(APPEND IMPL_SEARCH_PATH "${BASEDIR}${FILE_NAME}") @@ -74,6 +70,14 @@ function(cfe_locate_implementation_file OUTPUT_VAR FILE_NAME) endif() endforeach() + if (NOT SELECTED_FILE AND LOCATEIMPL_ARG_FALLBACK_FILE) + if (IS_ABSOLUTE "${LOCATEIMPL_ARG_FALLBACK_FILE}") + set(SELECTED_FILE "${LOCATEIMPL_ARG_FALLBACK_FILE}") + else() + set(SELECTED_FILE "${CMAKE_CURRENT_LIST_DIR}/${LOCATEIMPL_ARG_FALLBACK_FILE}") + endif() + endif() + if (SELECTED_FILE) message(STATUS "Using file: ${SELECTED_FILE} for ${FILE_NAME}") elseif(NOT LOCATEIMPL_ARG_OPTIONAL) @@ -156,7 +160,7 @@ function(generate_config_includefile) set(GENCONFIG_ARG_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/inc") endif (NOT GENCONFIG_ARG_OUTPUT_DIRECTORY) - if (IS_CFS_ARCH_BUILD) + if (IS_CFS_ARCH_BUILD AND NOT GENCONFIG_ARG_PREFIXES) set(ARCH_PREFIXES ${BUILD_CONFIG}) else() set(ARCH_PREFIXES) @@ -176,7 +180,6 @@ function(generate_config_includefile) else() # Use the common search function to find the candidate(s) cfe_locate_implementation_file(SRC_LOCAL_PATH_LIST "${TGTFILE}" - ALLOW_LIST FALLBACK_FILE "${GENCONFIG_ARG_FALLBACK_FILE}" PREFIX ${GENCONFIG_ARG_PREFIXES} ${ARCH_PREFIXES} SUBDIR config diff --git a/docs/cFE Application Developers Guide.md b/docs/cFE Application Developers Guide.md index f80ac237b..ebf9e6f0c 100644 --- a/docs/cFE Application Developers Guide.md +++ b/docs/cFE Application Developers Guide.md @@ -318,14 +318,14 @@ directory is described as a note under each folder. | |-- The flight software is all configured and built under this directory | |-- All mission and platform configuration files are placed here |-- apps - | |-- Contains application source code. + | |-- Contains application source code. | |-- Application source code may be shared amoung multiple build CPUs |-- libs | |-- Contains Core Flight System (cFS) Sample Library (sample_lib) |-- tools | |-- Contains Core Flight System (cFS) tools -``` -Module descriptions are provided in the table below. +``` +Module descriptions are provided in the table below. ``` -- missionxyz/cfe |-- cmake @@ -353,7 +353,7 @@ Module descriptions are provided in the table below. ``` -- missionxyz/build |-- CMakeFiles - | |-- Cmake fore cfe core build and all apps + | |-- Cmake for cfe core build and all apps |-- cpu1 | |-- Contains start up script "cfe_es_startup.scr" | |-- Where build.o and executable files, etc. are placed @@ -364,12 +364,12 @@ Module descriptions are provided in the table below. | |-- Where the cpu1 platform configuration include files go |-- src |-- tools -``` +``` ``` -- missionxyz/build/cpu1 |-- default_cpu1 | |-- CMakeFiles - | | | Cmake fore cfe core build and all apps + | | | Cmake for cfe core build and all apps | |-- apps | | |-- Where application makefiles go | | |-- One directory per application @@ -392,19 +392,19 @@ Module descriptions are provided in the table below. | |-- tbl | |-- time ``` -``` +``` -- missionxyz/apps |-- ci_lab |-- sample_app |-- sch_lab |-- to_lab -``` -``` +``` +``` -- missionxyz/tools |-- cFS-GroundSystem |-- elf2cfetbl |-- tblCRCTool -``` +``` ``` -- missionxyz/cf/modules/es |-- eds @@ -599,33 +599,109 @@ Child Tasks can be useful in both "Software Only" and "Hardware Servicing" applications. ## 4.2 Best Practices + ### 4.2.1 cFS Application Template Applications designed to interface with the cFE should follow standard templates. Reference sample_app on Github for “live” example. -| **Directory** | **Descriptions** | -|:--------------------------------------|:-------------------------------------------------------------------------------------------------------------| -| fsw/ | All components which are used on/deployed to the actual target or define the interface to those components | -| fsw/inc/ | Public/Interface headers for the component | -| fsw/src/ | Source files and private headers for the component | -| tables/ | Example/Initial table definitions | - - - -| **Files** | **Descriptions** | -|:--------------------------------------|:-------------------------------------------------------------------------------------------------------------| -| fsw/src/sample_app.c | Main source code for sample_app. Located in src directory. | -| fsw/src/sample_app.h | Main header file for sample_app. It contains your main global typedef, prototypes, and miscellaneous define. | -| fsw/src/sample_app_events.h | Defines sample_app event IDs | -| fsw/src/sample_app_msg.h | Defines sample_app commands and its structures | -| fsw/tables/sample_app_table.c | Define sample_app table(s) | -| fsw/platform_inc/sample_app_msgids.h | Define sample_app message IDs | -| fsw/mission_inc/sample_app_perfids.h | Define sample_app performance IDs | - -In addition to showing the standard structure of a cFS application, the -sample_app also demonstrates how to interface with cFS libraries and table -services. +__File Organization and Directory Structure__ + +| **Directory** | **Content** | +|:--------------------------------------|:-------------------------------------------------------------------------------| +| config/ | Example configuration files for the component | +| eds/ | CCSDS Electronic Data Sheet package for the component (defined per book 876.0) | +| fsw/ | Source units that comprise the flight software that executes on the target | +| fsw/inc/ | Public/Interface headers for the component | +| fsw/src/ | Source files and private headers for the component | +| tables/ | Example table definitions for the component | + +__Source File Naming Convention__ + +All source files associated with a component should begin with the component name as a prefix, to help ensure uniqueness +of file names across all flight software packages once imported into a combined software tree. All of the configuration header +files should also be overridable at the mission level; that is, a component only provides a default file (with a `default_` prefix, +for distinction) that can be "cloned and owned" by placing a copy, without the `default_` prefix, into the `_defs` directory +for the CFE/CFS mission build. Any customized file(s) in the `_defs` directory will be seen by the CMake build system and used +instead of the default version of the file that is provided from the orignal source tree. + +| **File Name Pattern** | **Scope** | **Content** | +|:---------------------------|:---------:|:----------------------------------------------------------------------------------------------------| +| _module_`_fcncodes.h` | INTERFACE | Function Codes and associated documentation for the CMD interface of the component (see note) | +| _module_`_msgdefs.h` | INTERFACE | Constant definitions for the CMD/TLM interface(s) of the component (see note) | +| _module_`_tbldefs.h` | INTERFACE | Constant definitions that affect the table file interface(s) of the component | +| _module_`_msgstruct.h` | INTERFACE | Structures that define the CMD/TLM message interface(s) of the component | +| _module_`_tblstruct.h` | INTERFACE | Structures that define the table file interface(s) of the component | +| _module_`_interface_cfg.h` | INTERFACE | Other configuration that affects the interface(s) of the component (table files and/or messages) | +| _module_`_eventids.h` | INTERFACE | CFE EVS Event IDs for the component, with descriptions/documentation | +| _module_`_global_cfg.h` | MISSION | Constants that need to be consistent across all instances, but do not directly affect interface(s) | +| _module_`_version.h` | MISSION | Version number of the component | +| _module_`_msgids.h` | PLATFORM | CFE Software Bus Message ID definitions for CMD/TLM interface(s) of the component | +| _module_`_internal_cfg.h` | PLATFORM | Software configuration that does not affect interfaces, and may be different per instance/platform | +| _module_`_perfids.h` | PLATFORM | CFE ES Performance monitor IDs for the component, with descriptions/documentation | +| _module_`_verify.h` | FSW | Compile-time configuration validation (typically included from only one source file) | +| _module_`_app.[ch]` | FSW | Application entry point, initialization, and main task loop | +| _module_`_cmds.[ch]` | FSW | Application command processor functions | +| _module_`_dispatch.[ch]` | FSW | Dispatch table for validating incoming commands and invoking appropriate command processor | + +**NOTE**: For backward compatibility, the `_msgdefs.h` header should also provide the function code definitions from `_fcncodes.h`, such that +inclusion of the `_msgdefs.h` file alone provides the command codes as well as any other required definitions for message interpretation. +However, the `_fcncodes.h` header should be strictly limited to defining command/function codes for the command interface and should not contain +any other information. + +**IMPORANT**: All of the header files above with "INTERFACE" scope control the table/message interface of the component. Changing any of the +values or definitions in these files will affect the inter-processor communication - either table files, exported data products, commands, or +telementry messages. Due caution should be exercised when customizing any of these files, as any changes will need to be propagated to all +other CFE instances, ground systems, test software or scripts, or any other tools that interact with the flight softare. + +Also note that Electronic Data Sheets (EDS) definitions will supercede the "INTERFACE" header files listed above. These headers are not +used by the software when building FSW based on EDS. Instead, the EDS tool will generate these headers based on the content of the EDS file(s) +and the software will be configured to use the generated headers during the build. + +__Combination Headers__ + +The header files in this section combine two or more files from the above set for simplicity of usage in source code, as well as backward +compatiblity with traditional file names from older versions of CFS apps. Although these files may also be overridden directly, it is +recommended to only override/modify the more granular headers defined above. + +| **File Name Pattern** | **Content** | +|:---------------------------|:-------------------------------------------------------------------------------------------| +| _module_`_mission_cfg.h` | Combination of `global_cfg.h` and `interface_cfg.h` (mission scope configuration) | +| _module_`_platform_cfg.h` | Combination of `mission_cfg.h` (above), `internal_cfg.h` and any other dependencies | +| _module_`_msg.h` | Complete message interface: Combination of `msgdefs.h`, `msgstruct.h` and all dependencies | +| _module_`_tbl.h` | Complete table interface: Combination of `tbldefs.h`, `tblstruct.h` and all dependencies | + +**IMPORANT**: Files from a limited scope may depend on files from a broader scope, but not the other way around. For example, +the `platform_cfg.h` may depend on items defined in `mission_cfg.h`, but items in `mission_cfg.h` must **not** depend on items +defined in `platform_cfg.h`. + +__Example for SAMPLE_APP__ + +The sample application (SAMPLE_APP) provides a concrete example of the currently-recommended patterns for CFE/CFS applications. +This section provides a summary the naming conventions put into practice for the sample application. + +| **Files** | **Description** | +|:--------------------------------------------|:--------------------------------------------------------------------------------------------------| +| `config/default_sample_app_msgids.h` | CFE Software Bus Message ID definitions for SAMPLE_APP (CMD, SEND_HK, and HK_TLM) | +| `config/default_sample_app_msgdefs.h` | Not needed | +| `config/default_sample_app_tbldefs.h` | Not needed | +| `config/default_sample_app_msgstruct.h` | Defines NoopCmd, ResetCountersCmd, ProcessCmd, and HkTlm message structures | +| `config/default_sample_app_tblstruct.h` | Defines the example table content structure | +| `config/default_sample_app_interface_cfg.h` | Not needed | +| `config/default_sample_app_global_cfg.h` | Not needed | +| `config/default_sample_app_internal_cfg.h` | Not needed | +| `eds/sample_app.xml` | EDS `` for the SAMPLE_APP component (supercedes headers above, if enabled) | +| `fsw/inc/sample_app_events.h` | Defines sample_app event IDs | +| `fsw/inc/sample_app_perfids.h` | Define sample_app performance IDs | +| `fsw/src/sample_app.c` | Application entry point, initialization, and main task loop | +| `fsw/inc/sample_app.h` | Declarations/Prototypes for `sample_app.c` that are needed by other source units | +| `fsw/src/sample_app_cmds.c` | Application command processor functions | +| `fsw/inc/sample_app_cmds.h` | Declarations/Prototypes for `sample_app_cmds.c` that are needed by other source units | +| `fsw/src/sample_app_dispatch.c` | Application command dispatcher ("TaskPipe"; identification and validation of all message inputs) | +| `fsw/inc/sample_app_dispatch.h` | Declarations/Prototypes for `sample_app_dispatch.c` that are needed by other source units | + +In addition to showing the standard structure of a cFS application, the sample_app also demonstrates how to interface with cFS libraries +and table services. ### 4.2.2 Avoid "Endian-ness" Dependencies diff --git a/modules/core_api/fsw/inc/cfe_version.h b/modules/core_api/fsw/inc/cfe_version.h index 59f771ed3..d00df42b9 100644 --- a/modules/core_api/fsw/inc/cfe_version.h +++ b/modules/core_api/fsw/inc/cfe_version.h @@ -26,7 +26,7 @@ #define CFE_VERSION_H /* Development Build Macro Definitions */ -#define CFE_BUILD_NUMBER 276 /**< @brief Development: Number of development git commits since CFE_BUILD_BASELINE */ +#define CFE_BUILD_NUMBER 287 /**< @brief Development: Number of development git commits since CFE_BUILD_BASELINE */ #define CFE_BUILD_BASELINE "v7.0.0-rc4" /**< @brief Development: Reference git tag for build number */ /* See \ref cfsversions for definitions */ diff --git a/modules/core_api/mission_build.cmake b/modules/core_api/mission_build.cmake index 34eff598a..6bc99b88b 100644 --- a/modules/core_api/mission_build.cmake +++ b/modules/core_api/mission_build.cmake @@ -13,12 +13,12 @@ generate_config_includefile( FILE_NAME "cfe_mission_cfg.h" MATCH_SUFFIX "mission_cfg.h" - PREFIXES ${MISSIONCONFIG} + PREFIXES ${MISSIONCONFIG} cfe ) generate_config_includefile( FILE_NAME "cfe_perfids.h" MATCH_SUFFIX "perfids.h" - PREFIXES ${MISSIONCONFIG} + PREFIXES ${MISSIONCONFIG} cfe ) diff --git a/modules/evs/fsw/src/cfe_evs_task.c b/modules/evs/fsw/src/cfe_evs_task.c index 782a297c5..01352f49d 100644 --- a/modules/evs/fsw/src/cfe_evs_task.c +++ b/modules/evs/fsw/src/cfe_evs_task.c @@ -491,22 +491,7 @@ int32 CFE_EVS_EnablePortsCmd(const CFE_EVS_EnablePortsCmd_t *data) else { /* Process command data */ - if (((CmdPtr->BitMask & CFE_EVS_PORT1_BIT) >> 0) == true) - { - CFE_EVS_Global.EVS_TlmPkt.Payload.OutputPort |= CFE_EVS_PORT1_BIT; - } - if (((CmdPtr->BitMask & CFE_EVS_PORT2_BIT) >> 1) == true) - { - CFE_EVS_Global.EVS_TlmPkt.Payload.OutputPort |= CFE_EVS_PORT2_BIT; - } - if (((CmdPtr->BitMask & CFE_EVS_PORT3_BIT) >> 2) == true) - { - CFE_EVS_Global.EVS_TlmPkt.Payload.OutputPort |= CFE_EVS_PORT3_BIT; - } - if (((CmdPtr->BitMask & CFE_EVS_PORT4_BIT) >> 3) == true) - { - CFE_EVS_Global.EVS_TlmPkt.Payload.OutputPort |= CFE_EVS_PORT4_BIT; - } + CFE_EVS_Global.EVS_TlmPkt.Payload.OutputPort |= CmdPtr->BitMask; EVS_SendEvent(CFE_EVS_ENAPORT_EID, CFE_EVS_EventType_DEBUG, "Enable Ports Command Received with Port Bit Mask = 0x%02x", (unsigned int)CmdPtr->BitMask); @@ -538,22 +523,7 @@ int32 CFE_EVS_DisablePortsCmd(const CFE_EVS_DisablePortsCmd_t *data) else { /* Process command data */ - if (((CmdPtr->BitMask & CFE_EVS_PORT1_BIT) >> 0) == true) - { - CFE_EVS_Global.EVS_TlmPkt.Payload.OutputPort &= ~CFE_EVS_PORT1_BIT; - } - if (((CmdPtr->BitMask & CFE_EVS_PORT2_BIT) >> 1) == true) - { - CFE_EVS_Global.EVS_TlmPkt.Payload.OutputPort &= ~CFE_EVS_PORT2_BIT; - } - if (((CmdPtr->BitMask & CFE_EVS_PORT3_BIT) >> 2) == true) - { - CFE_EVS_Global.EVS_TlmPkt.Payload.OutputPort &= ~CFE_EVS_PORT3_BIT; - } - if (((CmdPtr->BitMask & CFE_EVS_PORT4_BIT) >> 3) == true) - { - CFE_EVS_Global.EVS_TlmPkt.Payload.OutputPort &= ~CFE_EVS_PORT4_BIT; - } + CFE_EVS_Global.EVS_TlmPkt.Payload.OutputPort &= ~CmdPtr->BitMask; EVS_SendEvent(CFE_EVS_DISPORT_EID, CFE_EVS_EventType_DEBUG, "Disable Ports Command Received with Port Bit Mask = 0x%02x", (unsigned int)CmdPtr->BitMask); diff --git a/modules/evs/fsw/src/cfe_evs_utils.c b/modules/evs/fsw/src/cfe_evs_utils.c index 8127046b4..bf6057b05 100644 --- a/modules/evs/fsw/src/cfe_evs_utils.c +++ b/modules/evs/fsw/src/cfe_evs_utils.c @@ -35,10 +35,7 @@ /* Local Function Prototypes */ void EVS_SendViaPorts(CFE_EVS_LongEventTlm_t *EVS_PktPtr); -void EVS_OutputPort1(char *Message); -void EVS_OutputPort2(char *Message); -void EVS_OutputPort3(char *Message); -void EVS_OutputPort4(char *Message); +void EVS_OutputPort(uint8 PortNum, char *Message); /* Function Definitions */ @@ -541,50 +538,40 @@ void EVS_GenerateEventTelemetry(EVS_AppData_t *AppDataPtr, uint16 EventID, uint1 *-----------------------------------------------------------------*/ void EVS_SendViaPorts(CFE_EVS_LongEventTlm_t *EVS_PktPtr) { - char PortMessage[CFE_EVS_MAX_PORT_MSG_LENGTH]; + char PortMessage[CFE_EVS_MAX_PORT_MSG_LENGTH]; + char TimeBuffer[CFE_TIME_PRINTED_STRING_SIZE]; + CFE_TIME_SysTime_t PktTime; - if (((CFE_EVS_Global.EVS_TlmPkt.Payload.OutputPort & CFE_EVS_PORT1_BIT) >> 0) == true) + CFE_MSG_GetMsgTime(CFE_MSG_PTR(EVS_PktPtr->TelemetryHeader), &PktTime); + CFE_TIME_Print(TimeBuffer, PktTime); + + snprintf(PortMessage, sizeof(PortMessage), "%s %u/%u/%s %u: %s", TimeBuffer, + (unsigned int)EVS_PktPtr->Payload.PacketID.SpacecraftID, + (unsigned int)EVS_PktPtr->Payload.PacketID.ProcessorID, EVS_PktPtr->Payload.PacketID.AppName, + (unsigned int)EVS_PktPtr->Payload.PacketID.EventID, EVS_PktPtr->Payload.Message); + + if (CFE_EVS_Global.EVS_TlmPkt.Payload.OutputPort & CFE_EVS_PORT1_BIT) { - /* Copy event message to string format */ - snprintf(PortMessage, CFE_EVS_MAX_PORT_MSG_LENGTH, "EVS Port1 %u/%u/%s %u: %s", - (unsigned int)EVS_PktPtr->Payload.PacketID.SpacecraftID, - (unsigned int)EVS_PktPtr->Payload.PacketID.ProcessorID, EVS_PktPtr->Payload.PacketID.AppName, - (unsigned int)EVS_PktPtr->Payload.PacketID.EventID, EVS_PktPtr->Payload.Message); /* Send string event out port #1 */ - EVS_OutputPort1(PortMessage); + EVS_OutputPort(1, PortMessage); } - if (((CFE_EVS_Global.EVS_TlmPkt.Payload.OutputPort & CFE_EVS_PORT2_BIT) >> 1) == true) + if (CFE_EVS_Global.EVS_TlmPkt.Payload.OutputPort & CFE_EVS_PORT2_BIT) { - /* Copy event message to string format */ - snprintf(PortMessage, CFE_EVS_MAX_PORT_MSG_LENGTH, "EVS Port2 %u/%u/%s %u: %s", - (unsigned int)EVS_PktPtr->Payload.PacketID.SpacecraftID, - (unsigned int)EVS_PktPtr->Payload.PacketID.ProcessorID, EVS_PktPtr->Payload.PacketID.AppName, - (unsigned int)EVS_PktPtr->Payload.PacketID.EventID, EVS_PktPtr->Payload.Message); /* Send string event out port #2 */ - EVS_OutputPort2(PortMessage); + EVS_OutputPort(2, PortMessage); } - if (((CFE_EVS_Global.EVS_TlmPkt.Payload.OutputPort & CFE_EVS_PORT3_BIT) >> 2) == true) + if (CFE_EVS_Global.EVS_TlmPkt.Payload.OutputPort & CFE_EVS_PORT3_BIT) { - /* Copy event message to string format */ - snprintf(PortMessage, CFE_EVS_MAX_PORT_MSG_LENGTH, "EVS Port3 %u/%u/%s %u: %s", - (unsigned int)EVS_PktPtr->Payload.PacketID.SpacecraftID, - (unsigned int)EVS_PktPtr->Payload.PacketID.ProcessorID, EVS_PktPtr->Payload.PacketID.AppName, - (unsigned int)EVS_PktPtr->Payload.PacketID.EventID, EVS_PktPtr->Payload.Message); /* Send string event out port #3 */ - EVS_OutputPort3(PortMessage); + EVS_OutputPort(3, PortMessage); } - if (((CFE_EVS_Global.EVS_TlmPkt.Payload.OutputPort & CFE_EVS_PORT4_BIT) >> 3) == true) + if (CFE_EVS_Global.EVS_TlmPkt.Payload.OutputPort & CFE_EVS_PORT4_BIT) { - /* Copy event message to string format */ - snprintf(PortMessage, CFE_EVS_MAX_PORT_MSG_LENGTH, "EVS Port4 %u/%u/%s %u: %s", - (unsigned int)EVS_PktPtr->Payload.PacketID.SpacecraftID, - (unsigned int)EVS_PktPtr->Payload.PacketID.ProcessorID, EVS_PktPtr->Payload.PacketID.AppName, - (unsigned int)EVS_PktPtr->Payload.PacketID.EventID, EVS_PktPtr->Payload.Message); /* Send string event out port #4 */ - EVS_OutputPort4(PortMessage); + EVS_OutputPort(4, PortMessage); } } @@ -593,39 +580,9 @@ void EVS_SendViaPorts(CFE_EVS_LongEventTlm_t *EVS_PktPtr) * Internal helper routine only, not part of API. * *-----------------------------------------------------------------*/ -void EVS_OutputPort1(char *Message) -{ - OS_printf("%s\n", Message); -} - -/*---------------------------------------------------------------- - * - * Internal helper routine only, not part of API. - * - *-----------------------------------------------------------------*/ -void EVS_OutputPort2(char *Message) -{ - OS_printf("%s\n", Message); -} - -/*---------------------------------------------------------------- - * - * Internal helper routine only, not part of API. - * - *-----------------------------------------------------------------*/ -void EVS_OutputPort3(char *Message) -{ - OS_printf("%s\n", Message); -} - -/*---------------------------------------------------------------- - * - * Internal helper routine only, not part of API. - * - *-----------------------------------------------------------------*/ -void EVS_OutputPort4(char *Message) +void EVS_OutputPort(uint8 PortNum, char *Message) { - OS_printf("%s\n", Message); + OS_printf("EVS Port%u %s\n", PortNum, Message); } /*---------------------------------------------------------------- diff --git a/modules/evs/ut-coverage/evs_UT.c b/modules/evs/ut-coverage/evs_UT.c index 534743970..d122dba1d 100644 --- a/modules/evs/ut-coverage/evs_UT.c +++ b/modules/evs/ut-coverage/evs_UT.c @@ -132,6 +132,17 @@ typedef struct typedef CFE_Status_t (*UT_EVS_SendEventFunc_t)(uint32); +/* Custom time handler to avoid needing to provide buffer for every event call */ +void UT_CFE_MSG_GetMsgTime_CustomHandler(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context) {} + +/* Add custom logic to cFE common UT_InitData */ +void UT_InitData_EVS(void) +{ + UT_InitData(); + + UT_SetHandlerFunction(UT_KEY(CFE_MSG_GetMsgTime), UT_CFE_MSG_GetMsgTime_CustomHandler, NULL); +} + /* Message init hook to stora last MsgId passed in */ static int32 UT_EVS_MSGInitHook(void *UserObj, int32 StubRetcode, uint32 CallCount, const UT_StubContext_t *Context) { @@ -274,7 +285,7 @@ void Test_Init(void) appbitcmd.Payload.AppName[sizeof(appbitcmd.Payload.AppName) - 1] = '\0'; /* Test successful early initialization of the cFE EVS */ - UT_InitData(); + UT_InitData_EVS(); UT_SetSizeofESResetArea(sizeof(CFE_ES_ResetData_t)); UT_SetDeferredRetcode(UT_KEY(OS_MutSemCreate), 1, OS_SUCCESS); UT_SetDeferredRetcode(UT_KEY(CFE_ES_GetResetType), 1, CFE_PSP_RST_TYPE_POWERON); @@ -282,7 +293,7 @@ void Test_Init(void) CFE_UtAssert_SYSLOG(EVS_SYSLOG_MSGS[4]); /* Task main with init failure */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_GetAppID), 1, -1); UtAssert_VOIDCALL(CFE_EVS_TaskMain()); @@ -290,7 +301,7 @@ void Test_Init(void) * invalid command packet */ UtPrintf("CFE_EVS_TaskMain - Test error reading command pipe, unrecognized msgid"); - UT_InitData(); + UT_InitData_EVS(); /* Set unexpected message ID */ UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &msgid, sizeof(msgid), false); @@ -300,20 +311,20 @@ void Test_Init(void) UtAssert_INT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_MSGID_EID); /* Test early initialization with a get reset area failure */ - UT_InitData(); + UT_InitData_EVS(); UT_SetStatusBSPResetArea(-1, CFE_TIME_RESET_SIGNATURE, CFE_TIME_ToneSignalSelect_PRIMARY); CFE_EVS_EarlyInit(); UT_SetStatusBSPResetArea(OS_SUCCESS, CFE_TIME_RESET_SIGNATURE, CFE_TIME_ToneSignalSelect_PRIMARY); CFE_UtAssert_SYSLOG(EVS_SYSLOG_MSGS[1]); /* Test early initialization, restoring the event log */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_GetResetType), 1, -1); CFE_EVS_EarlyInit(); CFE_UtAssert_SYSLOG(EVS_SYSLOG_MSGS[6]); /* Test early initialization, clearing the event log (log mode path) */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_GetResetType), 1, -1); CFE_EVS_Global.EVS_LogPtr->LogMode = CFE_EVS_LogMode_OVERWRITE + CFE_EVS_LogMode_DISCARD + 1; CFE_EVS_Global.EVS_LogPtr->LogFullFlag = false; @@ -322,7 +333,7 @@ void Test_Init(void) CFE_UtAssert_SYSLOG(EVS_SYSLOG_MSGS[5]); /* Test early initialization, clearing the event log (log full path) */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_GetResetType), 1, -1); CFE_EVS_Global.EVS_LogPtr->LogMode = CFE_EVS_LogMode_DISCARD; CFE_EVS_Global.EVS_LogPtr->LogFullFlag = 2; @@ -331,7 +342,7 @@ void Test_Init(void) CFE_UtAssert_SYSLOG(EVS_SYSLOG_MSGS[5]); /* Test early initialization, clearing the event log (next log path) */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_GetResetType), 1, -1); CFE_EVS_Global.EVS_LogPtr->LogMode = CFE_EVS_LogMode_OVERWRITE; CFE_EVS_Global.EVS_LogPtr->LogFullFlag = true; @@ -340,7 +351,7 @@ void Test_Init(void) CFE_UtAssert_SYSLOG(EVS_SYSLOG_MSGS[5]); /* Test early initialization with a mutex creation failure */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDeferredRetcode(UT_KEY(OS_MutSemCreate), 1, -1); CFE_EVS_EarlyInit(); CFE_UtAssert_SYSLOG(EVS_SYSLOG_MSGS[3]); @@ -348,13 +359,13 @@ void Test_Init(void) /* Test early initialization with an unexpected size returned * by CFE_PSP_GetResetArea */ - UT_InitData(); + UT_InitData_EVS(); UT_SetSizeofESResetArea(0); CFE_EVS_EarlyInit(); CFE_UtAssert_SYSLOG(EVS_SYSLOG_MSGS[2]); /* Repeat successful initialization to configure log for later references */ - UT_InitData(); + UT_InitData_EVS(); UT_SetSizeofESResetArea(sizeof(CFE_ES_ResetData_t)); UT_SetDeferredRetcode(UT_KEY(OS_MutSemCreate), 1, OS_SUCCESS); UT_SetDeferredRetcode(UT_KEY(CFE_ES_GetResetType), 1, CFE_PSP_RST_TYPE_POWERON); @@ -362,49 +373,49 @@ void Test_Init(void) CFE_UtAssert_SYSLOG(EVS_SYSLOG_MSGS[4]); /* Test task initialization where event services fails */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_GetAppID), 2, -1); /* Set Failure in CFE_EVS_Register -> EVS_GetApp_ID */ CFE_EVS_TaskInit(); CFE_UtAssert_SYSLOG(EVS_SYSLOG_MSGS[11]); /* Test task initialization where the pipe creation fails */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDeferredRetcode(UT_KEY(CFE_SB_CreatePipe), 1, -1); CFE_EVS_TaskInit(); CFE_UtAssert_SYSLOG(EVS_SYSLOG_MSGS[12]); /* Test task initialization where command subscription fails */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDeferredRetcode(UT_KEY(CFE_SB_Subscribe), 1, -1); CFE_EVS_TaskInit(); CFE_UtAssert_SYSLOG(EVS_SYSLOG_MSGS[13]); /* Test task initialization where HK request subscription fails */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDeferredRetcode(UT_KEY(CFE_SB_Subscribe), 2, -1); CFE_EVS_TaskInit(); CFE_UtAssert_SYSLOG(EVS_SYSLOG_MSGS[14]); /* Test task initialization where getting the application ID fails */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDefaultReturnValue(UT_KEY(CFE_ES_GetAppID), -1); CFE_EVS_TaskInit(); CFE_UtAssert_SYSLOG(EVS_SYSLOG_MSGS[10]); /* Test successful task initialization */ - UT_InitData(); + UT_InitData_EVS(); CFE_EVS_TaskInit(); UtAssert_STUB_COUNT(CFE_ES_WriteToSysLog, 0); /* Enable DEBUG message output */ - UT_InitData(); + UT_InitData_EVS(); appbitcmd.Payload.BitMask = CFE_EVS_DEBUG_BIT | CFE_EVS_INFORMATION_BIT | CFE_EVS_ERROR_BIT | CFE_EVS_CRITICAL_BIT; UT_EVS_DoDispatchCheckEvents(&appbitcmd, sizeof(appbitcmd), UT_TPID_CFE_EVS_CMD_ENABLE_APP_EVENT_TYPE_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ENAAPPEVTTYPE_EID); /* Disable ports */ - UT_InitData(); + UT_InitData_EVS(); bitmaskcmd.Payload.BitMask = CFE_EVS_PORT1_BIT | CFE_EVS_PORT2_BIT | CFE_EVS_PORT3_BIT | CFE_EVS_PORT4_BIT; UT_EVS_DoDispatchCheckEvents(&bitmaskcmd, sizeof(bitmaskcmd), UT_TPID_CFE_EVS_CMD_DISABLE_PORTS_CC, &UT_EVS_EventBuf); @@ -424,7 +435,7 @@ void Test_IllegalAppID(void) UtPrintf("Begin Test Illegal App ID"); /* Set test up with illegal application ID */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDefaultReturnValue(UT_KEY(CFE_ES_AppID_ToIndex), CFE_ES_ERR_RESOURCEID_NOT_VALID); /* Test registering an event using an illegal application ID */ @@ -436,42 +447,42 @@ void Test_IllegalAppID(void) UtAssert_INT32_EQ(CFE_EVS_SendTimedEvent(time, 0, 0, NULL), CFE_EVS_INVALID_PARAMETER); /* Test sending an event using an illegal application ID */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDefaultReturnValue(UT_KEY(CFE_ES_AppID_ToIndex), CFE_ES_ERR_RESOURCEID_NOT_VALID); UtAssert_INT32_EQ(CFE_EVS_SendEvent(0, 0, "NULL"), CFE_EVS_APP_ILLEGAL_APP_ID); /* Test sending an event using an illegal application ID */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDefaultReturnValue(UT_KEY(CFE_ES_AppID_ToIndex), CFE_ES_ERR_RESOURCEID_NOT_VALID); CFE_UtAssert_SUCCESS(EVS_SendEvent(0, 0, "NULL")); /* Test sending a timed event using an illegal application ID */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDefaultReturnValue(UT_KEY(CFE_ES_AppID_ToIndex), CFE_ES_ERR_RESOURCEID_NOT_VALID); UtAssert_INT32_EQ(CFE_EVS_SendTimedEvent(time, 0, 0, "NULL"), CFE_EVS_APP_ILLEGAL_APP_ID); /* Test sending an event with app ID using an illegal application ID */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDefaultReturnValue(UT_KEY(CFE_ES_AppID_ToIndex), CFE_ES_ERR_RESOURCEID_NOT_VALID); UtAssert_INT32_EQ(CFE_EVS_SendEventWithAppID(0, 0, CFE_ES_APPID_UNDEFINED, "NULL"), CFE_EVS_APP_ILLEGAL_APP_ID); /* Test resetting a filter using an illegal application ID */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDefaultReturnValue(UT_KEY(CFE_ES_AppID_ToIndex), CFE_ES_ERR_RESOURCEID_NOT_VALID); UtAssert_INT32_EQ(CFE_EVS_ResetFilter(0), CFE_EVS_APP_ILLEGAL_APP_ID); /* Test resetting all filters using an illegal application ID */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDefaultReturnValue(UT_KEY(CFE_ES_AppID_ToIndex), CFE_ES_ERR_RESOURCEID_NOT_VALID); UtAssert_INT32_EQ(CFE_EVS_ResetAllFilters(), CFE_EVS_APP_ILLEGAL_APP_ID); /* Test application cleanup using an illegal application ID */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDefaultReturnValue(UT_KEY(CFE_ES_AppID_ToIndex), CFE_ES_ERR_RESOURCEID_NOT_VALID); UtAssert_INT32_EQ(CFE_EVS_CleanUpApp(CFE_ES_APPID_UNDEFINED), CFE_EVS_APP_ILLEGAL_APP_ID); /* Test with out of range AppID */ - UT_InitData(); + UT_InitData_EVS(); AppID = CFE_ES_APPID_C(CFE_ResourceId_FromInteger(CFE_PLATFORM_ES_MAX_APPLICATIONS)); UtAssert_INT32_EQ(CFE_EVS_SendEventWithAppID(0, 0, AppID, "NULL"), CFE_EVS_APP_ILLEGAL_APP_ID); } @@ -490,39 +501,39 @@ void Test_UnregisteredApp(void) UtPrintf("Begin Test Unregistered App"); - UT_InitData(); + UT_InitData_EVS(); /* Unregister the application (it was registered in CFE_EVS_TaskInit) */ CFE_EVS_CleanUpApp(AppID); /* Test sending an event to an unregistered application */ - UT_InitData(); + UT_InitData_EVS(); UtAssert_INT32_EQ(CFE_EVS_SendEvent(0, 0, "NULL"), CFE_EVS_APP_NOT_REGISTERED); /* Test resetting a filter using an unregistered application */ - UT_InitData(); + UT_InitData_EVS(); UtAssert_INT32_EQ(CFE_EVS_ResetFilter(0), CFE_EVS_APP_NOT_REGISTERED); /* Test resetting all filters using an unregistered application */ - UT_InitData(); + UT_InitData_EVS(); UtAssert_INT32_EQ(CFE_EVS_ResetAllFilters(), CFE_EVS_APP_NOT_REGISTERED); /* Test sending an event with app ID to an unregistered application */ - UT_InitData(); + UT_InitData_EVS(); UtAssert_INT32_EQ(CFE_EVS_SendEventWithAppID(0, CFE_EVS_EventType_INFORMATION, AppID, "NULL"), CFE_EVS_APP_NOT_REGISTERED); /* Test sending a timed event to an unregistered application */ - UT_InitData(); + UT_InitData_EVS(); UtAssert_INT32_EQ(CFE_EVS_SendTimedEvent(time, CFE_EVS_EventType_INFORMATION, 0, "NULL"), CFE_EVS_APP_NOT_REGISTERED); /* Test application cleanup using an unregistered application */ - UT_InitData(); + UT_InitData_EVS(); CFE_UtAssert_SUCCESS(CFE_EVS_CleanUpApp(AppID)); /* Re-register the application for subsequent tests */ - UT_InitData(); + UT_InitData_EVS(); CFE_UtAssert_SUCCESS(CFE_EVS_Register(NULL, 0, CFE_EVS_EventFilter_BINARY)); } @@ -548,29 +559,29 @@ void Test_FilterRegistration(void) CFE_EVS_Global.EVS_TlmPkt.Payload.MessageFormatMode = CFE_EVS_MsgFormat_LONG; /* Test filter registration using an invalid filter option */ - UT_InitData(); + UT_InitData_EVS(); UtAssert_INT32_EQ(CFE_EVS_Register(NULL, 0, CFE_EVS_EventFilter_BINARY + 1), CFE_EVS_UNKNOWN_FILTER); /* Test successful filter registration with no filters */ - UT_InitData(); + UT_InitData_EVS(); CFE_UtAssert_SUCCESS(CFE_EVS_Register(NULL, 0, CFE_EVS_EventFilter_BINARY)); /* Re-register to test valid unregistration */ - UT_InitData(); + UT_InitData_EVS(); CFE_UtAssert_SUCCESS(CFE_EVS_Register(NULL, 0, CFE_EVS_EventFilter_BINARY)); /* Test successful app cleanup */ - UT_InitData(); + UT_InitData_EVS(); CFE_UtAssert_SUCCESS(CFE_EVS_CleanUpApp(AppID)); /* Test successful filter registration with a valid filter */ - UT_InitData(); + UT_InitData_EVS(); filter[0].EventID = 0; filter[0].Mask = 0x0001; CFE_UtAssert_SUCCESS(CFE_EVS_Register(filter, 1, CFE_EVS_EventFilter_BINARY)); /* Test successful multiple filter registration with valid filters */ - UT_InitData(); + UT_InitData_EVS(); for (i = 0; i < CFE_PLATFORM_EVS_MAX_EVENT_FILTERS + 1; i++) { @@ -583,19 +594,19 @@ void Test_FilterRegistration(void) CFE_EVS_Global.EVS_TlmPkt.Payload.MessageSendCounter = 0; /* Send 1st information message, should get through */ - UT_InitData(); + UT_InitData_EVS(); CFE_UtAssert_SUCCESS(CFE_EVS_SendEvent(0, CFE_EVS_EventType_INFORMATION, "OK")); UtAssert_UINT32_EQ(CFE_EVS_Global.EVS_TlmPkt.Payload.MessageSendCounter, 1); UtAssert_INT32_EQ(UT_GetStubCount(UT_KEY(CFE_SB_TransmitMsg)), 1); /* Send 2nd information message, should be filtered */ - UT_InitData(); + UT_InitData_EVS(); CFE_UtAssert_SUCCESS(CFE_EVS_SendEvent(0, CFE_EVS_EventType_INFORMATION, "FAILED")); UtAssert_UINT32_EQ(CFE_EVS_Global.EVS_TlmPkt.Payload.MessageSendCounter, 1); UtAssert_INT32_EQ(UT_GetStubCount(UT_KEY(CFE_SB_TransmitMsg)), 0); /* Send last information message, which should cause filtering to lock */ - UT_InitData(); + UT_InitData_EVS(); FilterPtr = EVS_FindEventID(0, (EVS_BinFilter_t *)AppDataPtr->BinFilters); FilterPtr->Count = CFE_EVS_MAX_FILTER_COUNT - 1; CFE_UtAssert_SUCCESS(CFE_EVS_SendEvent(0, CFE_EVS_EventType_INFORMATION, "OK")); @@ -604,33 +615,33 @@ void Test_FilterRegistration(void) UtAssert_UINT32_EQ(FilterPtr->Count, CFE_EVS_MAX_FILTER_COUNT); /* Test that filter lock is applied */ - UT_InitData(); + UT_InitData_EVS(); CFE_UtAssert_SUCCESS(CFE_EVS_SendEvent(0, CFE_EVS_EventType_INFORMATION, "FAILED")); UtAssert_UINT32_EQ(CFE_EVS_Global.EVS_TlmPkt.Payload.MessageSendCounter, 3); UtAssert_INT32_EQ(UT_GetStubCount(UT_KEY(CFE_SB_TransmitMsg)), 0); UtAssert_UINT32_EQ(FilterPtr->Count, CFE_EVS_MAX_FILTER_COUNT); /* Test that filter lock is (still) applied */ - UT_InitData(); + UT_InitData_EVS(); CFE_UtAssert_SUCCESS(CFE_EVS_SendEvent(0, CFE_EVS_EventType_INFORMATION, "FAILED")); UtAssert_UINT32_EQ(CFE_EVS_Global.EVS_TlmPkt.Payload.MessageSendCounter, 3); UtAssert_INT32_EQ(UT_GetStubCount(UT_KEY(CFE_SB_TransmitMsg)), 0); UtAssert_UINT32_EQ(FilterPtr->Count, CFE_EVS_MAX_FILTER_COUNT); /* Return application to original state: re-register application */ - UT_InitData(); + UT_InitData_EVS(); CFE_UtAssert_SUCCESS(CFE_EVS_Register(NULL, 0, CFE_EVS_EventFilter_BINARY)); /* Test sending an event with app ID to a registered, filtered * application */ - UT_InitData(); + UT_InitData_EVS(); AppDataPtr->AppID = AppID; AppDataPtr->ActiveFlag = false; CFE_UtAssert_SUCCESS(CFE_EVS_SendEventWithAppID(0, CFE_EVS_EventType_INFORMATION, AppID, "NULL")); /* Test sending a timed event to a registered, filtered application */ - UT_InitData(); + UT_InitData_EVS(); AppDataPtr->AppID = AppID; AppDataPtr->ActiveFlag = false; CFE_UtAssert_SUCCESS(CFE_EVS_SendTimedEvent(time, CFE_EVS_EventType_INFORMATION, 0, "NULL")); @@ -646,29 +657,29 @@ void Test_FilterReset(void) UtPrintf("Begin Test Filter Reset"); /* Test successful filter registration */ - UT_InitData(); + UT_InitData_EVS(); filter.EventID = 1; filter.Mask = 0x0001; CFE_UtAssert_SUCCESS(CFE_EVS_Register(&filter, 1, CFE_EVS_EventFilter_BINARY)); /* Test filter reset using an invalid event ID */ - UT_InitData(); + UT_InitData_EVS(); UtAssert_INT32_EQ(CFE_EVS_ResetFilter(CFE_PLATFORM_EVS_MAX_EVENT_FILTERS + 1), CFE_EVS_EVT_NOT_REGISTERED); /* Test filter reset using an unregistered event ID */ - UT_InitData(); + UT_InitData_EVS(); CFE_UtAssert_SUCCESS(CFE_EVS_ResetFilter(-1)); /* Test successful filter reset */ - UT_InitData(); + UT_InitData_EVS(); CFE_UtAssert_SUCCESS(CFE_EVS_ResetFilter(1)); /* Test successful reset of all filters */ - UT_InitData(); + UT_InitData_EVS(); CFE_UtAssert_SUCCESS(CFE_EVS_ResetAllFilters()); /* Return application to original state: re-register application */ - UT_InitData(); + UT_InitData_EVS(); CFE_UtAssert_SUCCESS(CFE_EVS_Register(NULL, 0, CFE_EVS_EventFilter_BINARY)); } @@ -711,7 +722,7 @@ void Test_Format(void) CFE_EVS_Global.EVS_TlmPkt.Payload.MessageFormatMode = CFE_EVS_MsgFormat_LONG; /* Enable DEBUG message output */ - UT_InitData(); + UT_InitData_EVS(); strncpy(appbitcmd.Payload.AppName, "ut_cfe_evs", sizeof(appbitcmd.Payload.AppName) - 1); appbitcmd.Payload.AppName[sizeof(appbitcmd.Payload.AppName) - 1] = '\0'; modecmd.Payload.MsgFormat = CFE_EVS_MsgFormat_LONG; @@ -721,7 +732,7 @@ void Test_Format(void) UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ENAAPPEVTTYPE_EID); /* Test set event format mode command using an invalid mode */ - UT_InitData(); + UT_InitData_EVS(); modecmd.Payload.MsgFormat = 0xff; UT_EVS_DoDispatchCheckEvents(&modecmd, sizeof(modecmd), UT_TPID_CFE_EVS_CMD_SET_EVENT_FORMAT_MODE_CC, &UT_EVS_EventBuf); @@ -730,14 +741,14 @@ void Test_Format(void) /* Test set event format mode command using a valid command to set short * format, reports implicitly via event */ - UT_InitData(); + UT_InitData_EVS(); modecmd.Payload.MsgFormat = CFE_EVS_MsgFormat_SHORT; UT_EVS_DoDispatchCheckEventsShort(&modecmd, sizeof(modecmd), UT_TPID_CFE_EVS_CMD_SET_EVENT_FORMAT_MODE_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_SETEVTFMTMOD_EID); UtPrintf("Test for short event sent when configured to do so "); - UT_InitData(); + UT_InitData_EVS(); UT_SetHookFunction(UT_KEY(CFE_MSG_Init), UT_EVS_MSGInitHook, &MsgData); UT_SetDataBuffer(UT_KEY(CFE_SB_TransmitMsg), &MsgSend, sizeof(MsgSend), false); CFE_EVS_SendEvent(0, CFE_EVS_EventType_INFORMATION, "Short format check 1"); @@ -754,7 +765,7 @@ void Test_Format(void) /* Test set event format mode command using a valid command to set long * format, reports implicitly via event */ - UT_InitData(); + UT_InitData_EVS(); modecmd.Payload.MsgFormat = CFE_EVS_MsgFormat_LONG; UT_EVS_DoDispatchCheckEvents(&modecmd, sizeof(modecmd), UT_TPID_CFE_EVS_CMD_SET_EVENT_FORMAT_MODE_CC, &UT_EVS_EventBuf); @@ -763,7 +774,7 @@ void Test_Format(void) /* Test event long format mode command was successful (the following * messages are output if long format selection is successful) */ - UT_InitData(); + UT_InitData_EVS(); memset(&CapturedMsg, 0xFF, sizeof(CapturedMsg)); UT_SetHookFunction(UT_KEY(CFE_SB_TransmitMsg), UT_SoftwareBusSnapshotHook, &LongFmtSnapshotData); CFE_EVS_SendEvent(0, CFE_EVS_EventType_INFORMATION, "Long format check (SendEvent)"); @@ -780,7 +791,7 @@ void Test_Format(void) /* Test sending an event using a string length greater than * the maximum allowed */ - UT_InitData(); + UT_InitData_EVS(); for (i = 0; i <= CFE_MISSION_EVS_MAX_MESSAGE_LENGTH; i++) { @@ -812,7 +823,9 @@ void Test_Ports(void) { CFE_EVS_BitMaskCmd_t bitmaskcmd; UT_SoftwareBusSnapshot_Entry_t LocalSnapshotData = {.MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_LONG_EVENT_MSG_MID)}; + CFE_TIME_SysTime_t PacketTime; + memset(&PacketTime, 0, sizeof(PacketTime)); memset(&bitmaskcmd, 0, sizeof(bitmaskcmd)); UtPrintf("Begin Test Ports"); @@ -820,75 +833,77 @@ void Test_Ports(void) CFE_EVS_Global.EVS_TlmPkt.Payload.MessageFormatMode = CFE_EVS_MsgFormat_LONG; /* Test enabling all ports; reports implicitly via port output */ - UT_InitData(); + UT_InitData_EVS(); bitmaskcmd.Payload.BitMask = CFE_EVS_PORT1_BIT | CFE_EVS_PORT2_BIT | CFE_EVS_PORT3_BIT | CFE_EVS_PORT4_BIT; UT_EVS_DoDispatchCheckEvents(&bitmaskcmd, sizeof(bitmaskcmd), UT_TPID_CFE_EVS_CMD_ENABLE_PORTS_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ENAPORT_EID); /* Test that ports are enabled by sending a message */ - UT_InitData(); + UT_InitData_EVS(); UT_SetHookFunction(UT_KEY(CFE_SB_TransmitMsg), UT_SoftwareBusSnapshotHook, &LocalSnapshotData); - CFE_EVS_SendEvent(0, CFE_EVS_EventType_INFORMATION, "Test ports message"); + UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgTime), &PacketTime, sizeof(PacketTime), false); + UtAssert_UINT32_EQ(CFE_EVS_SendEvent(0, CFE_EVS_EventType_INFORMATION, "Test ports message"), CFE_SUCCESS); UtAssert_UINT32_EQ(LocalSnapshotData.Count, 1); + UtAssert_STUB_COUNT(CFE_TIME_Print, 1); /* Disable all ports to cut down on unneeded output */ - UT_InitData(); + UT_InitData_EVS(); bitmaskcmd.Payload.BitMask = CFE_EVS_PORT1_BIT | CFE_EVS_PORT2_BIT | CFE_EVS_PORT3_BIT | CFE_EVS_PORT4_BIT; UT_EVS_DoDispatchCheckEvents(&bitmaskcmd, sizeof(bitmaskcmd), UT_TPID_CFE_EVS_CMD_DISABLE_PORTS_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_DISPORT_EID); /* Test enabling a port using a bitmask that is out of range (high) */ - UT_InitData(); + UT_InitData_EVS(); bitmaskcmd.Payload.BitMask = 0xff; UT_EVS_DoDispatchCheckEvents(&bitmaskcmd, sizeof(bitmaskcmd), UT_TPID_CFE_EVS_CMD_ENABLE_PORTS_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_INVALID_BITMASK_EID); /* Test disabling a port using a bitmask that is out of range */ - UT_InitData(); + UT_InitData_EVS(); UT_EVS_DoDispatchCheckEvents(&bitmaskcmd, sizeof(bitmaskcmd), UT_TPID_CFE_EVS_CMD_DISABLE_PORTS_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_INVALID_BITMASK_EID); /* Test enabling a port using a bitmask that is out of range (low) */ - UT_InitData(); + UT_InitData_EVS(); bitmaskcmd.Payload.BitMask = 0x0; UT_EVS_DoDispatchCheckEvents(&bitmaskcmd, sizeof(bitmaskcmd), UT_TPID_CFE_EVS_CMD_ENABLE_PORTS_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_INVALID_BITMASK_EID); /* Test enabling a port 1 and 2, but not 3 and 4 (branch path coverage) */ - UT_InitData(); + UT_InitData_EVS(); bitmaskcmd.Payload.BitMask = CFE_EVS_PORT1_BIT | CFE_EVS_PORT2_BIT; UT_EVS_DoDispatchCheckEvents(&bitmaskcmd, sizeof(bitmaskcmd), UT_TPID_CFE_EVS_CMD_ENABLE_PORTS_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ENAPORT_EID); /* Test enabling a port 3 and 4, but not 1 and 2 (branch path coverage) */ - UT_InitData(); + UT_InitData_EVS(); bitmaskcmd.Payload.BitMask = CFE_EVS_PORT3_BIT | CFE_EVS_PORT4_BIT; UT_EVS_DoDispatchCheckEvents(&bitmaskcmd, sizeof(bitmaskcmd), UT_TPID_CFE_EVS_CMD_ENABLE_PORTS_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ENAPORT_EID); /* Test disabling a port using a bitmask that is out of range (low) */ - UT_InitData(); + UT_InitData_EVS(); bitmaskcmd.Payload.BitMask = 0x0; UT_EVS_DoDispatchCheckEvents(&bitmaskcmd, sizeof(bitmaskcmd), UT_TPID_CFE_EVS_CMD_DISABLE_PORTS_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_INVALID_BITMASK_EID); /* Test disabling a port 1 and 2, but not 3 and 4 (branch path coverage) */ - UT_InitData(); + UT_InitData_EVS(); bitmaskcmd.Payload.BitMask = CFE_EVS_PORT1_BIT | CFE_EVS_PORT2_BIT; UT_EVS_DoDispatchCheckEvents(&bitmaskcmd, sizeof(bitmaskcmd), UT_TPID_CFE_EVS_CMD_DISABLE_PORTS_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_DISPORT_EID); /* Test disabling a port 3 and 4, but not 1 and 2 (branch path coverage) */ - UT_InitData(); + UT_InitData_EVS(); bitmaskcmd.Payload.BitMask = CFE_EVS_PORT3_BIT | CFE_EVS_PORT4_BIT; UT_EVS_DoDispatchCheckEvents(&bitmaskcmd, sizeof(bitmaskcmd), UT_TPID_CFE_EVS_CMD_DISABLE_PORTS_CC, &UT_EVS_EventBuf); @@ -919,7 +934,7 @@ void Test_Logging(void) CFE_EVS_Global.EVS_TlmPkt.Payload.MessageFormatMode = CFE_EVS_MsgFormat_LONG; /* Initialize */ - UT_InitData(); + UT_InitData_EVS(); memset(&CmdBuf, 0, sizeof(CmdBuf)); /* Enable logging and set conditions to allow complete code coverage */ @@ -932,21 +947,21 @@ void Test_Logging(void) CFE_EVS_Global.EVS_LogPtr = &CFE_EVS_ResetDataPtr->EVS_Log; /* Test setting the logging mode using an invalid mode */ - UT_InitData(); + UT_InitData_EVS(); CmdBuf.modecmd.Payload.LogMode = 0xff; UT_EVS_DoDispatchCheckEvents(&CmdBuf.modecmd, sizeof(CmdBuf.modecmd), UT_TPID_CFE_EVS_CMD_SET_LOG_MODE_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_LOGMODE_EID); /* Test setting the logging mode to discard */ - UT_InitData(); + UT_InitData_EVS(); CmdBuf.modecmd.Payload.LogMode = CFE_EVS_LogMode_DISCARD; UT_EVS_DoDispatchCheckEvents(&CmdBuf.modecmd, sizeof(CmdBuf.modecmd), UT_TPID_CFE_EVS_CMD_SET_LOG_MODE_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_LOGMODE_EID); /* Test overfilling the log in discard mode */ - UT_InitData(); + UT_InitData_EVS(); UtAssert_VOIDCALL(EVS_ClearLog()); /* Ensure log is filled, then add one more, implicitly testing @@ -964,7 +979,7 @@ void Test_Logging(void) UtAssert_UINT32_EQ(CFE_EVS_Global.EVS_LogPtr->LogOverflowCounter, LogOverflowCounterExpected); /* Test setting the logging mode to overwrite */ - UT_InitData(); + UT_InitData_EVS(); CmdBuf.modecmd.Payload.LogMode = CFE_EVS_LogMode_OVERWRITE; UT_EVS_DoDispatchCheckEvents(&CmdBuf.modecmd, sizeof(CmdBuf.modecmd), UT_TPID_CFE_EVS_CMD_SET_LOG_MODE_CC, &UT_EVS_EventBuf); @@ -975,14 +990,14 @@ void Test_Logging(void) UtAssert_UINT32_EQ(CFE_EVS_Global.EVS_LogPtr->LogOverflowCounter, LogOverflowCounterExpected); /* Test sending a no op command */ - UT_InitData(); + UT_InitData_EVS(); memset(&CmdBuf, 0, sizeof(CmdBuf)); UT_EVS_DoDispatchCheckEvents(&CmdBuf.noopcmd, sizeof(CmdBuf.noopcmd), UT_TPID_CFE_EVS_CMD_NOOP_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_NOOP_EID); /* Clear log for next test */ - UT_InitData(); + UT_InitData_EVS(); CFE_EVS_Global.EVS_TlmPkt.Payload.LogEnabled = true; UT_EVS_DoDispatchCheckEvents(&CmdBuf.clearlogcmd, sizeof(CmdBuf.clearlogcmd), UT_TPID_CFE_EVS_CMD_CLEAR_LOG_CC, &UT_EVS_EventBuf); @@ -990,7 +1005,7 @@ void Test_Logging(void) UtAssert_UINT32_EQ(CFE_EVS_Global.EVS_LogPtr->LogOverflowCounter, 0); /* Test setting the logging mode to overwrite */ - UT_InitData(); + UT_InitData_EVS(); memset(&CmdBuf, 0, sizeof(CmdBuf)); UT_SetSizeofESResetArea(sizeof(CFE_ES_ResetData_t)); UT_SetDeferredRetcode(UT_KEY(OS_MutSemCreate), 1, OS_SUCCESS); @@ -1004,31 +1019,31 @@ void Test_Logging(void) /* Test successfully writing a single event log entry using the default * log name */ - UT_InitData(); + UT_InitData_EVS(); memset(&CmdBuf, 0, sizeof(CmdBuf)); UT_SetDeferredRetcode(UT_KEY(OS_MutSemCreate), 1, OS_SUCCESS); CmdBuf.logfilecmd.Payload.LogFilename[0] = '\0'; CFE_UtAssert_SUCCESS(CFE_EVS_WriteLogDataFileCmd(&CmdBuf.logfilecmd)); /* Test writing a log entry with a file name failure */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDeferredRetcode(UT_KEY(CFE_FS_ParseInputFileNameEx), 1, CFE_FS_INVALID_PATH); UtAssert_INT32_EQ(CFE_EVS_WriteLogDataFileCmd(&CmdBuf.logfilecmd), CFE_FS_INVALID_PATH); /* Test writing a log entry with a create failure */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDeferredRetcode(UT_KEY(OS_MutSemCreate), 1, OS_SUCCESS); UT_SetDefaultReturnValue(UT_KEY(OS_OpenCreate), OS_ERROR); UtAssert_INT32_EQ(CFE_EVS_WriteLogDataFileCmd(&CmdBuf.logfilecmd), CFE_STATUS_EXTERNAL_RESOURCE_FAIL); /* Test successfully writing all log entries */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDeferredRetcode(UT_KEY(OS_MutSemCreate), 1, OS_SUCCESS); CFE_EVS_Global.EVS_LogPtr->LogCount = CFE_PLATFORM_EVS_LOG_MAX; CFE_UtAssert_SUCCESS(CFE_EVS_WriteLogDataFileCmd(&CmdBuf.logfilecmd)); /* Test writing a log entry with a write failure */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDeferredRetcode(UT_KEY(OS_MutSemCreate), 1, OS_SUCCESS); UT_SetDefaultReturnValue(UT_KEY(OS_write), OS_ERROR); CFE_EVS_Global.EVS_LogPtr->LogCount = CFE_PLATFORM_EVS_LOG_MAX; @@ -1037,7 +1052,7 @@ void Test_Logging(void) /* Test successfully writing a single event log entry using a specified * log name */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDeferredRetcode(UT_KEY(OS_MutSemCreate), 1, OS_SUCCESS); strncpy(CmdBuf.logfilecmd.Payload.LogFilename, "LogFile", sizeof(CmdBuf.logfilecmd.Payload.LogFilename) - 1); CmdBuf.logfilecmd.Payload.LogFilename[sizeof(CmdBuf.logfilecmd.Payload.LogFilename) - 1] = '\0'; @@ -1046,7 +1061,7 @@ void Test_Logging(void) /* Test successfully writing a single event log entry with a failure * writing the header */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDeferredRetcode(UT_KEY(CFE_FS_WriteHeader), 1, sizeof(CFE_FS_Header_t) + 1); CmdBuf.logfilecmd.Payload.LogFilename[0] = '\0'; UtAssert_INT32_EQ(CFE_EVS_WriteLogDataFileCmd(&CmdBuf.logfilecmd), CFE_EVS_FILE_WRITE_ERROR); @@ -1069,7 +1084,7 @@ void Test_WriteApp(void) CFE_EVS_Global.EVS_TlmPkt.Payload.MessageFormatMode = CFE_EVS_MsgFormat_LONG; /* Enable DEBUG message output */ - UT_InitData(); + UT_InitData_EVS(); memset(&CmdBuf, 0, sizeof(CmdBuf)); strncpy(CmdBuf.appbitcmd.Payload.AppName, "ut_cfe_evs", sizeof(CmdBuf.appbitcmd.Payload.AppName) - 1); CmdBuf.appbitcmd.Payload.AppName[sizeof(CmdBuf.appbitcmd.Payload.AppName) - 1] = '\0'; @@ -1080,7 +1095,7 @@ void Test_WriteApp(void) UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ENAAPPEVTTYPE_EID); /* Test resetting counters */ - UT_InitData(); + UT_InitData_EVS(); UT_EVS_DoDispatchCheckEvents(&CmdBuf.ResetCountersCmd, sizeof(CmdBuf.ResetCountersCmd), UT_TPID_CFE_EVS_CMD_RESET_COUNTERS_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_RSTCNT_EID); @@ -1088,7 +1103,7 @@ void Test_WriteApp(void) /* Test writing application data with a create failure using default * file name */ - UT_InitData(); + UT_InitData_EVS(); strncpy(CmdBuf.AppDataCmd.Payload.AppDataFilename, "ut_cfe_evs", sizeof(CmdBuf.AppDataCmd.Payload.AppDataFilename) - 1); CmdBuf.AppDataCmd.Payload.AppDataFilename[sizeof(CmdBuf.AppDataCmd.Payload.AppDataFilename) - 1] = '\0'; @@ -1098,14 +1113,14 @@ void Test_WriteApp(void) UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_CRDATFILE_EID); /* Test writing application data with bad file name */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDeferredRetcode(UT_KEY(CFE_FS_ParseInputFileNameEx), 1, CFE_FS_INVALID_PATH); UT_EVS_DoDispatchCheckEvents(&CmdBuf.AppDataCmd, sizeof(CmdBuf.AppDataCmd), UT_TPID_CFE_EVS_CMD_WRITE_APP_DATA_FILE_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_CRDATFILE_EID); /* Test writing application data with a write/close failure */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDefaultReturnValue(UT_KEY(OS_write), OS_ERROR); UT_SetDefaultReturnValue(UT_KEY(OS_close), OS_ERROR); UT_EVS_DoDispatchCheckEvents(&CmdBuf.AppDataCmd, sizeof(CmdBuf.AppDataCmd), @@ -1113,7 +1128,7 @@ void Test_WriteApp(void) UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_WRDATFILE_EID); /* Test successfully writing application data */ - UT_InitData(); + UT_InitData_EVS(); UT_EVS_DoDispatchCheckEvents(&CmdBuf.AppDataCmd, sizeof(CmdBuf.AppDataCmd), UT_TPID_CFE_EVS_CMD_WRITE_APP_DATA_FILE_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_WRDAT_EID); @@ -1121,7 +1136,7 @@ void Test_WriteApp(void) /* Test writing application data with a create failure using specified * file name */ - UT_InitData(); + UT_InitData_EVS(); strncpy(CmdBuf.AppDataCmd.Payload.AppDataFilename, "AppDataFileName", sizeof(CmdBuf.AppDataCmd.Payload.AppDataFilename) - 1); CmdBuf.AppDataCmd.Payload.AppDataFilename[sizeof(CmdBuf.AppDataCmd.Payload.AppDataFilename) - 1] = '\0'; @@ -1131,7 +1146,7 @@ void Test_WriteApp(void) UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_CRDATFILE_EID); /* Test writing application data with a failure writing the header */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDeferredRetcode(UT_KEY(CFE_FS_WriteHeader), 1, sizeof(CFE_FS_Header_t) + 1); CmdBuf.AppDataCmd.Payload.AppDataFilename[0] = '\0'; UtAssert_INT32_EQ(CFE_EVS_WriteAppDataFileCmd(&CmdBuf.AppDataCmd), CFE_EVS_FILE_WRITE_ERROR); @@ -1152,7 +1167,7 @@ void Test_BadAppCmd(void) CFE_EVS_Global.EVS_TlmPkt.Payload.MessageFormatMode = CFE_EVS_MsgFormat_LONG; - UT_InitData(); + UT_InitData_EVS(); /* Set up event and mask */ appbitcmd.Payload.BitMask = 0; @@ -1176,21 +1191,21 @@ void Test_BadAppCmd(void) UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_NOAPPIDFOUND_EID); /* Test enabling application event types with an unknown application ID */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDefaultReturnValue(UT_KEY(CFE_ES_GetAppIDByName), CFE_ES_ERR_NAME_NOT_FOUND); UT_EVS_DoDispatchCheckEvents(&appbitcmd, sizeof(appbitcmd), UT_TPID_CFE_EVS_CMD_ENABLE_APP_EVENT_TYPE_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_NOAPPIDFOUND_EID); /* Test disabling application events with an unknown application ID */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDefaultReturnValue(UT_KEY(CFE_ES_GetAppIDByName), CFE_ES_ERR_NAME_NOT_FOUND); UT_EVS_DoDispatchCheckEvents(&appnamecmd, sizeof(appnamecmd), UT_TPID_CFE_EVS_CMD_DISABLE_APP_EVENTS_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_NOAPPIDFOUND_EID); /* Test enabling application events with an unknown application ID */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDefaultReturnValue(UT_KEY(CFE_ES_GetAppIDByName), CFE_ES_ERR_NAME_NOT_FOUND); UT_EVS_DoDispatchCheckEvents(&appnamecmd, sizeof(appnamecmd), UT_TPID_CFE_EVS_CMD_ENABLE_APP_EVENTS_CC, &UT_EVS_EventBuf); @@ -1199,47 +1214,47 @@ void Test_BadAppCmd(void) /* Test resetting the application event counter with an unknown * application ID */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDefaultReturnValue(UT_KEY(CFE_ES_GetAppIDByName), CFE_ES_ERR_NAME_NOT_FOUND); UT_EVS_DoDispatchCheckEvents(&appnamecmd, sizeof(appnamecmd), UT_TPID_CFE_EVS_CMD_RESET_APP_COUNTER_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_NOAPPIDFOUND_EID); /* Test modifying event filters with an unknown application ID */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDefaultReturnValue(UT_KEY(CFE_ES_GetAppIDByName), CFE_ES_ERR_NAME_NOT_FOUND); UT_EVS_DoDispatchCheckEvents(&appmaskcmd, sizeof(appmaskcmd), UT_TPID_CFE_EVS_CMD_ADD_EVENT_FILTER_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_NOAPPIDFOUND_EID); /* Test deleting event filters with an unknown application ID */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDefaultReturnValue(UT_KEY(CFE_ES_GetAppIDByName), CFE_ES_ERR_NAME_NOT_FOUND); UT_EVS_DoDispatchCheckEvents(&appcmdcmd, sizeof(appcmdcmd), UT_TPID_CFE_EVS_CMD_DELETE_EVENT_FILTER_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_NOAPPIDFOUND_EID); /* Test setting the event filter mask with an unknown application ID */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDefaultReturnValue(UT_KEY(CFE_ES_GetAppIDByName), CFE_ES_ERR_NAME_NOT_FOUND); UT_EVS_DoDispatchCheckEvents(&appmaskcmd, sizeof(appmaskcmd), UT_TPID_CFE_EVS_CMD_SET_FILTER_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_NOAPPIDFOUND_EID); /* Test resetting the filter with an unknown application ID */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDefaultReturnValue(UT_KEY(CFE_ES_GetAppIDByName), CFE_ES_ERR_NAME_NOT_FOUND); UT_EVS_DoDispatchCheckEvents(&appcmdcmd, sizeof(appcmdcmd), UT_TPID_CFE_EVS_CMD_RESET_FILTER_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_NOAPPIDFOUND_EID); /* Test resetting all filters with an unknown application ID */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDefaultReturnValue(UT_KEY(CFE_ES_GetAppIDByName), CFE_ES_ERR_NAME_NOT_FOUND); UT_EVS_DoDispatchCheckEvents(&appnamecmd, sizeof(appnamecmd), UT_TPID_CFE_EVS_CMD_RESET_ALL_FILTERS_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_NOAPPIDFOUND_EID); /* Test disabling application event types with an illegal application ID */ - UT_InitData(); + UT_InitData_EVS(); strncpy(appbitcmd.Payload.AppName, "illegal_id", sizeof(appbitcmd.Payload.AppName) - 1); appbitcmd.Payload.AppName[sizeof(appbitcmd.Payload.AppName) - 1] = '\0'; strncpy(appnamecmd.Payload.AppName, "illegal_id", sizeof(appnamecmd.Payload.AppName) - 1); @@ -1259,21 +1274,21 @@ void Test_BadAppCmd(void) UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_ILLAPPIDRANGE_EID); /* Test enabling application event types with an illegal application ID */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_AppID_ToIndex), 1, CFE_ES_ERR_RESOURCEID_NOT_VALID); UT_EVS_DoDispatchCheckEvents(&appbitcmd, sizeof(appbitcmd), UT_TPID_CFE_EVS_CMD_ENABLE_APP_EVENT_TYPE_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_ILLAPPIDRANGE_EID); /* Test disabling application events with an illegal application ID */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_AppID_ToIndex), 1, CFE_ES_ERR_RESOURCEID_NOT_VALID); UT_EVS_DoDispatchCheckEvents(&appnamecmd, sizeof(appnamecmd), UT_TPID_CFE_EVS_CMD_DISABLE_APP_EVENTS_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_ILLAPPIDRANGE_EID); /* Test enabling application events with an illegal application ID */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_AppID_ToIndex), 1, CFE_ES_ERR_RESOURCEID_NOT_VALID); UT_EVS_DoDispatchCheckEvents(&appnamecmd, sizeof(appnamecmd), UT_TPID_CFE_EVS_CMD_ENABLE_APP_EVENTS_CC, &UT_EVS_EventBuf); @@ -1282,40 +1297,40 @@ void Test_BadAppCmd(void) /* Test resetting the application event counter with an illegal * application ID */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_AppID_ToIndex), 1, CFE_ES_ERR_RESOURCEID_NOT_VALID); UT_EVS_DoDispatchCheckEvents(&appnamecmd, sizeof(appnamecmd), UT_TPID_CFE_EVS_CMD_RESET_APP_COUNTER_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_ILLAPPIDRANGE_EID); /* Test adding the event filter with an illegal application ID */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_AppID_ToIndex), 1, CFE_ES_ERR_RESOURCEID_NOT_VALID); UT_EVS_DoDispatchCheckEvents(&appmaskcmd, sizeof(appmaskcmd), UT_TPID_CFE_EVS_CMD_ADD_EVENT_FILTER_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_ILLAPPIDRANGE_EID); /* Test deleting the event filter with an illegal application ID */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_AppID_ToIndex), 1, CFE_ES_ERR_RESOURCEID_NOT_VALID); UT_EVS_DoDispatchCheckEvents(&appcmdcmd, sizeof(appcmdcmd), UT_TPID_CFE_EVS_CMD_DELETE_EVENT_FILTER_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_ILLAPPIDRANGE_EID); /* Test setting the filter mask with an illegal application ID */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_AppID_ToIndex), 1, CFE_ES_ERR_RESOURCEID_NOT_VALID); UT_EVS_DoDispatchCheckEvents(&appmaskcmd, sizeof(appmaskcmd), UT_TPID_CFE_EVS_CMD_SET_FILTER_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_ILLAPPIDRANGE_EID); /* Test resetting the filter with an illegal application ID */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_AppID_ToIndex), 1, CFE_ES_ERR_RESOURCEID_NOT_VALID); UT_EVS_DoDispatchCheckEvents(&appcmdcmd, sizeof(appcmdcmd), UT_TPID_CFE_EVS_CMD_RESET_FILTER_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_ILLAPPIDRANGE_EID); /* Test resetting all filters with an illegal application ID */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_AppID_ToIndex), 1, CFE_ES_ERR_RESOURCEID_NOT_VALID); UT_EVS_DoDispatchCheckEvents(&appnamecmd, sizeof(appnamecmd), UT_TPID_CFE_EVS_CMD_RESET_ALL_FILTERS_CC, &UT_EVS_EventBuf); @@ -1324,7 +1339,7 @@ void Test_BadAppCmd(void) /* Test disabling application event types with an unregistered * application ID */ - UT_InitData(); + UT_InitData_EVS(); TestAppIndex = 2; UT_SetDataBuffer(UT_KEY(CFE_ES_AppID_ToIndex), &TestAppIndex, sizeof(TestAppIndex), false); strncpy(appbitcmd.Payload.AppName, "unregistered_app", sizeof(appbitcmd.Payload.AppName) - 1); @@ -1342,21 +1357,21 @@ void Test_BadAppCmd(void) /* Test enabling application event types with an unregistered * application ID */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDataBuffer(UT_KEY(CFE_ES_AppID_ToIndex), &TestAppIndex, sizeof(TestAppIndex), false); UT_EVS_DoDispatchCheckEvents(&appbitcmd, sizeof(appbitcmd), UT_TPID_CFE_EVS_CMD_ENABLE_APP_EVENT_TYPE_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_APPNOREGS_EID); /* Test disabling application events with an unregistered application ID */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDataBuffer(UT_KEY(CFE_ES_AppID_ToIndex), &TestAppIndex, sizeof(TestAppIndex), false); UT_EVS_DoDispatchCheckEvents(&appnamecmd, sizeof(appnamecmd), UT_TPID_CFE_EVS_CMD_DISABLE_APP_EVENTS_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_APPNOREGS_EID); /* Test enabling application events with an unregistered application ID */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDataBuffer(UT_KEY(CFE_ES_AppID_ToIndex), &TestAppIndex, sizeof(TestAppIndex), false); UT_EVS_DoDispatchCheckEvents(&appnamecmd, sizeof(appnamecmd), UT_TPID_CFE_EVS_CMD_ENABLE_APP_EVENTS_CC, &UT_EVS_EventBuf); @@ -1365,40 +1380,40 @@ void Test_BadAppCmd(void) /* Test resetting the application event counter with an unregistered * application ID */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDataBuffer(UT_KEY(CFE_ES_AppID_ToIndex), &TestAppIndex, sizeof(TestAppIndex), false); UT_EVS_DoDispatchCheckEvents(&appnamecmd, sizeof(appnamecmd), UT_TPID_CFE_EVS_CMD_RESET_APP_COUNTER_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_APPNOREGS_EID); /* Test adding the event filter with an unregistered application ID */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDataBuffer(UT_KEY(CFE_ES_AppID_ToIndex), &TestAppIndex, sizeof(TestAppIndex), false); UT_EVS_DoDispatchCheckEvents(&appmaskcmd, sizeof(appmaskcmd), UT_TPID_CFE_EVS_CMD_ADD_EVENT_FILTER_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_APPNOREGS_EID); /* Test deleting the event filter with an unregistered application ID */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDataBuffer(UT_KEY(CFE_ES_AppID_ToIndex), &TestAppIndex, sizeof(TestAppIndex), false); UT_EVS_DoDispatchCheckEvents(&appcmdcmd, sizeof(appcmdcmd), UT_TPID_CFE_EVS_CMD_DELETE_EVENT_FILTER_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_APPNOREGS_EID); /* Test setting the filter mask with an unregistered application ID */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDataBuffer(UT_KEY(CFE_ES_AppID_ToIndex), &TestAppIndex, sizeof(TestAppIndex), false); UT_EVS_DoDispatchCheckEvents(&appmaskcmd, sizeof(appmaskcmd), UT_TPID_CFE_EVS_CMD_SET_FILTER_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_APPNOREGS_EID); /* Test resetting the filter with an unregistered application ID */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDataBuffer(UT_KEY(CFE_ES_AppID_ToIndex), &TestAppIndex, sizeof(TestAppIndex), false); UT_EVS_DoDispatchCheckEvents(&appcmdcmd, sizeof(appcmdcmd), UT_TPID_CFE_EVS_CMD_RESET_FILTER_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_APPNOREGS_EID); /* Test resetting all filters with an unregistered application ID */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDataBuffer(UT_KEY(CFE_ES_AppID_ToIndex), &TestAppIndex, sizeof(TestAppIndex), false); UT_EVS_DoDispatchCheckEvents(&appnamecmd, sizeof(appnamecmd), UT_TPID_CFE_EVS_CMD_RESET_ALL_FILTERS_CC, &UT_EVS_EventBuf); @@ -1422,7 +1437,7 @@ void Test_EventCmd(void) CFE_EVS_Global.EVS_TlmPkt.Payload.MessageFormatMode = CFE_EVS_MsgFormat_LONG; - UT_InitData(); + UT_InitData_EVS(); /* Run the next series of tests with valid, registered application name */ strncpy(appbitcmd.Payload.AppName, "ut_cfe_evs", sizeof(appbitcmd.Payload.AppName) - 1); @@ -1452,7 +1467,7 @@ void Test_EventCmd(void) UtAssert_ZERO(EventCount[3]); /* Test enabling of all events */ - UT_InitData(); + UT_InitData_EVS(); LocalSnapshotData.Count = 0; UT_EVS_DoDispatchCheckEvents(&appbitcmd, sizeof(appbitcmd), UT_TPID_CFE_EVS_CMD_ENABLE_APP_EVENT_TYPE_CC, &UT_EVS_EventBuf); @@ -1472,7 +1487,7 @@ void Test_EventCmd(void) UtAssert_UINT32_EQ(EventCount[3], 4); /* Test disabling event type using an illegal type */ - UT_InitData(); + UT_InitData_EVS(); appbitcmd.Payload.BitMask = 0xff; UT_EVS_DoDispatchCheckEvents(&appbitcmd, sizeof(appbitcmd), UT_TPID_CFE_EVS_CMD_DISABLE_APP_EVENT_TYPE_CC, &UT_EVS_EventBuf); @@ -1480,51 +1495,51 @@ void Test_EventCmd(void) UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_INVALID_BITMASK_EID); /* Test enabling event type using an illegal type */ - UT_InitData(); + UT_InitData_EVS(); UT_EVS_DoDispatchCheckEvents(&appbitcmd, sizeof(appbitcmd), UT_TPID_CFE_EVS_CMD_ENABLE_APP_EVENT_TYPE_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_INVALID_BITMASK_EID); /* Test successful disabling of application events */ - UT_InitData(); + UT_InitData_EVS(); UT_EVS_DoDispatchCheckEvents(&appnamecmd, sizeof(appnamecmd), UT_TPID_CFE_EVS_CMD_DISABLE_APP_EVENTS_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, 0xFFFF); /* Test successful enabling of application events */ - UT_InitData(); + UT_InitData_EVS(); UT_EVS_DoDispatchCheckEvents(&appnamecmd, sizeof(appnamecmd), UT_TPID_CFE_EVS_CMD_ENABLE_APP_EVENTS_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ENAAPPEVT_EID); /* Test disabling event types (leave debug enabled) */ - UT_InitData(); + UT_InitData_EVS(); bitmaskcmd.Payload.BitMask = CFE_EVS_INFORMATION_BIT | CFE_EVS_ERROR_BIT | CFE_EVS_CRITICAL_BIT; UT_EVS_DoDispatchCheckEvents(&bitmaskcmd, sizeof(bitmaskcmd), UT_TPID_CFE_EVS_CMD_DISABLE_EVENT_TYPE_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_DISEVTTYPE_EID); /* Test enabling all event types (debug already enabled) */ - UT_InitData(); + UT_InitData_EVS(); UT_EVS_DoDispatchCheckEvents(&bitmaskcmd, sizeof(bitmaskcmd), UT_TPID_CFE_EVS_CMD_ENABLE_EVENT_TYPE_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ENAEVTTYPE_EID); /* Test successfully resetting the application event counter */ - UT_InitData(); + UT_InitData_EVS(); UT_EVS_DoDispatchCheckEvents(&appnamecmd, sizeof(appnamecmd), UT_TPID_CFE_EVS_CMD_RESET_APP_COUNTER_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_RSTEVTCNT_EID); /* Test disabling an event type using an out of range bit mask (high) */ - UT_InitData(); + UT_InitData_EVS(); bitmaskcmd.Payload.BitMask = 0xff; UT_EVS_DoDispatchCheckEvents(&bitmaskcmd, sizeof(bitmaskcmd), UT_TPID_CFE_EVS_CMD_DISABLE_EVENT_TYPE_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_INVALID_BITMASK_EID); /* Test enabling an event type using an out of range bit mask (high) */ - UT_InitData(); + UT_InitData_EVS(); bitmaskcmd.Payload.BitMask = 0xff; UT_EVS_DoDispatchCheckEvents(&bitmaskcmd, sizeof(bitmaskcmd), UT_TPID_CFE_EVS_CMD_ENABLE_EVENT_TYPE_CC, &UT_EVS_EventBuf); @@ -1533,7 +1548,7 @@ void Test_EventCmd(void) /* Test disabling an application event type using an out of * range bit mask (high) */ - UT_InitData(); + UT_InitData_EVS(); appbitcmd.Payload.BitMask = 0xff; UT_EVS_DoDispatchCheckEvents(&appbitcmd, sizeof(appbitcmd), UT_TPID_CFE_EVS_CMD_DISABLE_APP_EVENT_TYPE_CC, &UT_EVS_EventBuf); @@ -1542,21 +1557,21 @@ void Test_EventCmd(void) /* Test enabling an application event type using an out of * range bit mask (high) */ - UT_InitData(); + UT_InitData_EVS(); appbitcmd.Payload.BitMask = 0xff; UT_EVS_DoDispatchCheckEvents(&appbitcmd, sizeof(appbitcmd), UT_TPID_CFE_EVS_CMD_ENABLE_APP_EVENT_TYPE_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_INVALID_BITMASK_EID); /* Test disabling an event type using an out of range bit mask (low) */ - UT_InitData(); + UT_InitData_EVS(); bitmaskcmd.Payload.BitMask = 0x0; UT_EVS_DoDispatchCheckEvents(&bitmaskcmd, sizeof(bitmaskcmd), UT_TPID_CFE_EVS_CMD_DISABLE_EVENT_TYPE_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_INVALID_BITMASK_EID); /* Test enabling an event type using an out of range bit mask (low) */ - UT_InitData(); + UT_InitData_EVS(); bitmaskcmd.Payload.BitMask = 0x0; UT_EVS_DoDispatchCheckEvents(&bitmaskcmd, sizeof(bitmaskcmd), UT_TPID_CFE_EVS_CMD_ENABLE_EVENT_TYPE_CC, &UT_EVS_EventBuf); @@ -1565,7 +1580,7 @@ void Test_EventCmd(void) /* Test disabling an application event type using an out of * range bit mask (low) */ - UT_InitData(); + UT_InitData_EVS(); appbitcmd.Payload.BitMask = 0x0; UT_EVS_DoDispatchCheckEvents(&appbitcmd, sizeof(appbitcmd), UT_TPID_CFE_EVS_CMD_DISABLE_APP_EVENT_TYPE_CC, &UT_EVS_EventBuf); @@ -1574,7 +1589,7 @@ void Test_EventCmd(void) /* Test enabling an application event type using an out of * range bit mask (low) */ - UT_InitData(); + UT_InitData_EVS(); appbitcmd.Payload.BitMask = 0x0; UT_EVS_DoDispatchCheckEvents(&appbitcmd, sizeof(appbitcmd), UT_TPID_CFE_EVS_CMD_ENABLE_APP_EVENT_TYPE_CC, &UT_EVS_EventBuf); @@ -1596,7 +1611,7 @@ void Test_FilterCmd(void) CFE_EVS_Global.EVS_TlmPkt.Payload.MessageFormatMode = CFE_EVS_MsgFormat_LONG; - UT_InitData(); + UT_InitData_EVS(); /* Set up event and mask */ appmaskcmd.Payload.Mask = 0; @@ -1620,7 +1635,7 @@ void Test_FilterCmd(void) UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ENAAPPEVTTYPE_EID); /* Ensure there is no filter for the next tests */ - UT_InitData(); + UT_InitData_EVS(); UT_EVS_DoDispatchCheckEvents(&appcmdcmd, sizeof(appcmdcmd), UT_TPID_CFE_EVS_CMD_DELETE_EVENT_FILTER_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_EVTIDNOREGS_EID); @@ -1628,25 +1643,25 @@ void Test_FilterCmd(void) /* Test setting a filter with an application that is not registered * for filtering */ - UT_InitData(); + UT_InitData_EVS(); UT_EVS_DoDispatchCheckEvents(&appmaskcmd, sizeof(appmaskcmd), UT_TPID_CFE_EVS_CMD_SET_FILTER_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_EVTIDNOREGS_EID); /* Test resetting a filter with an application that is not registered * for filtering */ - UT_InitData(); + UT_InitData_EVS(); UT_EVS_DoDispatchCheckEvents(&appcmdcmd, sizeof(appcmdcmd), UT_TPID_CFE_EVS_CMD_RESET_FILTER_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_EVTIDNOREGS_EID); /* Test resetting all filters */ - UT_InitData(); + UT_InitData_EVS(); UT_EVS_DoDispatchCheckEvents(&appnamecmd, sizeof(appnamecmd), UT_TPID_CFE_EVS_CMD_RESET_ALL_FILTERS_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_RSTALLFILTER_EID); /* Test successfully adding an event filter */ - UT_InitData(); + UT_InitData_EVS(); UT_EVS_DoDispatchCheckEvents(&appmaskcmd, sizeof(appmaskcmd), UT_TPID_CFE_EVS_CMD_ADD_EVENT_FILTER_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ADDFILTER_EID); @@ -1654,35 +1669,35 @@ void Test_FilterCmd(void) /* Test adding an event filter to an event already registered * for filtering */ - UT_InitData(); + UT_InitData_EVS(); UT_EVS_DoDispatchCheckEvents(&appmaskcmd, sizeof(appmaskcmd), UT_TPID_CFE_EVS_CMD_ADD_EVENT_FILTER_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_EVT_FILTERED_EID); /* Test successfully setting a filter mask */ - UT_InitData(); + UT_InitData_EVS(); UT_EVS_DoDispatchCheckEvents(&appmaskcmd, sizeof(appmaskcmd), UT_TPID_CFE_EVS_CMD_SET_FILTER_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_SETFILTERMSK_EID); /* Test successfully resetting a filter mask */ - UT_InitData(); + UT_InitData_EVS(); UT_EVS_DoDispatchCheckEvents(&appcmdcmd, sizeof(appcmdcmd), UT_TPID_CFE_EVS_CMD_RESET_FILTER_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_RSTFILTER_EID); /* Test successfully resetting all filters */ - UT_InitData(); + UT_InitData_EVS(); UT_EVS_DoDispatchCheckEvents(&appnamecmd, sizeof(appnamecmd), UT_TPID_CFE_EVS_CMD_RESET_ALL_FILTERS_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_RSTALLFILTER_EID); /* Test successfully deleting an event filter */ - UT_InitData(); + UT_InitData_EVS(); UT_EVS_DoDispatchCheckEvents(&appcmdcmd, sizeof(appcmdcmd), UT_TPID_CFE_EVS_CMD_DELETE_EVENT_FILTER_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_DELFILTER_EID); /* Test filling the event filters */ - UT_InitData(); + UT_InitData_EVS(); UT_EVS_EventBuf.Count = 0; for (i = 0; i < CFE_PLATFORM_EVS_MAX_EVENT_FILTERS; i++) @@ -1696,43 +1711,43 @@ void Test_FilterCmd(void) UtAssert_UINT32_EQ(UT_EVS_EventBuf.Count, CFE_PLATFORM_EVS_MAX_EVENT_FILTERS); /* Test overfilling the event filters */ - UT_InitData(); + UT_InitData_EVS(); UT_EVS_DoDispatchCheckEvents(&appmaskcmd, sizeof(appmaskcmd), UT_TPID_CFE_EVS_CMD_ADD_EVENT_FILTER_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_MAXREGSFILTER_EID); /* Return application to original state, re-register application */ - UT_InitData(); + UT_InitData_EVS(); appmaskcmd.Payload.EventID = 0; CFE_UtAssert_SUCCESS(CFE_EVS_Register(NULL, 0, CFE_EVS_EventFilter_BINARY)); /* Enable all application event message output */ - UT_InitData(); + UT_InitData_EVS(); appbitcmd.Payload.BitMask = CFE_EVS_DEBUG_BIT | CFE_EVS_INFORMATION_BIT | CFE_EVS_ERROR_BIT | CFE_EVS_CRITICAL_BIT; UT_EVS_DoDispatchCheckEvents(&appbitcmd, sizeof(appbitcmd), UT_TPID_CFE_EVS_CMD_ENABLE_APP_EVENT_TYPE_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ENAAPPEVTTYPE_EID); /* Set-up to test filtering the same event twice */ - UT_InitData(); + UT_InitData_EVS(); UT_EVS_DoDispatchCheckEvents(&appmaskcmd, sizeof(appmaskcmd), UT_TPID_CFE_EVS_CMD_ADD_EVENT_FILTER_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ADDFILTER_EID); /* Test filtering the same event again */ - UT_InitData(); + UT_InitData_EVS(); UT_EVS_DoDispatchCheckEvents(&appmaskcmd, sizeof(appmaskcmd), UT_TPID_CFE_EVS_CMD_ADD_EVENT_FILTER_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_EVT_FILTERED_EID); /* Test successful event filter deletion */ - UT_InitData(); + UT_InitData_EVS(); UT_EVS_DoDispatchCheckEvents(&appcmdcmd, sizeof(appcmdcmd), UT_TPID_CFE_EVS_CMD_DELETE_EVENT_FILTER_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_DELFILTER_EID); /* Return application to original state, re-register application */ - UT_InitData(); + UT_InitData_EVS(); CFE_UtAssert_SUCCESS(CFE_EVS_Register(NULL, 0, CFE_EVS_EventFilter_BINARY)); } @@ -1748,122 +1763,122 @@ void Test_InvalidCmd(void) UtPrintf("Begin Test Invalid Command"); /* Test invalid msg id event */ - UT_InitData(); + UT_InitData_EVS(); UT_EVS_DoDispatchCheckEvents(&cmd, sizeof(cmd), UT_TPID_CFE_EVS_INVALID_MID, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_MSGID_EID); /* Test invalid command code event */ - UT_InitData(); + UT_InitData_EVS(); UT_EVS_DoDispatchCheckEvents(&cmd, sizeof(cmd), UT_TPID_CFE_EVS_CMD_INVALID_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_CC_EID); /* Test invalid command length event */ - UT_InitData(); + UT_InitData_EVS(); UT_EVS_DoDispatchCheckEvents(&cmd, 0, UT_TPID_CFE_EVS_CMD_NOOP_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_LEN_ERR_EID); /* Test invalid command length with reset counters command */ - UT_InitData(); + UT_InitData_EVS(); UT_EVS_DoDispatchCheckEvents(&cmd, 0, UT_TPID_CFE_EVS_CMD_RESET_COUNTERS_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_LEN_ERR_EID); /* Test invalid command length with enable event type command */ - UT_InitData(); + UT_InitData_EVS(); UT_EVS_DoDispatchCheckEvents(&cmd, 0, UT_TPID_CFE_EVS_CMD_ENABLE_EVENT_TYPE_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_LEN_ERR_EID); /* Test invalid command length with disable event type command */ - UT_InitData(); + UT_InitData_EVS(); UT_EVS_DoDispatchCheckEvents(&cmd, 0, UT_TPID_CFE_EVS_CMD_DISABLE_EVENT_TYPE_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_LEN_ERR_EID); /* Test invalid command length with set event format mode command */ - UT_InitData(); + UT_InitData_EVS(); UT_EVS_DoDispatchCheckEvents(&cmd, 0, UT_TPID_CFE_EVS_CMD_SET_EVENT_FORMAT_MODE_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_LEN_ERR_EID); /* Test invalid command length with enable application event * type command */ - UT_InitData(); + UT_InitData_EVS(); UT_EVS_DoDispatchCheckEvents(&cmd, 0, UT_TPID_CFE_EVS_CMD_ENABLE_APP_EVENT_TYPE_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_LEN_ERR_EID); /* Test invalid command length with disable application event * type command */ - UT_InitData(); + UT_InitData_EVS(); UT_EVS_DoDispatchCheckEvents(&cmd, 0, UT_TPID_CFE_EVS_CMD_DISABLE_APP_EVENT_TYPE_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_LEN_ERR_EID); /* Test invalid command length with enable application events command */ - UT_InitData(); + UT_InitData_EVS(); UT_EVS_DoDispatchCheckEvents(&cmd, 0, UT_TPID_CFE_EVS_CMD_ENABLE_APP_EVENTS_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_LEN_ERR_EID); /* Test invalid command length with disable application events command */ - UT_InitData(); + UT_InitData_EVS(); UT_EVS_DoDispatchCheckEvents(&cmd, 0, UT_TPID_CFE_EVS_CMD_DISABLE_APP_EVENTS_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_LEN_ERR_EID); /* Test invalid command length with reset application counter command */ - UT_InitData(); + UT_InitData_EVS(); UT_EVS_DoDispatchCheckEvents(&cmd, 0, UT_TPID_CFE_EVS_CMD_RESET_APP_COUNTER_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_LEN_ERR_EID); /* Test invalid command length with set filter command */ - UT_InitData(); + UT_InitData_EVS(); UT_EVS_DoDispatchCheckEvents(&cmd, 0, UT_TPID_CFE_EVS_CMD_SET_FILTER_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_LEN_ERR_EID); /* Test invalid command length with enable ports command */ - UT_InitData(); + UT_InitData_EVS(); UT_EVS_DoDispatchCheckEvents(&cmd, 0, UT_TPID_CFE_EVS_CMD_ENABLE_PORTS_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_LEN_ERR_EID); /* Test invalid command length with disable ports command */ - UT_InitData(); + UT_InitData_EVS(); UT_EVS_DoDispatchCheckEvents(&cmd, 0, UT_TPID_CFE_EVS_CMD_DISABLE_PORTS_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_LEN_ERR_EID); /* Test invalid command length with reset filter command */ - UT_InitData(); + UT_InitData_EVS(); UT_EVS_DoDispatchCheckEvents(&cmd, 0, UT_TPID_CFE_EVS_CMD_RESET_FILTER_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_LEN_ERR_EID); /* Test invalid command length with reset all filters command */ - UT_InitData(); + UT_InitData_EVS(); UT_EVS_DoDispatchCheckEvents(&cmd, 0, UT_TPID_CFE_EVS_CMD_RESET_ALL_FILTERS_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_LEN_ERR_EID); /* Test invalid command length with add event filter command */ - UT_InitData(); + UT_InitData_EVS(); UT_EVS_DoDispatchCheckEvents(&cmd, 0, UT_TPID_CFE_EVS_CMD_ADD_EVENT_FILTER_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_LEN_ERR_EID); /* Test invalid command length with delete event filter command */ - UT_InitData(); + UT_InitData_EVS(); UT_EVS_DoDispatchCheckEvents(&cmd, 0, UT_TPID_CFE_EVS_CMD_DELETE_EVENT_FILTER_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_LEN_ERR_EID); /* Test invalid command length with write application data command */ - UT_InitData(); + UT_InitData_EVS(); UT_EVS_DoDispatchCheckEvents(&cmd, 0, UT_TPID_CFE_EVS_CMD_WRITE_APP_DATA_FILE_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_LEN_ERR_EID); /* Test invalid command length with write log data command */ - UT_InitData(); + UT_InitData_EVS(); CFE_EVS_Global.EVS_TlmPkt.Payload.LogEnabled = true; UT_EVS_DoDispatchCheckEvents(&cmd, 0, UT_TPID_CFE_EVS_CMD_WRITE_LOG_DATA_FILE_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_LEN_ERR_EID); /* Test invalid command length with set log mode command */ - UT_InitData(); + UT_InitData_EVS(); UT_EVS_DoDispatchCheckEvents(&cmd, 0, UT_TPID_CFE_EVS_CMD_SET_LOG_MODE_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_LEN_ERR_EID); /* Test invalid command length with clear log command */ - UT_InitData(); + UT_InitData_EVS(); UT_EVS_DoDispatchCheckEvents(&cmd, 0, UT_TPID_CFE_EVS_CMD_CLEAR_LOG_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_LEN_ERR_EID); } @@ -1889,7 +1904,7 @@ void Test_Squelching(void) UtPrintf("Begin Test Squelching"); - UT_InitData(); + UT_InitData_EVS(); UT_EVS_ResetSquelch(); CFE_EVS_Global.EVS_TlmPkt.Payload.MessageFormatMode = CFE_EVS_MsgFormat_LONG; @@ -2024,7 +2039,7 @@ void Test_Misc(void) */ /* Test successful log data file write */ - UT_InitData(); + UT_InitData_EVS(); UT_EVS_DoDispatchCheckEvents(&PktBuf.writelogdatacmd, sizeof(PktBuf.writelogdatacmd), UT_TPID_CFE_EVS_CMD_WRITE_LOG_DATA_FILE_CC, &UT_EVS_EventBuf); if (UT_EVS_EventBuf.EventID == 0xFFFF) @@ -2037,7 +2052,7 @@ void Test_Misc(void) } /* Test successfully setting the logging mode */ - UT_InitData(); + UT_InitData_EVS(); UT_EVS_DoDispatchCheckEvents(&PktBuf.modecmd, sizeof(PktBuf.modecmd), UT_TPID_CFE_EVS_CMD_SET_LOG_MODE_CC, &UT_EVS_EventBuf); if (UT_EVS_EventBuf.EventID == 0xFFFF) @@ -2050,7 +2065,7 @@ void Test_Misc(void) } /* Test housekeeping report with log enabled */ - UT_InitData(); + UT_InitData_EVS(); CFE_EVS_Global.EVS_TlmPkt.Payload.LogEnabled = true; HK_SnapshotData.Count = 0; UT_SetHookFunction(UT_KEY(CFE_SB_TransmitMsg), UT_SoftwareBusSnapshotHook, &HK_SnapshotData); @@ -2058,15 +2073,15 @@ void Test_Misc(void) UtAssert_UINT32_EQ(HK_SnapshotData.Count, 1); /* Test successful application cleanup */ - UT_InitData(); + UT_InitData_EVS(); CFE_UtAssert_SUCCESS(CFE_EVS_CleanUpApp(CFE_ES_APPID_UNDEFINED)); /* Test registering an application with invalid filter argument */ - UT_InitData(); + UT_InitData_EVS(); UtAssert_INT32_EQ(CFE_EVS_Register(NULL, 1, 0), CFE_ES_BAD_ARGUMENT); /* Test housekeeping report with log disabled */ - UT_InitData(); + UT_InitData_EVS(); CFE_EVS_Global.EVS_TlmPkt.Payload.LogEnabled = false; HK_SnapshotData.Count = 0; UT_SetHookFunction(UT_KEY(CFE_SB_TransmitMsg), UT_SoftwareBusSnapshotHook, &HK_SnapshotData); @@ -2076,7 +2091,7 @@ void Test_Misc(void) /* Test sending a packet with the message counter and the event counter * at their maximum allowed values */ - UT_InitData(); + UT_InitData_EVS(); CFE_EVS_Global.EVS_TlmPkt.Payload.MessageSendCounter = CFE_EVS_MAX_EVENT_SEND_COUNT; AppDataPtr->EventCount = CFE_EVS_MAX_EVENT_SEND_COUNT; EVS_SendEvent(0, 0, "Max Event Count"); @@ -2086,7 +2101,7 @@ void Test_Misc(void) /* Test sending a message with the message length greater than the * maximum allowed value */ - UT_InitData(); + UT_InitData_EVS(); for (i = 0; i <= CFE_MISSION_EVS_MAX_MESSAGE_LENGTH; i++) { @@ -2102,7 +2117,7 @@ void Test_Misc(void) UtAssert_UINT32_EQ(CFE_EVS_Global.EVS_TlmPkt.Payload.MessageTruncCounter, 1); /* Use all AppData and report housekeeping to get branch coverage */ - UT_InitData(); + UT_InitData_EVS(); for (i = 0; i < sizeof(CFE_EVS_Global.AppData) / sizeof(CFE_EVS_Global.AppData[0]); i++) { /* Doesn't matter here that AppID is all the same... */ diff --git a/modules/tbl/fsw/inc/cfe_tbl_events.h b/modules/tbl/fsw/inc/cfe_tbl_events.h index 83c2205ad..edcbe2926 100644 --- a/modules/tbl/fsw/inc/cfe_tbl_events.h +++ b/modules/tbl/fsw/inc/cfe_tbl_events.h @@ -345,18 +345,6 @@ */ #define CFE_TBL_NO_WORK_BUFFERS_ERR_EID 60 -/** - * \brief TBL Load Table Command Get Working Buffer Internal Failure Event ID - * - * \par Type: ERROR - * - * \par Cause: - * - * \link #CFE_TBL_LOAD_CC TBL Load Table Command \endlink failure due to - * internal get working buffer error. - */ -#define CFE_TBL_INTERNAL_ERROR_ERR_EID 61 - /** * \brief TBL Write File Creation Failure Event ID * diff --git a/modules/tbl/fsw/src/cfe_tbl_task_cmds.c b/modules/tbl/fsw/src/cfe_tbl_task_cmds.c index 5af3f9da6..3f4ef27c9 100644 --- a/modules/tbl/fsw/src/cfe_tbl_task_cmds.c +++ b/modules/tbl/fsw/src/cfe_tbl_task_cmds.c @@ -475,16 +475,11 @@ int32 CFE_TBL_LoadCmd(const CFE_TBL_LoadCmd_t *data) TblFileHeader.TableName); } } - else if (Status == CFE_TBL_ERR_NO_BUFFER_AVAIL) + else { CFE_EVS_SendEvent(CFE_TBL_NO_WORK_BUFFERS_ERR_EID, CFE_EVS_EventType_ERROR, "No working buffers available for table '%s'", TblFileHeader.TableName); } - else - { - CFE_EVS_SendEvent(CFE_TBL_INTERNAL_ERROR_ERR_EID, CFE_EVS_EventType_ERROR, - "Internal Error (Status=0x%08X)", (unsigned int)Status); - } } else {