Skip to content

Commit

Permalink
Fix nasa#9, Resolve UT static analysis issues
Browse files Browse the repository at this point in the history
  • Loading branch information
skliper committed May 17, 2022
1 parent 050a7ee commit 6d2b81f
Show file tree
Hide file tree
Showing 5 changed files with 212 additions and 79 deletions.
88 changes: 88 additions & 0 deletions unit-test/cs_app_tests.c
Original file line number Diff line number Diff line change
Expand Up @@ -945,6 +945,8 @@ void CS_AppPipe_Test_TableUpdateErrors(void)
CFE_SB_MsgId_t TestMsgId;
size_t MsgSize;

memset(&CmdBuf, 0, sizeof(CmdBuf));

CS_AppData.ChildTaskTable = -1;

TestMsgId = CFE_SB_ValueToMsgId(CS_SEND_HK_MID);
Expand Down Expand Up @@ -973,6 +975,8 @@ void CS_AppPipe_Test_BackgroundCycle(void)
CFE_SB_MsgId_t TestMsgId;
size_t MsgSize;

memset(&CmdBuf, 0, sizeof(CmdBuf));

CS_AppData.ChildTaskTable = -1;

TestMsgId = CFE_SB_ValueToMsgId(CS_BACKGROUND_CYCLE_MID);
Expand Down Expand Up @@ -1000,6 +1004,8 @@ void CS_AppPipe_Test_NoopCmd(void)
CFE_SB_MsgId_t TestMsgId;
CFE_MSG_FcnCode_t FcnCode;

memset(&CmdBuf, 0, sizeof(CmdBuf));

CS_AppData.ChildTaskTable = -1;

TestMsgId = CFE_SB_ValueToMsgId(CS_CMD_MID);
Expand Down Expand Up @@ -1028,6 +1034,8 @@ void CS_AppPipe_Test_ResetCmd(void)
CFE_SB_MsgId_t TestMsgId;
CFE_MSG_FcnCode_t FcnCode;

memset(&CmdBuf, 0, sizeof(CmdBuf));

CS_AppData.ChildTaskTable = -1;

TestMsgId = CFE_SB_ValueToMsgId(CS_CMD_MID);
Expand Down Expand Up @@ -1056,6 +1064,8 @@ void CS_AppPipe_Test_OneShotCmd(void)
CFE_SB_MsgId_t TestMsgId;
CFE_MSG_FcnCode_t FcnCode;

memset(&CmdBuf, 0, sizeof(CmdBuf));

CS_AppData.ChildTaskTable = -1;

TestMsgId = CFE_SB_ValueToMsgId(CS_CMD_MID);
Expand Down Expand Up @@ -1084,6 +1094,8 @@ void CS_AppPipe_Test_CancelOneShotCmd(void)
CFE_SB_MsgId_t TestMsgId;
CFE_MSG_FcnCode_t FcnCode;

memset(&CmdBuf, 0, sizeof(CmdBuf));

CS_AppData.ChildTaskTable = -1;

TestMsgId = CFE_SB_ValueToMsgId(CS_CMD_MID);
Expand Down Expand Up @@ -1112,6 +1124,8 @@ void CS_AppPipe_Test_EnableAllCSCmd(void)
CFE_SB_MsgId_t TestMsgId;
CFE_MSG_FcnCode_t FcnCode;

memset(&CmdBuf, 0, sizeof(CmdBuf));

CS_AppData.ChildTaskTable = -1;

TestMsgId = CFE_SB_ValueToMsgId(CS_CMD_MID);
Expand Down Expand Up @@ -1140,6 +1154,8 @@ void CS_AppPipe_Test_DisableAllCSCmd(void)
CFE_SB_MsgId_t TestMsgId;
CFE_MSG_FcnCode_t FcnCode;

memset(&CmdBuf, 0, sizeof(CmdBuf));

CS_AppData.ChildTaskTable = -1;

TestMsgId = CFE_SB_ValueToMsgId(CS_CMD_MID);
Expand Down Expand Up @@ -1168,6 +1184,8 @@ void CS_AppPipe_Test_EnableCfeCoreCmd(void)
CFE_SB_MsgId_t TestMsgId;
CFE_MSG_FcnCode_t FcnCode;

