Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #1969, Confirm sb/time reset requirements in coverage test #1970

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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