Skip to content

Commit

Permalink
Fix #1969, Confirm sb/time reset requirements in coverage test
Browse files Browse the repository at this point in the history
  • Loading branch information
skliper committed Sep 21, 2021
1 parent 64a6a59 commit d3784ca
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
27 changes: 27 additions & 0 deletions modules/sb/ut-coverage/sb_UT.c
Original file line number Diff line number Diff line change
Expand Up @@ -1767,8 +1767,35 @@ void Test_SB_EarlyInit_PoolCreateError(void)
*/
void Test_SB_EarlyInit_NoErrors(void)
{
/* Initialize global to nonzero to confirm resets */
memset(&CFE_SB_Global, 0xFF, sizeof(CFE_SB_Global));
CFE_SB_EarlyInit();
CFE_UtAssert_SUCCESS(CFE_SB_EarlyInit());

/* Confirm reset of values to cover reset requirements that are challenging operationaly */
UtAssert_ZERO(CFE_SB_Global.HKTlmMsg.Payload.CommandErrorCounter);
UtAssert_ZERO(CFE_SB_Global.HKTlmMsg.Payload.NoSubscribersCounter);
UtAssert_ZERO(CFE_SB_Global.HKTlmMsg.Payload.MsgSendErrorCounter);
UtAssert_ZERO(CFE_SB_Global.HKTlmMsg.Payload.MsgReceiveErrorCounter);
UtAssert_ZERO(CFE_SB_Global.HKTlmMsg.Payload.InternalErrorCounter);
UtAssert_ZERO(CFE_SB_Global.HKTlmMsg.Payload.CreatePipeErrorCounter);
UtAssert_ZERO(CFE_SB_Global.HKTlmMsg.Payload.SubscribeErrorCounter);
UtAssert_ZERO(CFE_SB_Global.HKTlmMsg.Payload.PipeOptsErrorCounter);
UtAssert_ZERO(CFE_SB_Global.HKTlmMsg.Payload.DuplicateSubscriptionsCounter);
UtAssert_ZERO(CFE_SB_Global.HKTlmMsg.Payload.GetPipeIdByNameErrorCounter);
UtAssert_ZERO(CFE_SB_Global.HKTlmMsg.Payload.PipeOverflowErrorCounter);
UtAssert_ZERO(CFE_SB_Global.HKTlmMsg.Payload.MsgLimitErrorCounter);
UtAssert_ZERO(CFE_SB_Global.StatTlmMsg.Payload.MsgIdsInUse);
UtAssert_ZERO(CFE_SB_Global.StatTlmMsg.Payload.PeakMsgIdsInUse);
UtAssert_ZERO(CFE_SB_Global.StatTlmMsg.Payload.PipesInUse);
UtAssert_ZERO(CFE_SB_Global.StatTlmMsg.Payload.PeakPipesInUse);
UtAssert_ZERO(CFE_SB_Global.StatTlmMsg.Payload.MemInUse);
UtAssert_ZERO(CFE_SB_Global.StatTlmMsg.Payload.PeakMemInUse);
UtAssert_ZERO(CFE_SB_Global.StatTlmMsg.Payload.SubscriptionsInUse);
UtAssert_ZERO(CFE_SB_Global.StatTlmMsg.Payload.PeakSubscriptionsInUse);
UtAssert_ZERO(CFE_SB_Global.StatTlmMsg.Payload.SBBuffersInUse);
UtAssert_ZERO(CFE_SB_Global.StatTlmMsg.Payload.PeakSBBuffersInUse);

} /* end Test_SB_EarlyInit_NoErrors */

/*
Expand Down
20 changes: 20 additions & 0 deletions modules/time/ut-coverage/time_UT.c
Original file line number Diff line number Diff line change
Expand Up @@ -1413,10 +1413,30 @@ void Test_PipeCmds(void)

/* Test sending the reset counters command */
UT_InitData();
CFE_TIME_Global.ToneMatchCounter = 1;
CFE_TIME_Global.ToneMatchErrorCounter = 1;
CFE_TIME_Global.ToneSignalCounter = 1;
CFE_TIME_Global.ToneDataCounter = 1;
CFE_TIME_Global.ToneIntCounter = 1;
CFE_TIME_Global.ToneIntErrorCounter = 1;
CFE_TIME_Global.ToneTaskCounter = 1;
CFE_TIME_Global.LocalIntCounter = 1;
CFE_TIME_Global.LocalTaskCounter = 1;
memset(&CmdBuf, 0, sizeof(CmdBuf));
UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, sizeof(CmdBuf.cmd), UT_TPID_CFE_TIME_CMD_RESET_COUNTERS_CC);
CFE_UtAssert_EVENTSENT(CFE_TIME_RESET_EID);

/* Confirm error counters get reset to help cover requirements that are difficult operationally */
UtAssert_ZERO(CFE_TIME_Global.ToneMatchCounter);
UtAssert_ZERO(CFE_TIME_Global.ToneMatchErrorCounter);
UtAssert_ZERO(CFE_TIME_Global.ToneSignalCounter);
UtAssert_ZERO(CFE_TIME_Global.ToneDataCounter);
UtAssert_ZERO(CFE_TIME_Global.ToneIntCounter);
UtAssert_ZERO(CFE_TIME_Global.ToneIntErrorCounter);
UtAssert_ZERO(CFE_TIME_Global.ToneTaskCounter);
UtAssert_ZERO(CFE_TIME_Global.LocalIntCounter);
UtAssert_ZERO(CFE_TIME_Global.LocalTaskCounter);

/* Reset counters with bad size */
UT_InitData();
memset(&CmdBuf, 0, sizeof(CmdBuf));
Expand Down

0 comments on commit d3784ca

Please sign in to comment.