memset(&CmdBuf, 0, sizeof(CmdBuf));

CS_AppData.ChildTaskTable = -1;

TestMsgId = CFE_SB_ValueToMsgId(CS_CMD_MID);
Expand Down Expand Up @@ -1196,6 +1214,8 @@ void CS_AppPipe_Test_DisableCfeCoreCmd(void)
CFE_SB_MsgId_t TestMsgId;
CFE_MSG_FcnCode_t FcnCode;

memset(&CmdBuf, 0, sizeof(CmdBuf));

CS_AppData.ChildTaskTable = -1;

TestMsgId = CFE_SB_ValueToMsgId(CS_CMD_MID);
Expand Down Expand Up @@ -1224,6 +1244,8 @@ void CS_AppPipe_Test_ReportBaselineCfeCoreCmd(void)
CFE_SB_MsgId_t TestMsgId;
CFE_MSG_FcnCode_t FcnCode;

memset(&CmdBuf, 0, sizeof(CmdBuf));

CS_AppData.ChildTaskTable = -1;

TestMsgId = CFE_SB_ValueToMsgId(CS_CMD_MID);
Expand Down Expand Up @@ -1252,6 +1274,8 @@ void CS_AppPipe_Test_RecomputeBaselineCfeCoreCmd(void)
CFE_SB_MsgId_t TestMsgId;
CFE_MSG_FcnCode_t FcnCode;

memset(&CmdBuf, 0, sizeof(CmdBuf));

CS_AppData.ChildTaskTable = -1;

TestMsgId = CFE_SB_ValueToMsgId(CS_CMD_MID);
Expand Down Expand Up @@ -1280,6 +1304,8 @@ void CS_AppPipe_Test_EnableOSCmd(void)
CFE_SB_MsgId_t TestMsgId;
CFE_MSG_FcnCode_t FcnCode;

memset(&CmdBuf, 0, sizeof(CmdBuf));

CS_AppData.ChildTaskTable = -1;

TestMsgId = CFE_SB_ValueToMsgId(CS_CMD_MID);
Expand Down Expand Up @@ -1308,6 +1334,8 @@ void CS_AppPipe_Test_DisableOSCmd(void)
CFE_SB_MsgId_t TestMsgId;
CFE_MSG_FcnCode_t FcnCode;

memset(&CmdBuf, 0, sizeof(CmdBuf));

CS_AppData.ChildTaskTable = -1;

TestMsgId = CFE_SB_ValueToMsgId(CS_CMD_MID);
Expand Down Expand Up @@ -1336,6 +1364,8 @@ void CS_AppPipe_Test_ReportBaselineOSCmd(void)
CFE_SB_MsgId_t TestMsgId;
CFE_MSG_FcnCode_t FcnCode;

memset(&CmdBuf, 0, sizeof(CmdBuf));

CS_AppData.ChildTaskTable = -1;

TestMsgId = CFE_SB_ValueToMsgId(CS_CMD_MID);
Expand Down Expand Up @@ -1364,6 +1394,8 @@ void CS_AppPipe_Test_RecomputeBaselineOSCmd(void)
CFE_SB_MsgId_t TestMsgId;
CFE_MSG_FcnCode_t FcnCode;

memset(&CmdBuf, 0, sizeof(CmdBuf));

CS_AppData.ChildTaskTable = -1;

TestMsgId = CFE_SB_ValueToMsgId(CS_CMD_MID);
Expand Down Expand Up @@ -1392,6 +1424,8 @@ void CS_AppPipe_Test_EnableEepromCmd(void)
CFE_SB_MsgId_t TestMsgId;
CFE_MSG_FcnCode_t FcnCode;

memset(&CmdBuf, 0, sizeof(CmdBuf));

CS_AppData.ChildTaskTable = -1;

TestMsgId = CFE_SB_ValueToMsgId(CS_CMD_MID);
Expand Down Expand Up @@ -1420,6 +1454,8 @@ void CS_AppPipe_Test_DisableEepromCmd(void)
CFE_SB_MsgId_t TestMsgId;
CFE_MSG_FcnCode_t FcnCode;

