From d3784ca5ae697e3ad4a98b67187437133f2bcd07 Mon Sep 17 00:00:00 2001 From: Jacob Hageman Date: Tue, 21 Sep 2021 16:07:34 +0000 Subject: [PATCH] Fix #1969, Confirm sb/time reset requirements in coverage test --- modules/sb/ut-coverage/sb_UT.c | 27 +++++++++++++++++++++++++++ modules/time/ut-coverage/time_UT.c | 20 ++++++++++++++++++++ 2 files changed, 47 insertions(+) diff --git a/modules/sb/ut-coverage/sb_UT.c b/modules/sb/ut-coverage/sb_UT.c index 5027f9705..79bf145ec 100644 --- a/modules/sb/ut-coverage/sb_UT.c +++ b/modules/sb/ut-coverage/sb_UT.c @@ -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 */ /* diff --git a/modules/time/ut-coverage/time_UT.c b/modules/time/ut-coverage/time_UT.c index dde918328..41cdc6b0e 100644 --- a/modules/time/ut-coverage/time_UT.c +++ b/modules/time/ut-coverage/time_UT.c @@ -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));