diff --git a/modules/es/ut-coverage/es_UT.c b/modules/es/ut-coverage/es_UT.c index e5c73fcf5..0cd66a53b 100644 --- a/modules/es/ut-coverage/es_UT.c +++ b/modules/es/ut-coverage/es_UT.c @@ -268,7 +268,7 @@ void ES_UT_SetupAppStartParams(CFE_ES_AppStartParams_t *Params, const char *File void ES_UT_SetupSingleAppId(CFE_ES_AppType_Enum_t AppType, CFE_ES_AppState_Enum_t AppState, const char *AppName, CFE_ES_AppRecord_t **OutAppRec, CFE_ES_TaskRecord_t **OutTaskRec) { - osal_id_t UtOsalId; + osal_id_t UtOsalId = OS_OBJECT_ID_UNDEFINED; CFE_ResourceId_t UtTaskId; CFE_ResourceId_t UtAppId; CFE_ES_AppRecord_t * LocalAppPtr; @@ -326,7 +326,7 @@ void ES_UT_SetupSingleAppId(CFE_ES_AppType_Enum_t AppType, CFE_ES_AppState_Enum_ */ void ES_UT_SetupChildTaskId(const CFE_ES_AppRecord_t *ParentApp, const char *TaskName, CFE_ES_TaskRecord_t **OutTaskRec) { - osal_id_t UtOsalId; + osal_id_t UtOsalId = OS_OBJECT_ID_UNDEFINED; CFE_ES_TaskId_t UtTaskId; CFE_ES_AppId_t UtAppId; CFE_ES_TaskRecord_t *LocalTaskPtr; @@ -558,6 +558,9 @@ int32 ES_UT_SetupOSCleanupHook(void *UserObj, int32 StubRetcode, uint32 CallCoun */ if (CallCount == 0) { + /* Initialize to avoid static analysis warnings */ + memset(ObjList, 0, sizeof(ObjList)); + OS_TaskCreate(&ObjList[0], NULL, NULL, OSAL_TASK_STACK_ALLOCATE, 0, 0, 0); OS_QueueCreate(&ObjList[1], NULL, 0, 0, 0); OS_MutSemCreate(&ObjList[2], NULL, 0); @@ -1101,7 +1104,7 @@ static void ES_UT_ForEachObjectIncrease(void *UserObj, UT_EntryKey_t FuncKey, co void * callback_arg = UT_Hook_GetArgValueByName(Context, "callback_arg", void *); int * count = (int *)UserObj; int i; - osal_id_t id; + osal_id_t id = OS_OBJECT_ID_UNDEFINED; /* Increasing number of objects per call */ for (i = 0; i < *count; i++) @@ -1117,7 +1120,7 @@ static void ES_UT_ForEachObjectFail(void *UserObj, UT_EntryKey_t FuncKey, const OS_ArgCallback_t callback_ptr = UT_Hook_GetArgValueByName(Context, "callback_ptr", OS_ArgCallback_t); void * callback_arg = UT_Hook_GetArgValueByName(Context, "callback_arg", void *); - osal_id_t id; + osal_id_t id = OS_OBJECT_ID_UNDEFINED; OS_OpenCreate(&id, NULL, 0, 0); UT_SetDeferredRetcode(UT_KEY(OS_close), 1, -1); diff --git a/modules/evs/ut-coverage/evs_UT.c b/modules/evs/ut-coverage/evs_UT.c index 96a87c521..33bcc77a0 100644 --- a/modules/evs/ut-coverage/evs_UT.c +++ b/modules/evs/ut-coverage/evs_UT.c @@ -760,6 +760,8 @@ 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)}; + memset(&bitmaskcmd, 0, sizeof(bitmaskcmd)); + UtPrintf("Begin Test Ports"); CFE_EVS_Global.EVS_TlmPkt.Payload.MessageFormatMode = CFE_EVS_MsgFormat_LONG; @@ -855,7 +857,7 @@ void Test_Logging(void) CFE_EVS_SetLogModeCmd_t modecmd; CFE_EVS_WriteLogDataFileCmd_t logfilecmd; } CmdBuf; - cpuaddr TempAddr; + cpuaddr TempAddr = 0; CFE_ES_ResetData_t *CFE_EVS_ResetDataPtr; UtPrintf("Begin Test Logging"); @@ -1683,6 +1685,8 @@ void Test_InvalidCmd(void) { CFE_MSG_CommandHeader_t cmd; + memset(&cmd, 0, sizeof(cmd)); + UtPrintf("Begin Test Invalid Command"); /* Test invalid msg id event */ diff --git a/modules/msg/ut-coverage/test_msg_pri_not.c b/modules/msg/ut-coverage/test_msg_pri_not.c index 9638ac198..35c7555df 100644 --- a/modules/msg/ut-coverage/test_msg_pri_not.c +++ b/modules/msg/ut-coverage/test_msg_pri_not.c @@ -29,14 +29,14 @@ unsigned int Test_MSG_Pri_NotZero(const CFE_MSG_Message_t *MsgPtr) { - unsigned int bits = 0; - CFE_MSG_HeaderVersion_t hdrver; - bool hassec; - CFE_MSG_Type_t type; - CFE_MSG_ApId_t apid; - CFE_MSG_SegmentationFlag_t segflag; - CFE_MSG_SequenceCount_t seqcnt; - CFE_MSG_Size_t size; + unsigned int bits = 0; + CFE_MSG_HeaderVersion_t hdrver = 0; + bool hassec = false; + CFE_MSG_Type_t type = 0; + CFE_MSG_ApId_t apid = 0; + CFE_MSG_SegmentationFlag_t segflag = 0; + CFE_MSG_SequenceCount_t seqcnt = 0; + CFE_MSG_Size_t size = 0; CFE_MSG_GetHeaderVersion(MsgPtr, &hdrver); if (hdrver != 0) @@ -65,14 +65,14 @@ unsigned int Test_MSG_Pri_NotZero(const CFE_MSG_Message_t *MsgPtr) unsigned int Test_MSG_Pri_NotF(const CFE_MSG_Message_t *MsgPtr) { - unsigned int bits = 0; - CFE_MSG_HeaderVersion_t hdrver; - bool hassec; - CFE_MSG_Type_t type; - CFE_MSG_ApId_t apid; - CFE_MSG_SegmentationFlag_t segflag; - CFE_MSG_SequenceCount_t seqcnt; - CFE_MSG_Size_t size; + unsigned int bits = 0; + CFE_MSG_HeaderVersion_t hdrver = 0; + bool hassec = false; + CFE_MSG_Type_t type = 0; + CFE_MSG_ApId_t apid = 0; + CFE_MSG_SegmentationFlag_t segflag = 0; + CFE_MSG_SequenceCount_t seqcnt = 0; + CFE_MSG_Size_t size = 0; CFE_MSG_GetHeaderVersion(MsgPtr, &hdrver); if (hdrver != 0x7) diff --git a/modules/sb/ut-coverage/sb_UT.c b/modules/sb/ut-coverage/sb_UT.c index 670df5dd6..4d3cc630d 100644 --- a/modules/sb/ut-coverage/sb_UT.c +++ b/modules/sb/ut-coverage/sb_UT.c @@ -524,6 +524,8 @@ void Test_SB_Cmds_Noop(void) CFE_SB_NoopCmd_t Cmd; } Noop; + memset(&Noop, 0, sizeof(Noop)); + UT_CallTaskPipe(CFE_SB_ProcessCmdPipePkt, &Noop.SBBuf.Msg, sizeof(Noop.Cmd), UT_TPID_CFE_SB_CMD_NOOP_CC); CFE_UtAssert_EVENTCOUNT(1); @@ -546,6 +548,8 @@ void Test_SB_Cmds_RstCtrs(void) CFE_SB_ResetCountersCmd_t Cmd; } ResetCounters; + memset(&ResetCounters, 0, sizeof(ResetCounters)); + UT_CallTaskPipe(CFE_SB_ProcessCmdPipePkt, &ResetCounters.SBBuf.Msg, sizeof(ResetCounters.Cmd), UT_TPID_CFE_SB_CMD_RESET_COUNTERS_CC); @@ -574,6 +578,8 @@ void Test_SB_Cmds_Stats(void) CFE_SB_PipeId_t PipeId2; CFE_SB_PipeId_t PipeId3; + memset(&SendSbStats, 0, sizeof(SendSbStats)); + /* Make the pipe table non-empty so the stats command writes something */ CFE_UtAssert_SETUP(CFE_SB_CreatePipe(&PipeId1, 4, "TestPipe1")); CFE_UtAssert_SETUP(CFE_SB_CreatePipe(&PipeId2, 4, "TestPipe2")); @@ -615,7 +621,7 @@ void Test_SB_Cmds_RoutingInfoDef(void) CFE_SB_WriteRoutingInfoCmd_t Cmd; } WriteRoutingInfo; - WriteRoutingInfo.Cmd.Payload.Filename[0] = '\0'; + memset(&WriteRoutingInfo, 0, sizeof(WriteRoutingInfo)); /* Make some routing info by calling CFE_SB_AppInit */ CFE_UtAssert_SETUP(CFE_SB_AppInit()); @@ -654,6 +660,8 @@ void Test_SB_Cmds_RoutingInfoAlreadyPending(void) CFE_SB_WriteRoutingInfoCmd_t Cmd; } WriteRoutingInfo; + memset(&WriteRoutingInfo, 0, sizeof(WriteRoutingInfo)); + UT_SetDefaultReturnValue(UT_KEY(CFE_FS_BackgroundFileDumpIsPending), true); strncpy(WriteRoutingInfo.Cmd.Payload.Filename, "RoutingTstFile", sizeof(WriteRoutingInfo.Cmd.Payload.Filename) - 1); @@ -673,9 +681,9 @@ void Test_SB_Cmds_RoutingInfoAlreadyPending(void) */ void Test_SB_Cmds_RoutingInfoDataGetter(void) { - CFE_SB_PipeId_t PipeId1; - CFE_SB_PipeId_t PipeId2; - CFE_SB_PipeId_t PipeId3; + CFE_SB_PipeId_t PipeId1 = CFE_SB_INVALID_PIPE; + CFE_SB_PipeId_t PipeId2 = CFE_SB_INVALID_PIPE; + CFE_SB_PipeId_t PipeId3 = CFE_SB_INVALID_PIPE; CFE_SB_MsgId_t MsgId0 = SB_UT_TLM_MID1; CFE_SB_MsgId_t MsgId1 = SB_UT_TLM_MID2; CFE_SB_MsgId_t MsgId2 = SB_UT_TLM_MID3; @@ -760,7 +768,7 @@ void Test_SB_Cmds_PipeInfoDef(void) CFE_SB_PipeId_t PipeId3; uint16 PipeDepth = 10; - WritePipeInfo.Cmd.Payload.Filename[0] = '\0'; + memset(&WritePipeInfo, 0, sizeof(WritePipeInfo)); /* Create some pipe info */ CFE_UtAssert_SETUP(CFE_SB_CreatePipe(&PipeId1, PipeDepth, "TestPipe1")); @@ -800,6 +808,8 @@ void Test_SB_Cmds_PipeInfoAlreadyPending(void) CFE_SB_WritePipeInfoCmd_t Cmd; } WritePipeInfo; + memset(&WritePipeInfo, 0, sizeof(WritePipeInfo)); + UT_SetDefaultReturnValue(UT_KEY(CFE_FS_BackgroundFileDumpIsPending), true); strncpy(WritePipeInfo.Cmd.Payload.Filename, "PipeTstFile", sizeof(WritePipeInfo.Cmd.Payload.Filename) - 1); @@ -890,9 +900,9 @@ void Test_SB_Cmds_BackgroundFileWriteEvents(void) */ void Test_SB_Cmds_MapInfoDataGetter(void) { - CFE_SB_PipeId_t PipeId1; - CFE_SB_PipeId_t PipeId2; - CFE_SB_PipeId_t PipeId3; + CFE_SB_PipeId_t PipeId1 = CFE_SB_INVALID_PIPE; + CFE_SB_PipeId_t PipeId2 = CFE_SB_INVALID_PIPE; + CFE_SB_PipeId_t PipeId3 = CFE_SB_INVALID_PIPE; CFE_SB_MsgId_t MsgId0 = SB_UT_TLM_MID1; CFE_SB_MsgId_t MsgId1 = SB_UT_TLM_MID2; CFE_SB_MsgId_t MsgId2 = SB_UT_TLM_MID3; @@ -944,9 +954,9 @@ void Test_SB_Cmds_MapInfoDef(void) CFE_SB_Buffer_t SBBuf; CFE_SB_WriteMapInfoCmd_t Cmd; } WriteMapInfo; - CFE_SB_PipeId_t PipeId1; - CFE_SB_PipeId_t PipeId2; - CFE_SB_PipeId_t PipeId3; + CFE_SB_PipeId_t PipeId1 = CFE_SB_INVALID_PIPE; + CFE_SB_PipeId_t PipeId2 = CFE_SB_INVALID_PIPE; + CFE_SB_PipeId_t PipeId3 = CFE_SB_INVALID_PIPE; CFE_SB_MsgId_t MsgId0 = SB_UT_TLM_MID1; CFE_SB_MsgId_t MsgId1 = SB_UT_TLM_MID2; CFE_SB_MsgId_t MsgId2 = SB_UT_TLM_MID3; @@ -955,7 +965,7 @@ void Test_SB_Cmds_MapInfoDef(void) CFE_SB_MsgId_t MsgId5 = SB_UT_TLM_MID6; uint16 PipeDepth = 10; - WriteMapInfo.Cmd.Payload.Filename[0] = '\0'; + memset(&WriteMapInfo, 0, sizeof(WriteMapInfo)); /* Create some map info */ CFE_UtAssert_SETUP(CFE_SB_CreatePipe(&PipeId1, PipeDepth, "TestPipe1")); @@ -1005,6 +1015,8 @@ void Test_SB_Cmds_MapInfoAlreadyPending(void) CFE_SB_WriteMapInfoCmd_t Cmd; } WriteMapInfo; + memset(&WriteMapInfo, 0, sizeof(WriteMapInfo)); + UT_SetDefaultReturnValue(UT_KEY(CFE_FS_BackgroundFileDumpIsPending), true); strncpy(WriteMapInfo.Cmd.Payload.Filename, "MapTstFile", sizeof(WriteMapInfo.Cmd.Payload.Filename) - 1); @@ -1030,10 +1042,12 @@ void Test_SB_Cmds_EnRouteValParam(void) CFE_SB_Buffer_t SBBuf; CFE_SB_EnableRouteCmd_t Cmd; } EnableRoute; - CFE_SB_PipeId_t PipeId; + CFE_SB_PipeId_t PipeId = CFE_SB_INVALID_PIPE; CFE_SB_MsgId_t MsgId = SB_UT_TLM_MID; uint16 PipeDepth = 5; + memset(&EnableRoute, 0, sizeof(EnableRoute)); + CFE_UtAssert_SETUP(CFE_SB_CreatePipe(&PipeId, PipeDepth, "EnRouteTestPipe")); CFE_UtAssert_SETUP(CFE_SB_Subscribe(MsgId, PipeId)); EnableRoute.Cmd.Payload.MsgId = MsgId; @@ -1068,11 +1082,13 @@ void Test_SB_Cmds_EnRouteNonExist(void) CFE_SB_Buffer_t SBBuf; CFE_SB_EnableRouteCmd_t Cmd; } EnableRoute; - CFE_SB_PipeId_t PipeId1; - CFE_SB_PipeId_t PipeId2; + CFE_SB_PipeId_t PipeId1 = CFE_SB_INVALID_PIPE; + CFE_SB_PipeId_t PipeId2 = CFE_SB_INVALID_PIPE; CFE_SB_MsgId_t MsgId = SB_UT_TLM_MID; uint16 PipeDepth = 5; + memset(&EnableRoute, 0, sizeof(EnableRoute)); + CFE_UtAssert_SETUP(CFE_SB_CreatePipe(&PipeId1, PipeDepth, "EnRouteTestPipe1")); CFE_UtAssert_SETUP(CFE_SB_CreatePipe(&PipeId2, PipeDepth, "EnRouteTestPipe2")); CFE_UtAssert_SETUP(CFE_SB_Subscribe(MsgId, PipeId1)); @@ -1104,6 +1120,8 @@ void Test_SB_Cmds_EnRouteInvParam(void) CFE_SB_EnableRouteCmd_t Cmd; } EnableRoute; + memset(&EnableRoute, 0, sizeof(EnableRoute)); + EnableRoute.Cmd.Payload.MsgId = SB_UT_LAST_VALID_MID; EnableRoute.Cmd.Payload.Pipe = SB_UT_PIPEID_3; @@ -1127,6 +1145,8 @@ void Test_SB_Cmds_EnRouteInvParam2(void) CFE_SB_EnableRouteCmd_t Cmd; } EnableRoute; + memset(&EnableRoute, 0, sizeof(EnableRoute)); + EnableRoute.Cmd.Payload.MsgId = CFE_SB_INVALID_MSG_ID; EnableRoute.Cmd.Payload.Pipe = SB_UT_PIPEID_3; @@ -1151,6 +1171,8 @@ void Test_SB_Cmds_EnRouteInvParam3(void) CFE_SB_EnableRouteCmd_t Cmd; } EnableRoute; + memset(&EnableRoute, 0, sizeof(EnableRoute)); + EnableRoute.Cmd.Payload.MsgId = SB_UT_ALTERNATE_INVALID_MID; EnableRoute.Cmd.Payload.Pipe = SB_UT_PIPEID_0; @@ -1173,10 +1195,12 @@ void Test_SB_Cmds_DisRouteValParam(void) CFE_SB_Buffer_t SBBuf; CFE_SB_DisableRouteCmd_t Cmd; } DisableRoute; - CFE_SB_PipeId_t PipeId; + CFE_SB_PipeId_t PipeId = CFE_SB_INVALID_PIPE; CFE_SB_MsgId_t MsgId = SB_UT_TLM_MID; uint16 PipeDepth = 5; + memset(&DisableRoute, 0, sizeof(DisableRoute)); + CFE_UtAssert_SETUP(CFE_SB_CreatePipe(&PipeId, PipeDepth, "DisRouteTestPipe")); CFE_UtAssert_SETUP(CFE_SB_Subscribe(MsgId, PipeId)); DisableRoute.Cmd.Payload.MsgId = MsgId; @@ -1211,10 +1235,13 @@ void Test_SB_Cmds_DisRouteNonExist(void) CFE_SB_Buffer_t SBBuf; CFE_SB_DisableRouteCmd_t Cmd; } DisableRoute; - CFE_SB_PipeId_t PipeId1, PipeId2; + CFE_SB_PipeId_t PipeId1 = CFE_SB_INVALID_PIPE; + CFE_SB_PipeId_t PipeId2 = CFE_SB_INVALID_PIPE; CFE_SB_MsgId_t MsgId = SB_UT_TLM_MID; uint16 PipeDepth = 5; + memset(&DisableRoute, 0, sizeof(DisableRoute)); + CFE_UtAssert_SETUP(CFE_SB_CreatePipe(&PipeId1, PipeDepth, "DisRouteTestPipe1")); CFE_UtAssert_SETUP(CFE_SB_CreatePipe(&PipeId2, PipeDepth, "DisRouteTestPipe2")); CFE_UtAssert_SETUP(CFE_SB_Subscribe(MsgId, PipeId1)); @@ -1246,6 +1273,8 @@ void Test_SB_Cmds_DisRouteInvParam(void) CFE_SB_DisableRouteCmd_t Cmd; } DisableRoute; + memset(&DisableRoute, 0, sizeof(DisableRoute)); + DisableRoute.Cmd.Payload.MsgId = SB_UT_LAST_VALID_MID; DisableRoute.Cmd.Payload.Pipe = SB_UT_PIPEID_3; @@ -1269,6 +1298,8 @@ void Test_SB_Cmds_DisRouteInvParam2(void) CFE_SB_DisableRouteCmd_t Cmd; } DisableRoute; + memset(&DisableRoute, 0, sizeof(DisableRoute)); + DisableRoute.Cmd.Payload.MsgId = CFE_SB_INVALID_MSG_ID; DisableRoute.Cmd.Payload.Pipe = SB_UT_PIPEID_3; @@ -1293,6 +1324,8 @@ void Test_SB_Cmds_DisRouteInvParam3(void) CFE_SB_DisableRouteCmd_t Cmd; } DisableRoute; + memset(&DisableRoute, 0, sizeof(DisableRoute)); + DisableRoute.Cmd.Payload.MsgId = SB_UT_ALTERNATE_INVALID_MID; DisableRoute.Cmd.Payload.Pipe = SB_UT_PIPEID_0; @@ -1318,6 +1351,8 @@ void Test_SB_Cmds_SendHK(void) CFE_SB_MsgId_t MsgIdCmd; CFE_MSG_Size_t Size; + memset(&Housekeeping, 0, sizeof(Housekeeping)); + /* For HK command processing - set up FIRST */ UT_SetupBasicMsgDispatch(&UT_TPID_CFE_SB_SEND_HK, sizeof(Housekeeping.Cmd), false); @@ -1346,8 +1381,8 @@ void Test_SB_Cmds_SendPrevSubs(void) CFE_SB_Buffer_t SBBuf; CFE_SB_SendPrevSubsCmd_t Cmd; } SendPrevSubs; - CFE_SB_PipeId_t PipeId1; - CFE_SB_PipeId_t PipeId2; + CFE_SB_PipeId_t PipeId1 = CFE_SB_INVALID_PIPE; + CFE_SB_PipeId_t PipeId2 = CFE_SB_INVALID_PIPE; CFE_SB_MsgId_t MsgId = SB_UT_BARE_TLM_MID3; uint16 MsgLim = 4; uint16 PipeDepth = 50; @@ -1356,6 +1391,8 @@ void Test_SB_Cmds_SendPrevSubs(void) CFE_MSG_Size_t Size; CFE_SB_MsgId_t MsgIdCmd; + memset(&SendPrevSubs, 0, sizeof(SendPrevSubs)); + CFE_UtAssert_SETUP(CFE_SB_CreatePipe(&PipeId1, PipeDepth, "TestPipe1")); CFE_UtAssert_SETUP(CFE_SB_CreatePipe(&PipeId2, PipeDepth, "TestPipe2")); NumEvts = 2; /* one for each pipe create */ @@ -1475,6 +1512,8 @@ void Test_SB_Cmds_SubRptOn(void) CFE_SB_EnableSubReportingCmd_t Cmd; } EnableSubReporting; + memset(&EnableSubReporting, 0, sizeof(EnableSubReporting)); + UT_CallTaskPipe(CFE_SB_ProcessCmdPipePkt, &EnableSubReporting.SBBuf.Msg, sizeof(EnableSubReporting.Cmd), UT_TPID_CFE_SB_SUB_RPT_CTL_ENABLE_SUB_REPORTING_CC); @@ -1502,6 +1541,8 @@ void Test_SB_Cmds_SubRptOff(void) CFE_SB_DisableSubReportingCmd_t Cmd; } DisableSubReporting; + memset(&DisableSubReporting, 0, sizeof(DisableSubReporting)); + UT_CallTaskPipe(CFE_SB_ProcessCmdPipePkt, &DisableSubReporting.SBBuf.Msg, sizeof(DisableSubReporting.Cmd), UT_TPID_CFE_SB_SUB_RPT_CTL_DISABLE_SUB_REPORTING_CC); @@ -1818,7 +1859,7 @@ void Test_DeletePipe_API(void) */ void Test_DeletePipe_NoSubs(void) { - CFE_SB_PipeId_t PipedId; + CFE_SB_PipeId_t PipedId = CFE_SB_INVALID_PIPE; uint16 PipeDepth = 10; CFE_UtAssert_SETUP(CFE_SB_CreatePipe(&PipedId, PipeDepth, "TestPipe")); @@ -1836,7 +1877,7 @@ void Test_DeletePipe_NoSubs(void) */ void Test_DeletePipe_WithSubs(void) { - CFE_SB_PipeId_t PipedId; + CFE_SB_PipeId_t PipedId = CFE_SB_INVALID_PIPE; CFE_SB_MsgId_t MsgId0 = SB_UT_CMD_MID1; CFE_SB_MsgId_t MsgId1 = SB_UT_CMD_MID2; CFE_SB_MsgId_t MsgId2 = SB_UT_CMD_MID3; @@ -1877,7 +1918,7 @@ void Test_DeletePipe_InvalidPipeId(void) */ void Test_DeletePipe_InvalidPipeOwner(void) { - CFE_SB_PipeId_t PipedId; + CFE_SB_PipeId_t PipedId = CFE_SB_INVALID_PIPE; CFE_SB_PipeD_t *PipeDscPtr; CFE_ES_AppId_t RealOwner; uint16 PipeDepth = 10; @@ -1907,7 +1948,7 @@ void Test_DeletePipe_InvalidPipeOwner(void) */ void Test_DeletePipe_WithAppid(void) { - CFE_SB_PipeId_t PipedId; + CFE_SB_PipeId_t PipedId = CFE_SB_INVALID_PIPE; CFE_ES_AppId_t AppId; uint16 PipeDepth = 10; @@ -1952,7 +1993,7 @@ void Test_GetPipeName_API(void) */ void Test_GetPipeName_NullPtr(void) { - CFE_SB_PipeId_t PipeId; + CFE_SB_PipeId_t PipeId = CFE_SB_INVALID_PIPE; char NameBuf[10]; CFE_UtAssert_SETUP(CFE_SB_CreatePipe(&PipeId, 4, "TestPipe")); @@ -1973,7 +2014,7 @@ void Test_GetPipeName_NullPtr(void) void Test_GetPipeName_InvalidId(void) { char PipeName[OS_MAX_API_NAME]; - CFE_SB_PipeId_t PipeId; + CFE_SB_PipeId_t PipeId = CFE_SB_INVALID_PIPE; CFE_UtAssert_SETUP(CFE_SB_CreatePipe(&PipeId, 4, "TestPipe")); @@ -2096,7 +2137,7 @@ void Test_SetPipeOpts_BadID(void) */ void Test_SetPipeOpts_NotOwner(void) { - CFE_SB_PipeId_t PipeID; + CFE_SB_PipeId_t PipeID = CFE_SB_INVALID_PIPE; CFE_SB_PipeD_t *PipeDscPtr; CFE_ES_AppId_t OrigOwner; @@ -2122,7 +2163,7 @@ void Test_SetPipeOpts_NotOwner(void) */ void Test_SetPipeOpts(void) { - CFE_SB_PipeId_t PipeID; + CFE_SB_PipeId_t PipeID = CFE_SB_INVALID_PIPE; CFE_UtAssert_SETUP(CFE_SB_CreatePipe(&PipeID, 4, "TestPipe1")); @@ -2155,7 +2196,7 @@ void Test_GetPipeOpts_BadID(void) */ void Test_GetPipeOpts_BadPtr(void) { - CFE_SB_PipeId_t PipeID; + CFE_SB_PipeId_t PipeID = CFE_SB_INVALID_PIPE; CFE_UtAssert_SETUP(CFE_SB_CreatePipe(&PipeID, 4, "TestPipe1")); @@ -2172,8 +2213,8 @@ void Test_GetPipeOpts_BadPtr(void) */ void Test_GetPipeOpts(void) { - CFE_SB_PipeId_t PipeID; - uint8 Opts = 0; + CFE_SB_PipeId_t PipeID = CFE_SB_INVALID_PIPE; + uint8 Opts = 0; CFE_UtAssert_SETUP(CFE_SB_CreatePipe(&PipeID, 4, "TestPipe1")); @@ -2209,7 +2250,7 @@ void Test_Subscribe_API(void) */ void Test_Subscribe_SubscribeEx(void) { - CFE_SB_PipeId_t PipeId; + CFE_SB_PipeId_t PipeId = CFE_SB_INVALID_PIPE; CFE_SB_MsgId_t MsgId = SB_UT_CMD_MID; CFE_SB_Qos_t Quality = {0, 0}; uint16 PipeDepth = 10; @@ -2249,7 +2290,7 @@ void Test_Subscribe_InvalidPipeId(void) */ void Test_Subscribe_InvalidMsgId(void) { - CFE_SB_PipeId_t PipeId; + CFE_SB_PipeId_t PipeId = CFE_SB_INVALID_PIPE; CFE_SB_MsgId_t MsgId = SB_UT_ALTERNATE_INVALID_MID; uint16 PipeDepth = 10; @@ -2270,7 +2311,7 @@ void Test_Subscribe_InvalidMsgId(void) */ void Test_Subscribe_MaxMsgLim(void) { - CFE_SB_PipeId_t PipeId; + CFE_SB_PipeId_t PipeId = CFE_SB_INVALID_PIPE; CFE_SB_MsgId_t MsgId = SB_UT_CMD_MID; CFE_SB_Qos_t Quality = {0, 0}; uint16 PipeDepth = 10; @@ -2294,7 +2335,7 @@ void Test_Subscribe_MaxMsgLim(void) */ void Test_Subscribe_DuplicateSubscription(void) { - CFE_SB_PipeId_t PipeId; + CFE_SB_PipeId_t PipeId = CFE_SB_INVALID_PIPE; CFE_SB_MsgId_t MsgId = SB_UT_CMD_MID; uint16 PipeDepth = 10; @@ -2317,7 +2358,7 @@ void Test_Subscribe_DuplicateSubscription(void) */ void Test_Subscribe_LocalSubscription(void) { - CFE_SB_PipeId_t PipeId; + CFE_SB_PipeId_t PipeId = CFE_SB_INVALID_PIPE; CFE_SB_MsgId_t MsgId = SB_UT_TLM_MID; uint16 PipeDepth = 10; uint16 MsgLim = 4; @@ -2390,9 +2431,9 @@ void Test_Subscribe_MaxDestCount(void) */ void Test_Subscribe_MaxMsgIdCount(void) { - CFE_SB_PipeId_t PipeId0; - CFE_SB_PipeId_t PipeId1; - CFE_SB_PipeId_t PipeId2; + CFE_SB_PipeId_t PipeId0 = CFE_SB_INVALID_PIPE; + CFE_SB_PipeId_t PipeId1 = CFE_SB_INVALID_PIPE; + CFE_SB_PipeId_t PipeId2 = CFE_SB_INVALID_PIPE; uint16 PipeDepth = 50; int32 i; @@ -2432,9 +2473,9 @@ void Test_Subscribe_MaxMsgIdCount(void) */ void Test_Subscribe_SendPrevSubs(void) { - CFE_SB_PipeId_t PipeId0; - CFE_SB_PipeId_t PipeId1; - CFE_SB_PipeId_t PipeId2; + CFE_SB_PipeId_t PipeId0 = CFE_SB_INVALID_PIPE; + CFE_SB_PipeId_t PipeId1 = CFE_SB_INVALID_PIPE; + CFE_SB_PipeId_t PipeId2 = CFE_SB_INVALID_PIPE; CFE_SB_MsgId_t MsgId0 = SB_UT_TLM_MID1; CFE_SB_MsgId_t MsgId1 = SB_UT_TLM_MID2; CFE_SB_MsgId_t MsgId2 = SB_UT_TLM_MID3; @@ -2497,9 +2538,9 @@ void Test_Subscribe_PipeNonexistent(void) */ void Test_Subscribe_SubscriptionReporting(void) { - CFE_SB_PipeId_t PipeId; - CFE_SB_MsgId_t MsgId = SB_UT_TLM_MID; - CFE_SB_Qos_t Quality; + CFE_SB_PipeId_t PipeId = CFE_SB_INVALID_PIPE; + CFE_SB_MsgId_t MsgId = SB_UT_TLM_MID; + CFE_SB_Qos_t Quality = CFE_SB_DEFAULT_QOS; uint16 PipeDepth = 10; CFE_SB_MsgId_t MsgIdRpt; CFE_MSG_Size_t Size; @@ -2541,7 +2582,7 @@ void Test_Subscribe_SubscriptionReporting(void) */ void Test_Subscribe_InvalidPipeOwner(void) { - CFE_SB_PipeId_t PipeId; + CFE_SB_PipeId_t PipeId = CFE_SB_INVALID_PIPE; CFE_SB_PipeD_t *PipeDscPtr; CFE_SB_MsgId_t MsgId = SB_UT_TLM_MID; uint16 PipeDepth = 10; @@ -2589,7 +2630,7 @@ void Test_Unsubscribe_API(void) */ void Test_Unsubscribe_Basic(void) { - CFE_SB_PipeId_t TestPipe; + CFE_SB_PipeId_t TestPipe = CFE_SB_INVALID_PIPE; CFE_SB_MsgId_t MsgId = SB_UT_INTERMEDIATE_VALID_MID; uint16 PipeDepth = 50; @@ -2617,7 +2658,7 @@ void Test_Unsubscribe_Basic(void) */ void Test_Unsubscribe_AppId(void) { - CFE_SB_PipeId_t TestPipe; + CFE_SB_PipeId_t TestPipe = CFE_SB_INVALID_PIPE; CFE_SB_MsgId_t MsgId = SB_UT_TLM_MID; uint16 PipeDepth = 50; CFE_ES_AppId_t CallerId; @@ -2642,7 +2683,7 @@ void Test_Unsubscribe_AppId(void) */ void Test_Unsubscribe_Local(void) { - CFE_SB_PipeId_t TestPipe; + CFE_SB_PipeId_t TestPipe = CFE_SB_INVALID_PIPE; CFE_SB_MsgId_t MsgId = SB_UT_TLM_MID; uint16 PipeDepth = 50; @@ -2664,7 +2705,7 @@ void Test_Unsubscribe_Local(void) */ void Test_Unsubscribe_InvalParam(void) { - CFE_SB_PipeId_t TestPipe; + CFE_SB_PipeId_t TestPipe = CFE_SB_INVALID_PIPE; CFE_ES_AppId_t CallerId; CFE_SB_PipeD_t *PipeDscPtr; uint16 PipeDepth = 50; @@ -2709,7 +2750,7 @@ void Test_Unsubscribe_InvalParam(void) */ void Test_Unsubscribe_NoMatch(void) { - CFE_SB_PipeId_t TestPipe; + CFE_SB_PipeId_t TestPipe = CFE_SB_INVALID_PIPE; CFE_SB_MsgId_t MsgId = SB_UT_TLM_MID; uint16 PipeDepth = 50; @@ -2737,7 +2778,7 @@ void Test_Unsubscribe_NoMatch(void) */ void Test_Unsubscribe_InvalidPipe(void) { - CFE_SB_PipeId_t TestPipe; + CFE_SB_PipeId_t TestPipe = CFE_SB_INVALID_PIPE; CFE_SB_MsgId_t MsgId = SB_UT_TLM_MID; uint16 PipeDepth = 50; @@ -2759,8 +2800,8 @@ void Test_Unsubscribe_InvalidPipe(void) */ void Test_Unsubscribe_InvalidPipeOwner(void) { - CFE_SB_PipeId_t PipeId; - CFE_SB_MsgId_t MsgId = SB_UT_TLM_MID; + CFE_SB_PipeId_t PipeId = CFE_SB_INVALID_PIPE; + CFE_SB_MsgId_t MsgId = SB_UT_TLM_MID; CFE_SB_PipeD_t *PipeDscPtr; CFE_ES_AppId_t RealOwner; uint16 PipeDepth = 10; @@ -2793,10 +2834,10 @@ void Test_Unsubscribe_InvalidPipeOwner(void) */ void Test_Unsubscribe_FirstDestWithMany(void) { - CFE_SB_MsgId_t MsgId = SB_UT_CMD_MID; - CFE_SB_PipeId_t TestPipe1; - CFE_SB_PipeId_t TestPipe2; - CFE_SB_PipeId_t TestPipe3; + CFE_SB_MsgId_t MsgId = SB_UT_CMD_MID; + CFE_SB_PipeId_t TestPipe1 = CFE_SB_INVALID_PIPE; + CFE_SB_PipeId_t TestPipe2 = CFE_SB_INVALID_PIPE; + CFE_SB_PipeId_t TestPipe3 = CFE_SB_INVALID_PIPE; uint16 PipeDepth = 50; CFE_UtAssert_SETUP(CFE_SB_CreatePipe(&TestPipe1, PipeDepth, "TestPipe1")); @@ -2825,10 +2866,10 @@ void Test_Unsubscribe_FirstDestWithMany(void) */ void Test_Unsubscribe_MiddleDestWithMany(void) { - CFE_SB_MsgId_t MsgId = SB_UT_CMD_MID; - CFE_SB_PipeId_t TestPipe1; - CFE_SB_PipeId_t TestPipe2; - CFE_SB_PipeId_t TestPipe3; + CFE_SB_MsgId_t MsgId = SB_UT_CMD_MID; + CFE_SB_PipeId_t TestPipe1 = CFE_SB_INVALID_PIPE; + CFE_SB_PipeId_t TestPipe2 = CFE_SB_INVALID_PIPE; + CFE_SB_PipeId_t TestPipe3 = CFE_SB_INVALID_PIPE; uint16 PipeDepth = 50; CFE_UtAssert_SETUP(CFE_SB_CreatePipe(&TestPipe1, PipeDepth, "TestPipe1")); @@ -2857,9 +2898,9 @@ void Test_Unsubscribe_MiddleDestWithMany(void) */ void Test_Unsubscribe_GetDestPtr(void) { - CFE_SB_MsgId_t MsgId = SB_UT_CMD_MID; - CFE_SB_PipeId_t TestPipe1; - CFE_SB_PipeId_t TestPipe2; + CFE_SB_MsgId_t MsgId = SB_UT_CMD_MID; + CFE_SB_PipeId_t TestPipe1 = CFE_SB_INVALID_PIPE; + CFE_SB_PipeId_t TestPipe2 = CFE_SB_INVALID_PIPE; uint16 PipeDepth = 50; CFE_SBR_RouteId_t RouteId; @@ -2931,6 +2972,8 @@ void Test_TransmitMsg_NoSubscribers(void) SB_UT_Test_Tlm_t TlmPkt; CFE_MSG_Size_t Size = sizeof(TlmPkt); + memset(&TlmPkt, 0, sizeof(TlmPkt)); + UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); @@ -2951,6 +2994,8 @@ void Test_TransmitMsg_MaxMsgSizePlusOne(void) SB_UT_Test_Tlm_t TlmPkt; CFE_MSG_Size_t Size = CFE_MISSION_SB_MAX_SB_MSG_SIZE + 1; + memset(&TlmPkt, 0, sizeof(TlmPkt)); + UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); CFE_SB_Global.HKTlmMsg.Payload.MsgSendErrorCounter = 0; @@ -2969,13 +3014,15 @@ void Test_TransmitMsg_MaxMsgSizePlusOne(void) */ void Test_TransmitMsg_BasicSend(void) { - CFE_SB_PipeId_t PipeId; - CFE_SB_MsgId_t MsgId = SB_UT_TLM_MID; + CFE_SB_PipeId_t PipeId = CFE_SB_INVALID_PIPE; + CFE_SB_MsgId_t MsgId = SB_UT_TLM_MID; SB_UT_Test_Tlm_t TlmPkt; int32 PipeDepth = 2; CFE_MSG_Size_t Size = sizeof(TlmPkt); CFE_MSG_Type_t Type = CFE_MSG_Type_Tlm; + memset(&TlmPkt, 0, sizeof(TlmPkt)); + CFE_UtAssert_SETUP(CFE_SB_CreatePipe(&PipeId, PipeDepth, "TestPipe")); CFE_UtAssert_SETUP(CFE_SB_Subscribe(MsgId, PipeId)); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); @@ -3006,8 +3053,8 @@ static int32 UT_CheckSetSequenceCount(void *UserObj, int32 StubRetcode, uint32 C */ void Test_TransmitMsg_SequenceCount(void) { - CFE_SB_PipeId_t PipeId; - CFE_SB_MsgId_t MsgId = SB_UT_TLM_MID; + CFE_SB_PipeId_t PipeId = CFE_SB_INVALID_PIPE; + CFE_SB_MsgId_t MsgId = SB_UT_TLM_MID; SB_UT_Test_Tlm_t TlmPkt; CFE_MSG_Size_t Size = sizeof(TlmPkt); CFE_MSG_Type_t Type = CFE_MSG_Type_Tlm; @@ -3015,6 +3062,8 @@ void Test_TransmitMsg_SequenceCount(void) CFE_MSG_SequenceCount_t SeqCnt; CFE_MSG_SequenceCount_t SeqCntExpected; + memset(&TlmPkt, 0, sizeof(TlmPkt)); + /* Set up hook for checking CFE_MSG_SetSequenceCount calls */ UT_SetHookFunction(UT_KEY(CFE_MSG_SetSequenceCount), UT_CheckSetSequenceCount, &SeqCnt); @@ -3087,13 +3136,15 @@ void Test_TransmitMsg_SequenceCount(void) */ void Test_TransmitMsg_QueuePutError(void) { - CFE_SB_PipeId_t PipeId4Error; - CFE_SB_MsgId_t MsgId = SB_UT_TLM_MID; + CFE_SB_PipeId_t PipeId4Error = CFE_SB_INVALID_PIPE; + CFE_SB_MsgId_t MsgId = SB_UT_TLM_MID; SB_UT_Test_Tlm_t TlmPkt; int32 PipeDepth = 2; CFE_MSG_Size_t Size = sizeof(TlmPkt); CFE_MSG_Type_t Type = CFE_MSG_Type_Tlm; + memset(&TlmPkt, 0, sizeof(TlmPkt)); + CFE_UtAssert_SETUP(CFE_SB_CreatePipe(&PipeId4Error, PipeDepth, "TestPipe")); CFE_UtAssert_SETUP(CFE_SB_Subscribe(MsgId, PipeId4Error)); UT_SetDeferredRetcode(UT_KEY(OS_QueuePut), 1, OS_ERROR); @@ -3116,13 +3167,15 @@ void Test_TransmitMsg_QueuePutError(void) */ void Test_TransmitMsg_PipeFull(void) { - CFE_SB_PipeId_t PipeId; - CFE_SB_MsgId_t MsgId = SB_UT_TLM_MID; + CFE_SB_PipeId_t PipeId = CFE_SB_INVALID_PIPE; + CFE_SB_MsgId_t MsgId = SB_UT_TLM_MID; SB_UT_Test_Tlm_t TlmPkt; int32 PipeDepth = 1; CFE_MSG_Size_t Size = sizeof(TlmPkt); CFE_MSG_Type_t Type = CFE_MSG_Type_Tlm; + memset(&TlmPkt, 0, sizeof(TlmPkt)); + CFE_UtAssert_SETUP(CFE_SB_CreatePipe(&PipeId, PipeDepth, "PipeFullTestPipe")); CFE_UtAssert_SETUP(CFE_SB_Subscribe(MsgId, PipeId)); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); @@ -3155,13 +3208,15 @@ void Test_TransmitMsg_PipeFull(void) */ void Test_TransmitMsg_MsgLimitExceeded(void) { - CFE_SB_PipeId_t PipeId; - CFE_SB_MsgId_t MsgId = SB_UT_TLM_MID; + CFE_SB_PipeId_t PipeId = CFE_SB_INVALID_PIPE; + CFE_SB_MsgId_t MsgId = SB_UT_TLM_MID; SB_UT_Test_Tlm_t TlmPkt; int32 PipeDepth = 5; CFE_MSG_Size_t Size = sizeof(TlmPkt); CFE_MSG_Type_t Type = CFE_MSG_Type_Tlm; + memset(&TlmPkt, 0, sizeof(TlmPkt)); + CFE_UtAssert_SETUP(CFE_SB_CreatePipe(&PipeId, PipeDepth, "MsgLimTestPipe")); /* Set maximum allowed messages on the pipe at one time to 1 */ @@ -3196,12 +3251,14 @@ void Test_TransmitMsg_MsgLimitExceeded(void) */ void Test_TransmitMsg_GetPoolBufErr(void) { - CFE_SB_PipeId_t PipeId; - CFE_SB_MsgId_t MsgId = SB_UT_TLM_MID; + CFE_SB_PipeId_t PipeId = CFE_SB_INVALID_PIPE; + CFE_SB_MsgId_t MsgId = SB_UT_TLM_MID; SB_UT_Test_Tlm_t TlmPkt; int32 PipeDepth; CFE_MSG_Size_t Size = sizeof(TlmPkt); + memset(&TlmPkt, 0, sizeof(TlmPkt)); + PipeDepth = 1; CFE_UtAssert_SETUP(CFE_SB_CreatePipe(&PipeId, PipeDepth, "GetPoolErrPipe")); CFE_UtAssert_SETUP(CFE_SB_Subscribe(MsgId, PipeId)); @@ -3317,9 +3374,9 @@ void Test_TransmitBuffer_IncrementSeqCnt(void) { CFE_SB_Buffer_t * SendPtr = NULL; CFE_SB_Buffer_t * ReceivePtr = NULL; - CFE_SB_PipeId_t PipeId; - CFE_SB_MsgId_t MsgId = SB_UT_TLM_MID; - uint32 PipeDepth = 10; + CFE_SB_PipeId_t PipeId = CFE_SB_INVALID_PIPE; + CFE_SB_MsgId_t MsgId = SB_UT_TLM_MID; + uint32 PipeDepth = 10; CFE_MSG_SequenceCount_t SeqCnt; CFE_MSG_Size_t Size = sizeof(SB_UT_Test_Tlm_t); CFE_MSG_Type_t Type = CFE_MSG_Type_Tlm; @@ -3383,12 +3440,12 @@ void Test_TransmitBuffer_NoIncrement(void) { CFE_SB_Buffer_t * SendPtr = NULL; CFE_SB_Buffer_t * ReceivePtr = NULL; - CFE_SB_PipeId_t PipeId; - CFE_SB_MsgId_t MsgId = SB_UT_TLM_MID; - uint32 PipeDepth = 10; - CFE_MSG_SequenceCount_t SeqCnt = 22; - CFE_MSG_Size_t Size = sizeof(SB_UT_Test_Tlm_t); - CFE_MSG_Type_t Type = CFE_MSG_Type_Tlm; + CFE_SB_PipeId_t PipeId = CFE_SB_INVALID_PIPE; + CFE_SB_MsgId_t MsgId = SB_UT_TLM_MID; + uint32 PipeDepth = 10; + CFE_MSG_SequenceCount_t SeqCnt = 22; + CFE_MSG_Size_t Size = sizeof(SB_UT_Test_Tlm_t); + CFE_MSG_Type_t Type = CFE_MSG_Type_Tlm; /* Set up hook for checking CFE_MSG_SetSequenceCount calls */ UT_SetHookFunction(UT_KEY(CFE_MSG_SetSequenceCount), UT_CheckSetSequenceCount, &SeqCnt); @@ -3462,8 +3519,8 @@ void Test_ReleaseMessageBuffer(void) */ void Test_TransmitMsg_DisabledDestination(void) { - CFE_SB_PipeId_t PipeId; - CFE_SB_MsgId_t MsgId = SB_UT_TLM_MID; + CFE_SB_PipeId_t PipeId = CFE_SB_INVALID_PIPE; + CFE_SB_MsgId_t MsgId = SB_UT_TLM_MID; SB_UT_Test_Tlm_t TlmPkt; CFE_SB_DestinationD_t *DestPtr; int32 PipeDepth; @@ -3471,6 +3528,8 @@ void Test_TransmitMsg_DisabledDestination(void) CFE_MSG_Size_t Size = sizeof(TlmPkt); CFE_SBR_RouteId_t RouteId; + memset(&TlmPkt, 0, sizeof(TlmPkt)); + PipeDepth = 2; CFE_UtAssert_SETUP(CFE_SB_CreatePipe(&PipeId, PipeDepth, "TestPipe")); @@ -3499,8 +3558,8 @@ void Test_TransmitMsg_DisabledDestination(void) */ void Test_BroadcastBufferToRoute(void) { - CFE_SB_PipeId_t PipeId; - CFE_SB_MsgId_t MsgId = SB_UT_TLM_MID; + CFE_SB_PipeId_t PipeId = CFE_SB_INVALID_PIPE; + CFE_SB_MsgId_t MsgId = SB_UT_TLM_MID; CFE_SB_BufferD_t SBBufD; int32 PipeDepth; CFE_SBR_RouteId_t RouteId; @@ -3540,6 +3599,8 @@ void Test_TransmitMsgValidate_MaxMsgSizePlusOne(void) CFE_MSG_Size_t SizeRtn; CFE_SBR_RouteId_t RouteIdRtn; + memset(&TlmPkt, 0, sizeof(TlmPkt)); + UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); @@ -3565,6 +3626,8 @@ void Test_TransmitMsgValidate_NoSubscribers(void) CFE_MSG_Size_t SizeRtn; CFE_SBR_RouteId_t RouteIdRtn; + memset(&TlmPkt, 0, sizeof(TlmPkt)); + UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); @@ -3590,6 +3653,8 @@ void Test_TransmitMsgValidate_InvalidMsgId(void) CFE_MSG_Size_t SizeRtn; CFE_SBR_RouteId_t RouteIdRtn; + memset(&TlmPkt, 0, sizeof(TlmPkt)); + UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); UtAssert_INT32_EQ(CFE_SB_TransmitMsgValidate(CFE_MSG_PTR(TlmPkt.TelemetryHeader), &MsgIdRtn, &SizeRtn, &RouteIdRtn), @@ -3701,7 +3766,7 @@ void Test_ReceiveBuffer_InvalidPipeId(void) void Test_ReceiveBuffer_InvalidTimeout(void) { CFE_SB_Buffer_t *SBBufPtr; - CFE_SB_PipeId_t PipeId; + CFE_SB_PipeId_t PipeId = CFE_SB_INVALID_PIPE; uint32 PipeDepth = 10; int32 TimeOut = -5; @@ -3725,7 +3790,7 @@ void Test_ReceiveBuffer_InvalidTimeout(void) void Test_ReceiveBuffer_Poll(void) { CFE_SB_Buffer_t *SBBufPtr; - CFE_SB_PipeId_t PipeId; + CFE_SB_PipeId_t PipeId = CFE_SB_INVALID_PIPE; uint32 PipeDepth = 10; CFE_UtAssert_SETUP(CFE_SB_CreatePipe(&PipeId, PipeDepth, "RcvTestPipe")); @@ -3748,7 +3813,7 @@ void Test_ReceiveBuffer_Poll(void) void Test_ReceiveBuffer_Timeout(void) { CFE_SB_Buffer_t *SBBufPtr; - CFE_SB_PipeId_t PipeId; + CFE_SB_PipeId_t PipeId = CFE_SB_INVALID_PIPE; uint32 PipeDepth = 10; int32 TimeOut = 200; @@ -3773,7 +3838,7 @@ void Test_ReceiveBuffer_Timeout(void) void Test_ReceiveBuffer_PipeReadError(void) { CFE_SB_Buffer_t *SBBufPtr; - CFE_SB_PipeId_t PipeId; + CFE_SB_PipeId_t PipeId = CFE_SB_INVALID_PIPE; uint32 PipeDepth = 10; size_t Data = 1; @@ -3804,14 +3869,16 @@ void Test_ReceiveBuffer_PipeReadError(void) void Test_ReceiveBuffer_PendForever(void) { CFE_SB_Buffer_t *SBBufPtr; - CFE_SB_MsgId_t MsgId = SB_UT_TLM_MID; - CFE_SB_PipeId_t PipeId; + CFE_SB_MsgId_t MsgId = SB_UT_TLM_MID; + CFE_SB_PipeId_t PipeId = CFE_SB_INVALID_PIPE; SB_UT_Test_Tlm_t TlmPkt; uint32 PipeDepth = 10; CFE_MSG_Type_t Type = CFE_MSG_Type_Tlm; CFE_MSG_Size_t Size = sizeof(TlmPkt); CFE_SB_PipeD_t * PipeDscPtr; + memset(&TlmPkt, 0, sizeof(TlmPkt)); + CFE_UtAssert_SETUP(CFE_SB_CreatePipe(&PipeId, PipeDepth, "RcvTestPipe")); PipeDscPtr = CFE_SB_LocatePipeDescByID(PipeId); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); @@ -3905,7 +3972,7 @@ void Test_CleanupApp_API(void) */ void Test_ReceiveBuffer_InvalidBufferPtr(void) { - CFE_SB_PipeId_t PipeId; + CFE_SB_PipeId_t PipeId = CFE_SB_INVALID_PIPE; uint32 PipeDepth = 10; CFE_UtAssert_SETUP(CFE_SB_CreatePipe(&PipeId, PipeDepth, "RcvTestPipe")); @@ -3941,6 +4008,8 @@ void Test_CFE_SB_MsgHdrSize(void) bool hassec; CFE_MSG_Type_t type; + memset(&msg, 0, sizeof(msg)); + /* No secondary */ hassec = false; type = CFE_MSG_Type_Invalid; @@ -4030,6 +4099,8 @@ void Test_CFE_SB_GetUserData(void) uint64 payload; } tlm_uint64; + memset(&msg, 0, sizeof(msg)); + /* No secondary */ hassec = false; UT_SetDataBuffer(UT_KEY(CFE_MSG_GetHasSecondaryHeader), &hassec, sizeof(hassec), false); @@ -4085,6 +4156,8 @@ void Test_CFE_SB_SetGetUserDataLength(void) CFE_MSG_Type_t type = CFE_MSG_Type_Invalid; bool hassec = false; + memset(&msg, 0, sizeof(msg)); + /* Pass through functions */ UT_SetDataBuffer(UT_KEY(CFE_MSG_GetHasSecondaryHeader), &hassec, sizeof(hassec), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetType), &type, sizeof(type), false); @@ -4194,7 +4267,7 @@ void Test_UseCount_Rollover_Prevention(void) */ void Test_OS_MutSem_ErrLogic(void) { - CFE_SB_PipeId_t PipeId; + CFE_SB_PipeId_t PipeId = CFE_SB_INVALID_PIPE; CFE_SB_MsgId_t MsgId = SB_UT_CMD_MID; uint16 PipeDepth = 50; @@ -4317,7 +4390,7 @@ void Test_CFE_SB_Buffers(void) */ void Test_CFE_SB_BadPipeInfo(void) { - CFE_SB_PipeId_t PipeId; + CFE_SB_PipeId_t PipeId = CFE_SB_INVALID_PIPE; CFE_SB_PipeD_t *PipeDscPtr; uint16 PipeDepth = 10; CFE_ES_AppId_t AppID; @@ -4362,6 +4435,8 @@ void Test_SB_TransmitMsgPaths_Nominal(void) CFE_MSG_Size_t Size; CFE_MSG_Type_t Type; + memset(&Housekeeping, 0, sizeof(Housekeeping)); + /* Set up for dispatch FIRST */ UT_SetupBasicMsgDispatch(&UT_TPID_CFE_SB_SEND_HK, sizeof(Housekeeping.Cmd), false); @@ -4457,12 +4532,14 @@ void Test_SB_TransmitMsgPaths_Nominal(void) void Test_SB_TransmitMsgPaths_LimitErr(void) { CFE_SB_MsgId_t MsgId; - CFE_SB_PipeId_t PipeId; + CFE_SB_PipeId_t PipeId = CFE_SB_INVALID_PIPE; SB_UT_Test_Tlm_t TlmPkt; int32 PipeDepth = 2; CFE_MSG_Type_t Type = CFE_MSG_Type_Tlm; CFE_MSG_Size_t Size = sizeof(TlmPkt); + memset(&TlmPkt, 0, sizeof(TlmPkt)); + /* Test inhibiting sending a "message ID limit error" message */ MsgId = SB_UT_TLM_MID; CFE_UtAssert_SETUP(CFE_SB_CreatePipe(&PipeId, PipeDepth, "MsgLimTestPipe")); @@ -4494,12 +4571,14 @@ void Test_SB_TransmitMsgPaths_LimitErr(void) void Test_SB_TransmitMsgPaths_FullErr(void) { CFE_SB_MsgId_t MsgId; - CFE_SB_PipeId_t PipeId; + CFE_SB_PipeId_t PipeId = CFE_SB_INVALID_PIPE; SB_UT_Test_Tlm_t TlmPkt; int32 PipeDepth = 2; CFE_MSG_Type_t Type = CFE_MSG_Type_Tlm; CFE_MSG_Size_t Size = sizeof(TlmPkt); + memset(&TlmPkt, 0, sizeof(TlmPkt)); + /* Test inhibiting sending a "pipe full" message */ MsgId = SB_UT_TLM_MID; CFE_UtAssert_SETUP(CFE_SB_CreatePipe(&PipeId, PipeDepth, "PipeFullTestPipe")); @@ -4532,12 +4611,14 @@ void Test_SB_TransmitMsgPaths_FullErr(void) void Test_SB_TransmitMsgPaths_WriteErr(void) { CFE_SB_MsgId_t MsgId; - CFE_SB_PipeId_t PipeId; + CFE_SB_PipeId_t PipeId = CFE_SB_INVALID_PIPE; SB_UT_Test_Tlm_t TlmPkt; int32 PipeDepth = 2; CFE_MSG_Type_t Type = CFE_MSG_Type_Tlm; CFE_MSG_Size_t Size = sizeof(TlmPkt); + memset(&TlmPkt, 0, sizeof(TlmPkt)); + /* Test inhibiting sending a "pipe write error" message */ MsgId = SB_UT_TLM_MID; CFE_UtAssert_SETUP(CFE_SB_CreatePipe(&PipeId, PipeDepth, "TestPipe")); @@ -4569,7 +4650,7 @@ void Test_SB_TransmitMsgPaths_WriteErr(void) void Test_SB_TransmitMsgPaths_IgnoreOpt(void) { CFE_SB_MsgId_t MsgId; - CFE_SB_PipeId_t PipeId; + CFE_SB_PipeId_t PipeId = CFE_SB_INVALID_PIPE; SB_UT_Test_Tlm_t TlmPkt; int32 PipeDepth = 2; CFE_MSG_Type_t Type = CFE_MSG_Type_Tlm; @@ -4577,6 +4658,8 @@ void Test_SB_TransmitMsgPaths_IgnoreOpt(void) CFE_SB_PipeD_t * PipeDscPtr; CFE_ES_AppId_t AppId; + memset(&TlmPkt, 0, sizeof(TlmPkt)); + /* Setup Test skipping sending to a pipe when the pipe option is set to ignore */ MsgId = SB_UT_TLM_MID; CFE_UtAssert_SETUP(CFE_SB_CreatePipe(&PipeId, PipeDepth, "SkipPipe")); @@ -4619,13 +4702,15 @@ void Test_SB_TransmitMsgPaths_IgnoreOpt(void) void Test_ReceiveBuffer_UnsubResubPath(void) { CFE_SB_Buffer_t *SBBufPtr; - CFE_SB_MsgId_t MsgId = SB_UT_TLM_MID; - CFE_SB_PipeId_t PipeId; + CFE_SB_MsgId_t MsgId = SB_UT_TLM_MID; + CFE_SB_PipeId_t PipeId = CFE_SB_INVALID_PIPE; SB_UT_Test_Tlm_t TlmPkt; uint32 PipeDepth = 10; CFE_MSG_Type_t Type = CFE_MSG_Type_Tlm; CFE_MSG_Size_t Size = sizeof(TlmPkt); + memset(&TlmPkt, 0, sizeof(TlmPkt)); + CFE_UtAssert_SETUP(CFE_SB_CreatePipe(&PipeId, PipeDepth, "RcvTestPipe")); CFE_UtAssert_SETUP(CFE_SB_Subscribe(MsgId, PipeId)); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); diff --git a/modules/time/ut-coverage/time_UT.c b/modules/time/ut-coverage/time_UT.c index 1dca60f98..0ea95da1c 100644 --- a/modules/time/ut-coverage/time_UT.c +++ b/modules/time/ut-coverage/time_UT.c @@ -834,6 +834,8 @@ void Test_Print(void) CFE_TIME_SysTime_t time; bool usingDefaultEpoch = true; + memset(&time, 0, sizeof(time)); + UtPrintf("Begin Test Print"); if (CFE_MISSION_TIME_EPOCH_YEAR != 1980 || CFE_MISSION_TIME_EPOCH_DAY != 1 || CFE_MISSION_TIME_EPOCH_HOUR != 0 || @@ -849,9 +851,6 @@ void Test_Print(void) CFE_UtAssert_SYSLOG(TIME_SYSLOG_MSGS[6]); /* Test with zero time value */ - time.Subseconds = 0; - time.Seconds = 0; - CFE_TIME_Print(timeBuf, time); if (usingDefaultEpoch) { @@ -1940,6 +1939,8 @@ void Test_ResetArea(void) { CFE_TIME_Reference_t Reference; + memset(&Reference, 0, sizeof(Reference)); + UtPrintf("Begin Test Reset Area"); /* Test successfully updating the reset area */