memset(&CmdBuf, 0, sizeof(CmdBuf));

CS_AppData.ChildTaskTable = -1;

TestMsgId = CFE_SB_ValueToMsgId(CS_CMD_MID);
Expand Down Expand Up @@ -1448,6 +1484,8 @@ void CS_AppPipe_Test_ReportBaselineEntryIDEepromCmd(void)
CFE_SB_MsgId_t TestMsgId;
CFE_MSG_FcnCode_t FcnCode;

memset(&CmdBuf, 0, sizeof(CmdBuf));

CS_AppData.ChildTaskTable = -1;

TestMsgId = CFE_SB_ValueToMsgId(CS_CMD_MID);
Expand Down Expand Up @@ -1476,6 +1514,8 @@ void CS_AppPipe_Test_RecomputeBaselineEepromCmd(void)
CFE_SB_MsgId_t TestMsgId;
CFE_MSG_FcnCode_t FcnCode;

memset(&CmdBuf, 0, sizeof(CmdBuf));

CS_AppData.ChildTaskTable = -1;

TestMsgId = CFE_SB_ValueToMsgId(CS_CMD_MID);
Expand Down Expand Up @@ -1504,6 +1544,8 @@ void CS_AppPipe_Test_EnableEntryIDEepromCmd(void)
CFE_SB_MsgId_t TestMsgId;
CFE_MSG_FcnCode_t FcnCode;

memset(&CmdBuf, 0, sizeof(CmdBuf));

CS_AppData.ChildTaskTable = -1;

TestMsgId = CFE_SB_ValueToMsgId(CS_CMD_MID);
Expand Down Expand Up @@ -1532,6 +1574,8 @@ void CS_AppPipe_Test_DisableEntryIDEepromCmd(void)
CFE_SB_MsgId_t TestMsgId;
CFE_MSG_FcnCode_t FcnCode;

memset(&CmdBuf, 0, sizeof(CmdBuf));

CS_AppData.ChildTaskTable = -1;

TestMsgId = CFE_SB_ValueToMsgId(CS_CMD_MID);
Expand Down Expand Up @@ -1560,6 +1604,8 @@ void CS_AppPipe_Test_GetEntryIDEepromCmd(void)
CFE_SB_MsgId_t TestMsgId;
CFE_MSG_FcnCode_t FcnCode;

memset(&CmdBuf, 0, sizeof(CmdBuf));

CS_AppData.ChildTaskTable = -1;

TestMsgId = CFE_SB_ValueToMsgId(CS_CMD_MID);
Expand Down Expand Up @@ -1588,6 +1634,8 @@ void CS_AppPipe_Test_EnableMemoryCmd(void)
CFE_SB_MsgId_t TestMsgId;
CFE_MSG_FcnCode_t FcnCode;

memset(&CmdBuf, 0, sizeof(CmdBuf));

CS_AppData.ChildTaskTable = -1;

TestMsgId = CFE_SB_ValueToMsgId(CS_CMD_MID);
Expand Down Expand Up @@ -1616,6 +1664,8 @@ void CS_AppPipe_Test_DisableMemoryCmd(void)
CFE_SB_MsgId_t TestMsgId;
CFE_MSG_FcnCode_t FcnCode;

memset(&CmdBuf, 0, sizeof(CmdBuf));

CS_AppData.ChildTaskTable = -1;

TestMsgId = CFE_SB_ValueToMsgId(CS_CMD_MID);
Expand Down Expand Up @@ -1644,6 +1694,8 @@ void CS_AppPipe_Test_ReportBaselineEntryIDMemoryCmd(void)
CFE_SB_MsgId_t TestMsgId;
CFE_MSG_FcnCode_t FcnCode;

memset(&CmdBuf, 0, sizeof(CmdBuf));

CS_AppData.ChildTaskTable = -1;

TestMsgId = CFE_SB_ValueToMsgId(CS_CMD_MID);
Expand Down Expand Up @@ -1672,6 +1724,8 @@ void CS_AppPipe_Test_RecomputeBaselineMemoryCmd(void)
CFE_SB_MsgId_t TestMsgId;
CFE_MSG_FcnCode_t FcnCode;

