From 1dc455b9b236575253f8cebe2a9c79c9bab93f5c Mon Sep 17 00:00:00 2001 From: Jacob Hageman Date: Mon, 17 Apr 2023 14:49:14 +0000 Subject: [PATCH 1/2] Fix #219, #93, Add EVS port timestamp and simplify port selection --- cmake/sample_defs/cpu1_platform_cfg.h | 11 ++++ modules/evs/fsw/src/cfe_evs_task.c | 37 ++--------- modules/evs/fsw/src/cfe_evs_task.h | 1 + modules/evs/fsw/src/cfe_evs_utils.c | 92 ++++++++------------------- modules/evs/fsw/src/cfe_evs_verify.h | 4 ++ modules/evs/ut-coverage/evs_UT.c | 15 ++++- 6 files changed, 61 insertions(+), 99 deletions(-) diff --git a/cmake/sample_defs/cpu1_platform_cfg.h b/cmake/sample_defs/cpu1_platform_cfg.h index b898e7b37..55c81ba2a 100644 --- a/cmake/sample_defs/cpu1_platform_cfg.h +++ b/cmake/sample_defs/cpu1_platform_cfg.h @@ -1462,6 +1462,17 @@ */ #define CFE_PLATFORM_EVS_DEFAULT_MSG_FORMAT_MODE CFE_EVS_MsgFormat_LONG +/** +** \cfeevscfg Include time in port send +** +** \par Description: +** Includes the time when sending events out a port +** +** \par Limits +** Set as true or false +*/ +#define CFE_PLATFORM_EVS_INCLUDE_TIME_IN_PORT_SEND false + /* Platform Configuration Parameters for Table Service (TBL) */ /** diff --git a/modules/evs/fsw/src/cfe_evs_task.c b/modules/evs/fsw/src/cfe_evs_task.c index 782a297c5..f7e34ad6c 100644 --- a/modules/evs/fsw/src/cfe_evs_task.c +++ b/modules/evs/fsw/src/cfe_evs_task.c @@ -76,7 +76,8 @@ int32 CFE_EVS_EarlyInit(void) CFE_EVS_Global.EVS_TlmPkt.Payload.OutputPort = CFE_PLATFORM_EVS_PORT_DEFAULT; CFE_EVS_Global.EVS_TlmPkt.Payload.LogMode = CFE_PLATFORM_EVS_DEFAULT_LOG_MODE; - CFE_EVS_Global.EVS_EventBurstMax = CFE_PLATFORM_EVS_MAX_APP_EVENT_BURST; + CFE_EVS_Global.EVS_EventBurstMax = CFE_PLATFORM_EVS_MAX_APP_EVENT_BURST; + CFE_EVS_Global.IncludeTimeInPortSend = CFE_PLATFORM_EVS_INCLUDE_TIME_IN_PORT_SEND; /* Get a pointer to the CFE reset area from the BSP */ PspStatus = CFE_PSP_GetResetArea(&resetAreaAddr, &resetAreaSize); @@ -491,22 +492,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 +524,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_task.h b/modules/evs/fsw/src/cfe_evs_task.h index f8274057e..b39775495 100644 --- a/modules/evs/fsw/src/cfe_evs_task.h +++ b/modules/evs/fsw/src/cfe_evs_task.h @@ -122,6 +122,7 @@ typedef struct osal_id_t EVS_SharedDataMutexID; CFE_ES_AppId_t EVS_AppID; uint32 EVS_EventBurstMax; + bool IncludeTimeInPortSend; /* Includes time in message sent out ports */ } CFE_EVS_Global_t; /* diff --git a/modules/evs/fsw/src/cfe_evs_utils.c b/modules/evs/fsw/src/cfe_evs_utils.c index 8127046b4..75cc90f40 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,45 @@ 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] = ""; + char Separator[2] = ""; + CFE_TIME_SysTime_t PktTime; - if (((CFE_EVS_Global.EVS_TlmPkt.Payload.OutputPort & CFE_EVS_PORT1_BIT) >> 0) == true) + if (CFE_EVS_Global.IncludeTimeInPortSend) + { + CFE_MSG_GetMsgTime(CFE_MSG_PTR(EVS_PktPtr->TelemetryHeader), &PktTime); + CFE_TIME_Print(TimeBuffer, PktTime); + snprintf(Separator, sizeof(Separator), " "); + } + + snprintf(PortMessage, sizeof(PortMessage), "%s%s%u/%u/%s %u: %s", TimeBuffer, Separator, + (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 +585,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/fsw/src/cfe_evs_verify.h b/modules/evs/fsw/src/cfe_evs_verify.h index 7c8c8df6e..15ae544a0 100644 --- a/modules/evs/fsw/src/cfe_evs_verify.h +++ b/modules/evs/fsw/src/cfe_evs_verify.h @@ -45,6 +45,10 @@ #error CFE_PLATFORM_EVS_DEFAULT_LOG_MODE can only be 0 (Overwrite) or 1 (Discard)! #endif +#if (CFE_PLATFORM_EVS_INCLUDE_TIME_IN_PORT_SEND != true) && (CFE_PLATFORM_EVS_INCLUDE_TIME_IN_PORT_SEND != false) +#error CFE_PLATFORM_EVS_INCLUDE_TIME_IN_PORT_SEND must be true or false +#endif + #if (CFE_PLATFORM_EVS_DEFAULT_MSG_FORMAT_MODE != CFE_EVS_MsgFormat_LONG) && \ (CFE_PLATFORM_EVS_DEFAULT_MSG_FORMAT_MODE != CFE_EVS_MsgFormat_SHORT) #error CFE_EVS_DEFAULT_MSG_FORMAT can only be CFE_EVS_MsgFormat_LONG or CFE_EVS_MsgFormat_SHORT ! diff --git a/modules/evs/ut-coverage/evs_UT.c b/modules/evs/ut-coverage/evs_UT.c index 534743970..6d593aa2d 100644 --- a/modules/evs/ut-coverage/evs_UT.c +++ b/modules/evs/ut-coverage/evs_UT.c @@ -279,6 +279,7 @@ void Test_Init(void) UT_SetDeferredRetcode(UT_KEY(OS_MutSemCreate), 1, OS_SUCCESS); UT_SetDeferredRetcode(UT_KEY(CFE_ES_GetResetType), 1, CFE_PSP_RST_TYPE_POWERON); CFE_EVS_EarlyInit(); + CFE_EVS_Global.IncludeTimeInPortSend = false; /* Do generic testing without time in port message */ CFE_UtAssert_SYSLOG(EVS_SYSLOG_MSGS[4]); /* Task main with init failure */ @@ -359,6 +360,7 @@ void Test_Init(void) UT_SetDeferredRetcode(UT_KEY(OS_MutSemCreate), 1, OS_SUCCESS); UT_SetDeferredRetcode(UT_KEY(CFE_ES_GetResetType), 1, CFE_PSP_RST_TYPE_POWERON); CFE_EVS_EarlyInit(); + CFE_EVS_Global.IncludeTimeInPortSend = false; /* Do generic testing without time in port message */ CFE_UtAssert_SYSLOG(EVS_SYSLOG_MSGS[4]); /* Test task initialization where event services fails */ @@ -812,7 +814,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"); @@ -829,8 +833,17 @@ void Test_Ports(void) /* Test that ports are enabled by sending a message */ UT_InitData(); UT_SetHookFunction(UT_KEY(CFE_SB_TransmitMsg), UT_SoftwareBusSnapshotHook, &LocalSnapshotData); - CFE_EVS_SendEvent(0, CFE_EVS_EventType_INFORMATION, "Test ports message"); + 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, 0); + + /* Test with time included */ + UT_InitData(); + CFE_EVS_Global.IncludeTimeInPortSend = true; + 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_STUB_COUNT(CFE_TIME_Print, 1); + CFE_EVS_Global.IncludeTimeInPortSend = false; /* Do generic testing without time in port message */ /* Disable all ports to cut down on unneeded output */ UT_InitData(); From 43270f5bcdb3ba39de1d5e41ef485f316dc72243 Mon Sep 17 00:00:00 2001 From: Jacob Hageman Date: Thu, 27 Apr 2023 21:38:29 +0000 Subject: [PATCH 2/2] Fix #219, Remove option to exclude port output timestamp --- cmake/sample_defs/cpu1_platform_cfg.h | 11 - modules/evs/fsw/src/cfe_evs_task.c | 3 +- modules/evs/fsw/src/cfe_evs_task.h | 1 - modules/evs/fsw/src/cfe_evs_utils.c | 13 +- modules/evs/fsw/src/cfe_evs_verify.h | 4 - modules/evs/ut-coverage/evs_UT.c | 414 +++++++++++++------------- 6 files changed, 213 insertions(+), 233 deletions(-) diff --git a/cmake/sample_defs/cpu1_platform_cfg.h b/cmake/sample_defs/cpu1_platform_cfg.h index 55c81ba2a..b898e7b37 100644 --- a/cmake/sample_defs/cpu1_platform_cfg.h +++ b/cmake/sample_defs/cpu1_platform_cfg.h @@ -1462,17 +1462,6 @@ */ #define CFE_PLATFORM_EVS_DEFAULT_MSG_FORMAT_MODE CFE_EVS_MsgFormat_LONG -/** -** \cfeevscfg Include time in port send -** -** \par Description: -** Includes the time when sending events out a port -** -** \par Limits -** Set as true or false -*/ -#define CFE_PLATFORM_EVS_INCLUDE_TIME_IN_PORT_SEND false - /* Platform Configuration Parameters for Table Service (TBL) */ /** diff --git a/modules/evs/fsw/src/cfe_evs_task.c b/modules/evs/fsw/src/cfe_evs_task.c index f7e34ad6c..01352f49d 100644 --- a/modules/evs/fsw/src/cfe_evs_task.c +++ b/modules/evs/fsw/src/cfe_evs_task.c @@ -76,8 +76,7 @@ int32 CFE_EVS_EarlyInit(void) CFE_EVS_Global.EVS_TlmPkt.Payload.OutputPort = CFE_PLATFORM_EVS_PORT_DEFAULT; CFE_EVS_Global.EVS_TlmPkt.Payload.LogMode = CFE_PLATFORM_EVS_DEFAULT_LOG_MODE; - CFE_EVS_Global.EVS_EventBurstMax = CFE_PLATFORM_EVS_MAX_APP_EVENT_BURST; - CFE_EVS_Global.IncludeTimeInPortSend = CFE_PLATFORM_EVS_INCLUDE_TIME_IN_PORT_SEND; + CFE_EVS_Global.EVS_EventBurstMax = CFE_PLATFORM_EVS_MAX_APP_EVENT_BURST; /* Get a pointer to the CFE reset area from the BSP */ PspStatus = CFE_PSP_GetResetArea(&resetAreaAddr, &resetAreaSize); diff --git a/modules/evs/fsw/src/cfe_evs_task.h b/modules/evs/fsw/src/cfe_evs_task.h index b39775495..f8274057e 100644 --- a/modules/evs/fsw/src/cfe_evs_task.h +++ b/modules/evs/fsw/src/cfe_evs_task.h @@ -122,7 +122,6 @@ typedef struct osal_id_t EVS_SharedDataMutexID; CFE_ES_AppId_t EVS_AppID; uint32 EVS_EventBurstMax; - bool IncludeTimeInPortSend; /* Includes time in message sent out ports */ } CFE_EVS_Global_t; /* diff --git a/modules/evs/fsw/src/cfe_evs_utils.c b/modules/evs/fsw/src/cfe_evs_utils.c index 75cc90f40..bf6057b05 100644 --- a/modules/evs/fsw/src/cfe_evs_utils.c +++ b/modules/evs/fsw/src/cfe_evs_utils.c @@ -539,18 +539,13 @@ 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 TimeBuffer[CFE_TIME_PRINTED_STRING_SIZE] = ""; - char Separator[2] = ""; + char TimeBuffer[CFE_TIME_PRINTED_STRING_SIZE]; CFE_TIME_SysTime_t PktTime; - if (CFE_EVS_Global.IncludeTimeInPortSend) - { - CFE_MSG_GetMsgTime(CFE_MSG_PTR(EVS_PktPtr->TelemetryHeader), &PktTime); - CFE_TIME_Print(TimeBuffer, PktTime); - snprintf(Separator, sizeof(Separator), " "); - } + CFE_MSG_GetMsgTime(CFE_MSG_PTR(EVS_PktPtr->TelemetryHeader), &PktTime); + CFE_TIME_Print(TimeBuffer, PktTime); - snprintf(PortMessage, sizeof(PortMessage), "%s%s%u/%u/%s %u: %s", TimeBuffer, Separator, + 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); diff --git a/modules/evs/fsw/src/cfe_evs_verify.h b/modules/evs/fsw/src/cfe_evs_verify.h index 15ae544a0..7c8c8df6e 100644 --- a/modules/evs/fsw/src/cfe_evs_verify.h +++ b/modules/evs/fsw/src/cfe_evs_verify.h @@ -45,10 +45,6 @@ #error CFE_PLATFORM_EVS_DEFAULT_LOG_MODE can only be 0 (Overwrite) or 1 (Discard)! #endif -#if (CFE_PLATFORM_EVS_INCLUDE_TIME_IN_PORT_SEND != true) && (CFE_PLATFORM_EVS_INCLUDE_TIME_IN_PORT_SEND != false) -#error CFE_PLATFORM_EVS_INCLUDE_TIME_IN_PORT_SEND must be true or false -#endif - #if (CFE_PLATFORM_EVS_DEFAULT_MSG_FORMAT_MODE != CFE_EVS_MsgFormat_LONG) && \ (CFE_PLATFORM_EVS_DEFAULT_MSG_FORMAT_MODE != CFE_EVS_MsgFormat_SHORT) #error CFE_EVS_DEFAULT_MSG_FORMAT can only be CFE_EVS_MsgFormat_LONG or CFE_EVS_MsgFormat_SHORT ! diff --git a/modules/evs/ut-coverage/evs_UT.c b/modules/evs/ut-coverage/evs_UT.c index 6d593aa2d..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,16 +285,15 @@ 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); CFE_EVS_EarlyInit(); - CFE_EVS_Global.IncludeTimeInPortSend = false; /* Do generic testing without time in port message */ 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()); @@ -291,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); @@ -301,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; @@ -323,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; @@ -332,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; @@ -341,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]); @@ -349,64 +359,63 @@ 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); CFE_EVS_EarlyInit(); - CFE_EVS_Global.IncludeTimeInPortSend = false; /* Do generic testing without time in port message */ 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); @@ -426,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 */ @@ -438,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); } @@ -492,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)); } @@ -550,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++) { @@ -585,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")); @@ -606,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")); @@ -648,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)); } @@ -713,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; @@ -723,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); @@ -732,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"); @@ -756,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); @@ -765,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)"); @@ -782,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++) { @@ -824,84 +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); - 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, 0); - - /* Test with time included */ - UT_InitData(); - CFE_EVS_Global.IncludeTimeInPortSend = true; 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); - CFE_EVS_Global.IncludeTimeInPortSend = false; /* Do generic testing without time in port message */ /* 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); @@ -932,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 */ @@ -945,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 @@ -977,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); @@ -988,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); @@ -1003,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); @@ -1017,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; @@ -1050,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'; @@ -1059,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); @@ -1082,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'; @@ -1093,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); @@ -1101,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'; @@ -1111,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), @@ -1126,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); @@ -1134,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'; @@ -1144,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); @@ -1165,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; @@ -1189,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); @@ -1212,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); @@ -1272,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); @@ -1295,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); @@ -1337,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); @@ -1355,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); @@ -1378,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); @@ -1435,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); @@ -1465,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); @@ -1485,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); @@ -1493,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); @@ -1546,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); @@ -1555,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); @@ -1578,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); @@ -1587,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); @@ -1609,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; @@ -1633,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); @@ -1641,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); @@ -1667,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++) @@ -1709,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)); } @@ -1761,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); } @@ -1902,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; @@ -2037,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) @@ -2050,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) @@ -2063,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); @@ -2071,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); @@ -2089,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"); @@ -2099,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++) { @@ -2115,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... */