From 82ce3202cad449c2dbc28d0209e007666f42ffce Mon Sep 17 00:00:00 2001 From: Jacob Hageman Date: Fri, 29 Jul 2022 10:39:53 -0600 Subject: [PATCH 1/2] Fix #18, Remove UT TODO and clean up associated test --- unit-test/hk_app_tests.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/unit-test/hk_app_tests.c b/unit-test/hk_app_tests.c index 8a82729..7ac3545 100644 --- a/unit-test/hk_app_tests.c +++ b/unit-test/hk_app_tests.c @@ -1191,20 +1191,19 @@ void Test_HK_AppPipe_ProcessIncoming(void) */ void Test_HK_SendCombinedHKCmd(void) { - /* Arrange */ - CFE_SB_Buffer_t DummyBuf; - uint8 call_count_HK_SendCombinedHkPacket; + union + { + CFE_SB_Buffer_t sbbuf; + HK_Send_Out_Msg_t msg; + } msgbuf; - /* TODO set return value of CFE_SB_GetUserData and check input to - HK_SendCombinedHkPacket */ + memset(&msgbuf, 0, sizeof(msgbuf)); /* Act */ - HK_SendCombinedHKCmd(&DummyBuf); - - call_count_HK_SendCombinedHkPacket = UT_GetStubCount(UT_KEY(HK_SendCombinedHkPacket)); + HK_SendCombinedHKCmd(&msgbuf.sbbuf); /* Assert */ - UtAssert_INT32_EQ(call_count_HK_SendCombinedHkPacket, 1); + UtAssert_STUB_COUNT(HK_SendCombinedHkPacket, 1); } /**********************************************************************/ From 96fcd78924e2135dbbba82a033f090494ecc6484 Mon Sep 17 00:00:00 2001 From: Jacob Hageman Date: Fri, 29 Jul 2022 10:40:19 -0600 Subject: [PATCH 2/2] Fix #19, Simplify HK_SendCombindHKCmd and remove stray printfs --- fsw/src/hk_app.c | 6 +----- fsw/src/hk_utils.c | 2 -- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/fsw/src/hk_app.c b/fsw/src/hk_app.c index 61228e2..4d7d951 100644 --- a/fsw/src/hk_app.c +++ b/fsw/src/hk_app.c @@ -396,13 +396,9 @@ void HK_AppPipe(const CFE_SB_Buffer_t *BufPtr) /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ void HK_SendCombinedHKCmd(const CFE_SB_Buffer_t *BufPtr) { - CFE_SB_MsgId_t WhichCombinedPacket = CFE_SB_INVALID_MSG_ID; - HK_Send_Out_Msg_t *CmdPtr = (HK_Send_Out_Msg_t *)BufPtr; - WhichCombinedPacket = CmdPtr->OutMsgToSend; - - HK_SendCombinedHkPacket(WhichCombinedPacket); + HK_SendCombinedHkPacket(CmdPtr->OutMsgToSend); } /* end of HK_SendCombinedHKCmd() */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ diff --git a/fsw/src/hk_utils.c b/fsw/src/hk_utils.c index 13b0d65..4b979ee 100644 --- a/fsw/src/hk_utils.c +++ b/fsw/src/hk_utils.c @@ -153,7 +153,6 @@ int32 HK_ProcessNewCopyTable(hk_copy_table_entry_t *CpyTblPtr, hk_runtime_tbl_en OuterRtEntry->InputMidSubscribed = HK_INPUTMID_NOT_SUBSCRIBED; OuterRtEntry->DataPresent = HK_DATA_NOT_PRESENT; } - printf("after first loop\n"); /* Loop thru the table looking for all of the SB packets that need to be built */ for (Loop1 = 0; Loop1 < HK_COPY_TABLE_ENTRIES; Loop1++) @@ -494,7 +493,6 @@ int32 HK_CheckStatusOfCopyTable(void) /* Status should only be CFE_TBL_INFO_UPDATED because we updated it above */ if (Status == CFE_TBL_INFO_UPDATED) { - printf("Calling HK_ProcessNewCopyTable\n"); Status = HK_ProcessNewCopyTable(HK_AppData.CopyTablePtr, HK_AppData.RuntimeTablePtr); if (Status == CFE_SUCCESS)