memset(&CmdBuf, 0, sizeof(CmdBuf));

CS_AppData.ChildTaskTable = -1;

TestMsgId = CFE_SB_ValueToMsgId(CS_CMD_MID);
Expand Down Expand Up @@ -1700,6 +1754,8 @@ void CS_AppPipe_Test_EnableEntryIDMemoryCmd(void)
CFE_SB_MsgId_t TestMsgId;
CFE_MSG_FcnCode_t FcnCode;

memset(&CmdBuf, 0, sizeof(CmdBuf));

CS_AppData.ChildTaskTable = -1;

TestMsgId = CFE_SB_ValueToMsgId(CS_CMD_MID);
Expand Down Expand Up @@ -1728,6 +1784,8 @@ void CS_AppPipe_Test_DisableEntryIDMemoryCmd(void)
CFE_SB_MsgId_t TestMsgId;
CFE_MSG_FcnCode_t FcnCode;

memset(&CmdBuf, 0, sizeof(CmdBuf));

CS_AppData.ChildTaskTable = -1;

TestMsgId = CFE_SB_ValueToMsgId(CS_CMD_MID);
Expand Down Expand Up @@ -1756,6 +1814,8 @@ void CS_AppPipe_Test_GetEntryIDMemoryCmd(void)
CFE_SB_MsgId_t TestMsgId;
CFE_MSG_FcnCode_t FcnCode;

memset(&CmdBuf, 0, sizeof(CmdBuf));

CS_AppData.ChildTaskTable = -1;

TestMsgId = CFE_SB_ValueToMsgId(CS_CMD_MID);
Expand Down Expand Up @@ -1784,6 +1844,8 @@ void CS_AppPipe_Test_EnableTablesCmd(void)
CFE_SB_MsgId_t TestMsgId;
CFE_MSG_FcnCode_t FcnCode;

memset(&CmdBuf, 0, sizeof(CmdBuf));

CS_AppData.ChildTaskTable = -1;

TestMsgId = CFE_SB_ValueToMsgId(CS_CMD_MID);
Expand Down Expand Up @@ -1812,6 +1874,8 @@ void CS_AppPipe_Test_DisableTablesCmd(void)
CFE_SB_MsgId_t TestMsgId;
CFE_MSG_FcnCode_t FcnCode;

memset(&CmdBuf, 0, sizeof(CmdBuf));

CS_AppData.ChildTaskTable = -1;

TestMsgId = CFE_SB_ValueToMsgId(CS_CMD_MID);
Expand Down Expand Up @@ -1840,6 +1904,8 @@ void CS_AppPipe_Test_ReportBaselineTablesCmd(void)
CFE_SB_MsgId_t TestMsgId;
CFE_MSG_FcnCode_t FcnCode;

memset(&CmdBuf, 0, sizeof(CmdBuf));

CS_AppData.ChildTaskTable = -1;

TestMsgId = CFE_SB_ValueToMsgId(CS_CMD_MID);
Expand Down Expand Up @@ -1868,6 +1934,8 @@ void CS_AppPipe_Test_RecomputeBaselineTablesCmd(void)
CFE_SB_MsgId_t TestMsgId;
CFE_MSG_FcnCode_t FcnCode;

memset(&CmdBuf, 0, sizeof(CmdBuf));

CS_AppData.ChildTaskTable = -1;

TestMsgId = CFE_SB_ValueToMsgId(CS_CMD_MID);
Expand Down Expand Up @@ -1896,6 +1964,8 @@ void CS_AppPipe_Test_EnableNameTablesCmd(void)
CFE_SB_MsgId_t TestMsgId;
CFE_MSG_FcnCode_t FcnCode;

memset(&CmdBuf, 0, sizeof(CmdBuf));

CS_AppData.ChildTaskTable = -1;

TestMsgId = CFE_SB_ValueToMsgId(CS_CMD_MID);
Expand Down Expand Up @@ -1924,6 +1994,8 @@ void CS_AppPipe_Test_DisableNameTablesCmd(void)
CFE_SB_MsgId_t TestMsgId;
CFE_MSG_FcnCode_t FcnCode;

memset(&CmdBuf, 0, sizeof(CmdBuf));

CS_AppData.ChildTaskTable = -1;

TestMsgId = CFE_SB_ValueToMsgId(CS_CMD_MID);
Expand Down Expand Up @@ -1952,6 +2024,8 @@ void CS_AppPipe_Test_EnableAppCmd(void)
CFE_SB_MsgId_t TestMsgId;
CFE_MSG_FcnCode_t FcnCode;

memset(&CmdBuf, 0, sizeof(CmdBuf));

CS_AppData.ChildTaskTable = -1;

TestMsgId = CFE_SB_ValueToMsgId(CS_CMD_MID);
Expand Down Expand Up @@ -1980,6 +2054,8 @@ void CS_AppPipe_Test_DisableAppCmd(void)
CFE_SB_MsgId_t TestMsgId;
CFE_MSG_FcnCode_t FcnCode;

memset(&CmdBuf, 0, sizeof(CmdBuf));

CS_AppData.ChildTaskTable = -1;

TestMsgId = CFE_SB_ValueToMsgId(CS_CMD_MID);
Expand Down Expand Up @@ -2008,6 +2084,8 @@ void CS_AppPipe_Test_ReportBaselineAppCmd(void)
CFE_SB_MsgId_t TestMsgId;
CFE_MSG_FcnCode_t FcnCode;

memset(&CmdBuf, 0, sizeof(CmdBuf));

CS_AppData.ChildTaskTable = -1;

TestMsgId = CFE_SB_ValueToMsgId(CS_CMD_MID);
Expand Down Expand Up @@ -2036,6 +2114,8 @@ void CS_AppPipe_Test_RecomputeBaselineAppCmd(void)
CFE_SB_MsgId_t TestMsgId;
CFE_MSG_FcnCode_t FcnCode;

memset(&CmdBuf, 0, sizeof(CmdBuf));

CS_AppData.ChildTaskTable = -1;

TestMsgId = CFE_SB_ValueToMsgId(CS_CMD_MID);
Expand Down Expand Up @@ -2064,6 +2144,8 @@ void CS_AppPipe_Test_EnableNameAppCmd(void)
CFE_SB_MsgId_t TestMsgId;
CFE_MSG_FcnCode_t FcnCode;

memset(&CmdBuf, 0, sizeof(CmdBuf));

CS_AppData.ChildTaskTable = -1;

TestMsgId = CFE_SB_ValueToMsgId(CS_CMD_MID);
Expand Down Expand Up @@ -2092,6 +2174,8 @@ void CS_AppPipe_Test_DisableNameAppCmd(void)
CFE_SB_MsgId_t TestMsgId;
CFE_MSG_FcnCode_t FcnCode;

memset(&CmdBuf, 0, sizeof(CmdBuf));

CS_AppData.ChildTaskTable = -1;

TestMsgId = CFE_SB_ValueToMsgId(CS_CMD_MID);
Expand Down Expand Up @@ -2122,6 +2206,8 @@ void CS_AppPipe_Test_InvalidCCError(void)
int32 strCmpResult;
char ExpectedEventString[CFE_MISSION_EVS_MAX_MESSAGE_LENGTH];

memset(&CmdBuf, 0, sizeof(CmdBuf));

snprintf(ExpectedEventString, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH,
"Invalid ground command code: ID = 0x%%08lX, CC = %%d");

Expand Down Expand Up @@ -2161,6 +2247,8 @@ void CS_AppPipe_Test_InvalidMIDError(void)
int32 strCmpResult;
char ExpectedEventString[CFE_MISSION_EVS_MAX_MESSAGE_LENGTH];

memset(&CmdBuf, 0, sizeof(CmdBuf));

snprintf(ExpectedEventString, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH, "Invalid command pipe message ID: 0x%%08lX");

CS_AppData.ChildTaskTable = -1;
Expand Down
Loading

0 comments on commit 6d2b81f

Please sign in to comment.