From 5cb25f537c6a37b7dfb8a6f66ba61f64b7636c95 Mon Sep 17 00:00:00 2001 From: havencarlson Date: Wed, 20 Sep 2023 11:06:03 -0400 Subject: [PATCH 1/9] Fix #116, Removed command header from payload struct --- fsw/inc/ds_msg.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/fsw/inc/ds_msg.h b/fsw/inc/ds_msg.h index 4f31b74..271a9ba 100644 --- a/fsw/inc/ds_msg.h +++ b/fsw/inc/ds_msg.h @@ -407,8 +407,6 @@ typedef struct */ typedef struct { - CFE_MSG_CommandHeader_t CommandHeader; /**< \brief cFE Software Bus command message header */ - CFE_SB_MsgId_t MessageID; /**< \brief Message ID to add to Packet Filter Table */ } DS_AddRemoveMid_Payload_t; From f600acdfd456cf691f229e457174047c8a410fb6 Mon Sep 17 00:00:00 2001 From: Isaac Rowe <9010221+irowebbn@users.noreply.github.com.> Date: Thu, 30 Nov 2023 15:32:44 -0600 Subject: [PATCH 2/9] Fix #111: Use correct length filename for too large test --- unit-test/ds_file_tests.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/unit-test/ds_file_tests.c b/unit-test/ds_file_tests.c index 4fc8469..f978e31 100644 --- a/unit-test/ds_file_tests.c +++ b/unit-test/ds_file_tests.c @@ -960,12 +960,15 @@ void DS_FileCloseDest_Test_PlatformConfigMoveFiles_MoveError(void) void DS_FileCloseDest_Test_PlatformConfigMoveFiles_FilenameTooLarge(void) { int32 FileIndex = 0; - + const char DirName[] = "directory1/"; + /* Set up the handle */ OS_OpenCreate(&DS_AppData.FileStatus[FileIndex].FileHandle, NULL, 0, 0); - - strncpy(DS_AppData.FileStatus[FileIndex].FileName, "directory1/filenamefilenamefilenamefilenamefilenamefilename", - sizeof(DS_AppData.FileStatus[FileIndex].FileName)); + + size_t DirNameLen = sizeof(DirName); + strncpy(DS_AppData.FileStatus[FileIndex].FileName, DirName, DirNameLen); + memset(&DS_AppData.FileStatus[FileIndex].FileName[DirNameLen-1], 'f', DS_TOTAL_FNAME_BUFSIZE - DirNameLen); + DS_AppData.FileStatus[FileIndex].FileName[DS_TOTAL_FNAME_BUFSIZE-1] = '\0'; strncpy(DS_AppData.DestFileTblPtr->File[FileIndex].Movename, "directory2/movename/", sizeof(DS_AppData.DestFileTblPtr->File[FileIndex].Movename)); From dc14784896f488d635694c0fd587c31937a7db35 Mon Sep 17 00:00:00 2001 From: Joseph Hickey Date: Wed, 13 Dec 2023 09:09:45 -0500 Subject: [PATCH 3/9] Fix #119, remove dependency on MID_BASE defines Any nonzero value will work --- unit-test/utilities/ds_test_utils.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/unit-test/utilities/ds_test_utils.h b/unit-test/utilities/ds_test_utils.h index 2b09a2e..6be0765 100644 --- a/unit-test/utilities/ds_test_utils.h +++ b/unit-test/utilities/ds_test_utils.h @@ -81,8 +81,8 @@ extern UT_CmdBuf_t UT_CmdBuf; #define UT_DS_TEST_ADD(test) UtTest_Add(test, DS_Test_Setup, DS_Test_TearDown, #test) /* Unit test MID */ -#define DS_UT_MID_1 CFE_SB_ValueToMsgId(CFE_PLATFORM_TLM_MID_BASE + 1) -#define DS_UT_MID_2 CFE_SB_ValueToMsgId(CFE_PLATFORM_TLM_MID_BASE + 2) +#define DS_UT_MID_1 CFE_SB_ValueToMsgId(1) +#define DS_UT_MID_2 CFE_SB_ValueToMsgId(2) /* Unit test osal ID, generic w/ no type */ #define DS_UT_OBJID_1 OS_ObjectIdFromInteger(1) From 9f6138ac9f518bbaa2af551ef1d2a172ce305c44 Mon Sep 17 00:00:00 2001 From: Joseph Hickey Date: Wed, 10 Jan 2024 17:46:46 -0500 Subject: [PATCH 4/9] Fix #121, correct casting on printf format strings --- fsw/src/ds_app.c | 3 ++- fsw/src/ds_file.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/fsw/src/ds_app.c b/fsw/src/ds_app.c index fd62468..9f7b74b 100644 --- a/fsw/src/ds_app.c +++ b/fsw/src/ds_app.c @@ -365,7 +365,8 @@ void DS_AppSendHkCmd(void) /* If the filter table name is invalid, send an event and erase any * stale/misleading filename from the HK packet */ CFE_EVS_SendEvent(DS_APPHK_FILTER_TBL_ERR_EID, CFE_EVS_EventType_ERROR, - "Invalid filter tbl name in DS_AppSendHkCmd. Name=%s, Err=0x%08X", FilterTblName, Status); + "Invalid filter tbl name in DS_AppSendHkCmd. Name=%s, Err=0x%08X", FilterTblName, + (unsigned int)Status); memset(PayloadPtr->FilterTblFilename, 0, sizeof(PayloadPtr->FilterTblFilename)); } diff --git a/fsw/src/ds_file.c b/fsw/src/ds_file.c index b9fd4a4..f6fd76b 100644 --- a/fsw/src/ds_file.c +++ b/fsw/src/ds_file.c @@ -861,7 +861,7 @@ void DS_FileCloseDest(int32 FileIndex) */ CFE_EVS_SendEvent(DS_MOVE_FILE_ERR_EID, CFE_EVS_EventType_ERROR, "FILE MOVE error: src = '%s', tgt = '%s', result = %d", FileStatus->FileName, - PathName, OS_result); + PathName, (int)OS_result); } } else From f2b9d11865b70160ba85e5fdd31a595307aa049d Mon Sep 17 00:00:00 2001 From: jdfiguer Date: Tue, 23 Jan 2024 14:57:19 -0500 Subject: [PATCH 5/9] Fix #115, Adds distinct identifiers from command name --- fsw/src/ds_cmds.c | 54 +++++++++++++++++++++++------------------------ 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/fsw/src/ds_cmds.c b/fsw/src/ds_cmds.c index 99bad20..581f034 100644 --- a/fsw/src/ds_cmds.c +++ b/fsw/src/ds_cmds.c @@ -962,11 +962,11 @@ void DS_SetDestCountCmd(const CFE_SB_Buffer_t *BufPtr) void DS_CloseFileCmd(const CFE_SB_Buffer_t *BufPtr) { - const DS_CloseFile_Payload_t *DS_CloseFileCmd; + const DS_CloseFile_Payload_t *PayloadPtr; - DS_CloseFileCmd = DS_GET_CMD_PAYLOAD(BufPtr, DS_CloseFileCmd_t); + PayloadPtr = DS_GET_CMD_PAYLOAD(BufPtr, DS_CloseFileCmd_t); - if (DS_TableVerifyFileIndex(DS_CloseFileCmd->FileTableIndex) == false) + if (DS_TableVerifyFileIndex(PayloadPtr->FileTableIndex) == false) { /* ** Invalid destination file table index... @@ -975,23 +975,23 @@ void DS_CloseFileCmd(const CFE_SB_Buffer_t *BufPtr) CFE_EVS_SendEvent(DS_CLOSE_CMD_ERR_EID, CFE_EVS_EventType_ERROR, "Invalid DEST CLOSE command arg: file table index = %d", - (int)DS_CloseFileCmd->FileTableIndex); + (int)PayloadPtr->FileTableIndex); } else { /* ** Close destination file (if the file was open)... */ - if (OS_ObjectIdDefined(DS_AppData.FileStatus[DS_CloseFileCmd->FileTableIndex].FileHandle)) + if (OS_ObjectIdDefined(DS_AppData.FileStatus[PayloadPtr->FileTableIndex].FileHandle)) { - DS_FileUpdateHeader(DS_CloseFileCmd->FileTableIndex); - DS_FileCloseDest(DS_CloseFileCmd->FileTableIndex); + DS_FileUpdateHeader(PayloadPtr->FileTableIndex); + DS_FileCloseDest(PayloadPtr->FileTableIndex); } DS_AppData.CmdAcceptedCounter++; CFE_EVS_SendEvent(DS_CLOSE_CMD_EID, CFE_EVS_EventType_INFORMATION, "DEST CLOSE command: file table index = %d", - (int)DS_CloseFileCmd->FileTableIndex); + (int)PayloadPtr->FileTableIndex); } } @@ -1115,16 +1115,16 @@ void DS_GetFileInfoCmd(const CFE_SB_Buffer_t *BufPtr) void DS_AddMIDCmd(const CFE_SB_Buffer_t *BufPtr) { - const DS_AddRemoveMid_Payload_t *DS_AddMidCmd; + const DS_AddRemoveMid_Payload_t *PayloadPtr; DS_PacketEntry_t * pPacketEntry = NULL; DS_FilterParms_t * pFilterParms = NULL; int32 FilterTableIndex = 0; int32 HashTableIndex = 0; int32 i = 0; - DS_AddMidCmd = DS_GET_CMD_PAYLOAD(BufPtr, DS_AddMidCmd_t); + PayloadPtr = DS_GET_CMD_PAYLOAD(BufPtr, DS_AddMidCmd_t); - if (!CFE_SB_IsValidMsgId(DS_AddMidCmd->MessageID)) + if (!CFE_SB_IsValidMsgId(PayloadPtr->MessageID)) { /* ** Invalid packet message ID - can be anything but unused... @@ -1133,7 +1133,7 @@ void DS_AddMIDCmd(const CFE_SB_Buffer_t *BufPtr) CFE_EVS_SendEvent(DS_ADD_MID_CMD_ERR_EID, CFE_EVS_EventType_ERROR, "Invalid ADD MID command arg: invalid MID = 0x%08lX", - (unsigned long)CFE_SB_MsgIdToValue(DS_AddMidCmd->MessageID)); + (unsigned long)CFE_SB_MsgIdToValue(PayloadPtr->MessageID)); } else if (DS_AppData.FilterTblPtr == (DS_FilterTable_t *)NULL) { @@ -1145,7 +1145,7 @@ void DS_AddMIDCmd(const CFE_SB_Buffer_t *BufPtr) CFE_EVS_SendEvent(DS_ADD_MID_CMD_ERR_EID, CFE_EVS_EventType_ERROR, "Invalid ADD MID command: filter table is not loaded"); } - else if ((FilterTableIndex = DS_TableFindMsgID(DS_AddMidCmd->MessageID)) != DS_INDEX_NONE) + else if ((FilterTableIndex = DS_TableFindMsgID(PayloadPtr->MessageID)) != DS_INDEX_NONE) { /* ** New message ID is already in packet filter table... @@ -1154,7 +1154,7 @@ void DS_AddMIDCmd(const CFE_SB_Buffer_t *BufPtr) CFE_EVS_SendEvent(DS_ADD_MID_CMD_ERR_EID, CFE_EVS_EventType_ERROR, "Invalid ADD MID command: MID = 0x%08lX is already in filter table at index = %d", - (unsigned long)CFE_SB_MsgIdToValue(DS_AddMidCmd->MessageID), (int)FilterTableIndex); + (unsigned long)CFE_SB_MsgIdToValue(PayloadPtr->MessageID), (int)FilterTableIndex); } else if ((FilterTableIndex = DS_TableFindMsgID(CFE_SB_INVALID_MSG_ID)) == DS_INDEX_NONE) { @@ -1173,10 +1173,10 @@ void DS_AddMIDCmd(const CFE_SB_Buffer_t *BufPtr) */ pPacketEntry = &DS_AppData.FilterTblPtr->Packet[FilterTableIndex]; - pPacketEntry->MessageID = DS_AddMidCmd->MessageID; + pPacketEntry->MessageID = PayloadPtr->MessageID; /* Add the message ID to the hash table as well */ - HashTableIndex = DS_TableAddMsgID(DS_AddMidCmd->MessageID, FilterTableIndex); + HashTableIndex = DS_TableAddMsgID(PayloadPtr->MessageID, FilterTableIndex); for (i = 0; i < DS_FILTERS_PER_PACKET; i++) { @@ -1190,7 +1190,7 @@ void DS_AddMIDCmd(const CFE_SB_Buffer_t *BufPtr) pFilterParms->Algorithm_O = 0; } - CFE_SB_SubscribeEx(DS_AddMidCmd->MessageID, DS_AppData.CmdPipe, CFE_SB_DEFAULT_QOS, DS_PER_PACKET_PIPE_LIMIT); + CFE_SB_SubscribeEx(PayloadPtr->MessageID, DS_AppData.CmdPipe, CFE_SB_DEFAULT_QOS, DS_PER_PACKET_PIPE_LIMIT); /* ** Notify cFE that we have modified the table data... */ @@ -1200,7 +1200,7 @@ void DS_AddMIDCmd(const CFE_SB_Buffer_t *BufPtr) CFE_EVS_SendEvent(DS_ADD_MID_CMD_EID, CFE_EVS_EventType_INFORMATION, "ADD MID command: MID = 0x%08lX, filter index = %d, hash index = %d", - (unsigned long)CFE_SB_MsgIdToValue(DS_AddMidCmd->MessageID), (int)FilterTableIndex, + (unsigned long)CFE_SB_MsgIdToValue(PayloadPtr->MessageID), (int)FilterTableIndex, (int)HashTableIndex); } } @@ -1213,7 +1213,7 @@ void DS_AddMIDCmd(const CFE_SB_Buffer_t *BufPtr) void DS_RemoveMIDCmd(const CFE_SB_Buffer_t *BufPtr) { - const DS_AddRemoveMid_Payload_t *DS_RemoveMidCmd; + const DS_AddRemoveMid_Payload_t *PayloadPtr; DS_PacketEntry_t *pPacketEntry = NULL; DS_FilterParms_t *pFilterParms = NULL; @@ -1221,10 +1221,10 @@ void DS_RemoveMIDCmd(const CFE_SB_Buffer_t *BufPtr) int32 HashTableIndex = 0; int32 i = 0; - DS_RemoveMidCmd = DS_GET_CMD_PAYLOAD(BufPtr, DS_RemoveMidCmd_t); - FilterTableIndex = DS_TableFindMsgID(DS_RemoveMidCmd->MessageID); + PayloadPtr = DS_GET_CMD_PAYLOAD(BufPtr, DS_RemoveMidCmd_t); + FilterTableIndex = DS_TableFindMsgID(PayloadPtr->MessageID); - if (!CFE_SB_IsValidMsgId(DS_RemoveMidCmd->MessageID)) + if (!CFE_SB_IsValidMsgId(PayloadPtr->MessageID)) { /* ** Invalid packet message ID - can be anything but unused... @@ -1233,7 +1233,7 @@ void DS_RemoveMIDCmd(const CFE_SB_Buffer_t *BufPtr) CFE_EVS_SendEvent(DS_REMOVE_MID_CMD_ERR_EID, CFE_EVS_EventType_ERROR, "Invalid REMOVE MID command arg: invalid MID = 0x%08lX", - (unsigned long)CFE_SB_MsgIdToValue(DS_RemoveMidCmd->MessageID)); + (unsigned long)CFE_SB_MsgIdToValue(PayloadPtr->MessageID)); } else if (DS_AppData.FilterTblPtr == (DS_FilterTable_t *)NULL) { @@ -1254,12 +1254,12 @@ void DS_RemoveMIDCmd(const CFE_SB_Buffer_t *BufPtr) CFE_EVS_SendEvent(DS_REMOVE_MID_CMD_ERR_EID, CFE_EVS_EventType_ERROR, "Invalid REMOVE MID command: MID = 0x%08lX is not in filter table", - (unsigned long)CFE_SB_MsgIdToValue(DS_RemoveMidCmd->MessageID)); + (unsigned long)CFE_SB_MsgIdToValue(PayloadPtr->MessageID)); } else { /* Convert MID into hash table index */ - HashTableIndex = DS_TableHashFunction(DS_RemoveMidCmd->MessageID); + HashTableIndex = DS_TableHashFunction(PayloadPtr->MessageID); /* ** Reset used packet filter entry for used message ID... @@ -1283,7 +1283,7 @@ void DS_RemoveMIDCmd(const CFE_SB_Buffer_t *BufPtr) pFilterParms->Algorithm_O = 0; } - CFE_SB_Unsubscribe(DS_RemoveMidCmd->MessageID, DS_AppData.CmdPipe); + CFE_SB_Unsubscribe(PayloadPtr->MessageID, DS_AppData.CmdPipe); /* ** Notify cFE that we have modified the table data... @@ -1294,7 +1294,7 @@ void DS_RemoveMIDCmd(const CFE_SB_Buffer_t *BufPtr) CFE_EVS_SendEvent(DS_REMOVE_MID_CMD_EID, CFE_EVS_EventType_INFORMATION, "REMOVE MID command: MID = 0x%08lX, filter index = %d, hash index = %d", - (unsigned long)CFE_SB_MsgIdToValue(DS_RemoveMidCmd->MessageID), (int)FilterTableIndex, + (unsigned long)CFE_SB_MsgIdToValue(PayloadPtr->MessageID), (int)FilterTableIndex, (int)HashTableIndex); } } From 20236a4616681e029d7f3e4e1d6a4e3df1758436 Mon Sep 17 00:00:00 2001 From: jdfiguer Date: Thu, 15 Feb 2024 13:28:07 -0500 Subject: [PATCH 6/9] Fix #125, Adds utassert macro for logging function calls --- unit-test/ds_app_tests.c | 22 +++--- unit-test/ds_cmds_tests.c | 124 ++++++++++++++++----------------- unit-test/ds_dispatch_tests.c | 90 ++++++++++++------------ unit-test/ds_file_tests.c | 126 ++++++++++++---------------------- 4 files changed, 161 insertions(+), 201 deletions(-) diff --git a/unit-test/ds_app_tests.c b/unit-test/ds_app_tests.c index 7d136bf..63e9c78 100644 --- a/unit-test/ds_app_tests.c +++ b/unit-test/ds_app_tests.c @@ -75,7 +75,7 @@ void DS_AppMain_Test_Nominal(void) UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &forced_Size, sizeof(forced_Size), false); /* Execute the function being tested */ - DS_AppMain(); + UtAssert_VOIDCALL(DS_AppMain()); /* Verify results */ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); @@ -95,7 +95,7 @@ void DS_AppMain_Test_AppInitializeError(void) UT_SetDeferredRetcode(UT_KEY(CFE_EVS_Register), 1, -1); /* Execute the function being tested */ - DS_AppMain(); + UtAssert_VOIDCALL(DS_AppMain()); /* Verify results */ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); @@ -115,7 +115,7 @@ void DS_AppMain_Test_SBError(void) UT_SetDefaultReturnValue(UT_KEY(CFE_SB_ReceiveBuffer), CFE_SB_PIPE_RD_ERR); /* Execute the function being tested */ - DS_AppMain(); + UtAssert_VOIDCALL(DS_AppMain()); /* Verify results */ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 2); @@ -135,7 +135,7 @@ void DS_AppMain_Test_SBTimeout(void) UT_SetDefaultReturnValue(UT_KEY(CFE_SB_ReceiveBuffer), CFE_SB_TIME_OUT); /* Execute the function being tested */ - DS_AppMain(); + UtAssert_VOIDCALL(DS_AppMain()); /* Verify results */ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 2); @@ -259,7 +259,7 @@ void DS_AppSendHkCmd_Test(void) } /* Execute the function being tested */ - DS_AppSendHkCmd(); + UtAssert_VOIDCALL(DS_AppSendHkCmd()); /* Verify results */ UtAssert_UINT32_EQ(DS_AppData.FileStatus[0].FileRate, 99 / DS_SECS_PER_HK_CYCLE); @@ -293,7 +293,7 @@ void DS_AppSendHkCmd_Test_SnprintfFail(void) UT_SetDeferredRetcode(UT_KEY(stub_snprintf), 1, -1); /* Execute the function being tested */ - DS_AppSendHkCmd(); + UtAssert_VOIDCALL(DS_AppSendHkCmd()); /* Verify results */ UtAssert_UINT32_EQ(DS_AppData.FileStatus[0].FileRate, 99 / DS_SECS_PER_HK_CYCLE); @@ -329,7 +329,7 @@ void DS_AppSendHkCmd_Test_TblFail(void) UT_SetDefaultReturnValue(UT_KEY(CFE_TBL_GetInfo), -1); /* Execute the function being tested */ - DS_AppSendHkCmd(); + UtAssert_VOIDCALL(DS_AppSendHkCmd()); /* Verify results */ UtAssert_UINT32_EQ(DS_AppData.FileStatus[0].FileRate, 99 / DS_SECS_PER_HK_CYCLE); @@ -363,7 +363,7 @@ void DS_AppStorePacket_Test_Nominal(void) DS_AppData.AppEnableState = DS_ENABLED; /* Execute the function being tested */ - DS_AppStorePacket(MessageID, &UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_AppStorePacket(MessageID, &UT_CmdBuf.Buf)); /* Verify results -- IgnoredPktCounter increments in call to DS_FileStorePacket() */ UtAssert_UINT32_EQ(DS_AppData.IgnoredPktCounter, 0); @@ -387,7 +387,7 @@ void DS_AppStorePacket_Test_DSDisabled(void) DS_AppData.AppEnableState = DS_DISABLED; /* Execute the function being tested */ - DS_AppStorePacket(MessageID, &UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_AppStorePacket(MessageID, &UT_CmdBuf.Buf)); /* Verify results */ UtAssert_UINT32_EQ(DS_AppData.DisabledPktCounter, 1); @@ -410,7 +410,7 @@ void DS_AppStorePacket_Test_FilterTableNotLoaded(void) DS_AppData.FilterTblPtr = 0; /* Execute the function being tested */ - DS_AppStorePacket(MessageID, &UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_AppStorePacket(MessageID, &UT_CmdBuf.Buf)); /* Verify results */ UtAssert_UINT32_EQ(DS_AppData.IgnoredPktCounter, 1); @@ -433,7 +433,7 @@ void DS_AppStorePacket_Test_DestFileTableNotLoaded(void) DS_AppData.DestFileTblPtr = 0; /* Execute the function being tested */ - DS_AppStorePacket(MessageID, &UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_AppStorePacket(MessageID, &UT_CmdBuf.Buf)); /* Verify results */ UtAssert_UINT32_EQ(DS_AppData.IgnoredPktCounter, 1); diff --git a/unit-test/ds_cmds_tests.c b/unit-test/ds_cmds_tests.c index 65d1245..3b0fc9c 100644 --- a/unit-test/ds_cmds_tests.c +++ b/unit-test/ds_cmds_tests.c @@ -55,7 +55,7 @@ void DS_NoopCmd_Test_Nominal(void) { /* Execute the function being tested */ - DS_NoopCmd(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_NoopCmd(&UT_CmdBuf.Buf)); /* Verify results */ UtAssert_UINT32_EQ(DS_AppData.CmdAcceptedCounter, 1); @@ -71,7 +71,7 @@ void DS_NoopCmd_Test_Nominal(void) void DS_ResetCountersCmd_Test_Nominal(void) { /* Execute the function being tested */ - DS_ResetCountersCmd(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_ResetCountersCmd(&UT_CmdBuf.Buf)); /* Verify results */ UtAssert_ZERO(DS_AppData.CmdAcceptedCounter); @@ -106,7 +106,7 @@ void DS_SetAppStateCmd_Test_Nominal(void) UT_SetDefaultReturnValue(UT_KEY(DS_TableVerifyState), true); /* Execute the function being tested */ - DS_SetAppStateCmd(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_SetAppStateCmd(&UT_CmdBuf.Buf)); /* Verify results */ UtAssert_INT32_EQ(DS_AppData.CmdRejectedCounter, 0); @@ -128,7 +128,7 @@ void DS_SetAppStateCmd_Test_InvalidAppState(void) CmdPayload->EnableState = 99; /* Execute the function being tested */ - DS_SetAppStateCmd(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_SetAppStateCmd(&UT_CmdBuf.Buf)); /* Verify results */ UtAssert_UINT32_EQ(DS_AppData.CmdRejectedCounter, 1); @@ -154,7 +154,7 @@ void DS_SetFilterFileCmd_Test_Nominal(void) UT_SetDefaultReturnValue(UT_KEY(DS_TableFindMsgID), forced_FilterTableIndex); /* Execute the function being tested */ - DS_SetFilterFileCmd(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_SetFilterFileCmd(&UT_CmdBuf.Buf)); /* Verify results */ UtAssert_UINT32_EQ(DS_AppData.CmdAcceptedCounter, 1); @@ -180,7 +180,7 @@ void DS_SetFilterFileCmd_Test_InvalidMessageID(void) CmdPayload->MessageID = CFE_SB_INVALID_MSG_ID; /* Execute the function being tested */ - DS_SetFilterFileCmd(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_SetFilterFileCmd(&UT_CmdBuf.Buf)); /* Verify results */ UtAssert_UINT32_EQ(DS_AppData.CmdRejectedCounter, 1); @@ -198,7 +198,7 @@ void DS_SetFilterFileCmd_Test_InvalidFilterParametersIndex(void) CmdPayload->FilterParmsIndex = DS_FILTERS_PER_PACKET; /* Execute the function being tested */ - DS_SetFilterFileCmd(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_SetFilterFileCmd(&UT_CmdBuf.Buf)); /* Verify results */ UtAssert_UINT32_EQ(DS_AppData.CmdRejectedCounter, 1); @@ -217,7 +217,7 @@ void DS_SetFilterFileCmd_Test_InvalidFileTableIndex(void) CmdPayload->FileTableIndex = 99; /* Execute the function being tested */ - DS_SetFilterFileCmd(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_SetFilterFileCmd(&UT_CmdBuf.Buf)); /* Verify results */ UtAssert_UINT32_EQ(DS_AppData.CmdRejectedCounter, 1); @@ -241,7 +241,7 @@ void DS_SetFilterFileCmd_Test_FilterTableNotLoaded(void) DS_AppData.FilterTblPtr = NULL; /* Execute the function being tested */ - DS_SetFilterFileCmd(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_SetFilterFileCmd(&UT_CmdBuf.Buf)); /* Verify results */ UtAssert_UINT32_EQ(DS_AppData.CmdRejectedCounter, 1); @@ -265,7 +265,7 @@ void DS_SetFilterFileCmd_Test_MessageIDNotInFilterTable(void) UT_SetDefaultReturnValue(UT_KEY(DS_TableFindMsgID), DS_INDEX_NONE); /* Execute the function being tested */ - DS_SetFilterFileCmd(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_SetFilterFileCmd(&UT_CmdBuf.Buf)); /* Verify results */ UtAssert_UINT32_EQ(DS_AppData.CmdRejectedCounter, 1); @@ -288,7 +288,7 @@ void DS_SetFilterTypeCmd_Test_Nominal(void) UT_SetDefaultReturnValue(UT_KEY(DS_TableVerifyType), true); /* Execute the function being tested */ - DS_SetFilterTypeCmd(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_SetFilterTypeCmd(&UT_CmdBuf.Buf)); /* Verify results */ UtAssert_UINT32_EQ(DS_AppData.CmdAcceptedCounter, 1); @@ -310,7 +310,7 @@ void DS_SetFilterTypeCmd_Test_InvalidMessageID(void) CmdPayload->MessageID = CFE_SB_INVALID_MSG_ID; /* Execute the function being tested */ - DS_SetFilterTypeCmd(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_SetFilterTypeCmd(&UT_CmdBuf.Buf)); /* Verify results */ UtAssert_UINT32_EQ(DS_AppData.CmdRejectedCounter, 1); @@ -328,7 +328,7 @@ void DS_SetFilterTypeCmd_Test_InvalidFilterParametersIndex(void) CmdPayload->FilterParmsIndex = DS_FILTERS_PER_PACKET; /* Execute the function being tested */ - DS_SetFilterTypeCmd(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_SetFilterTypeCmd(&UT_CmdBuf.Buf)); /* Verify results */ UtAssert_UINT32_EQ(DS_AppData.CmdRejectedCounter, 1); @@ -347,7 +347,7 @@ void DS_SetFilterTypeCmd_Test_InvalidFilterType(void) CmdPayload->FilterType = false; /* Execute the function being tested */ - DS_SetFilterTypeCmd(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_SetFilterTypeCmd(&UT_CmdBuf.Buf)); /* Verify results */ UtAssert_UINT32_EQ(DS_AppData.CmdRejectedCounter, 1); @@ -371,7 +371,7 @@ void DS_SetFilterTypeCmd_Test_FilterTableNotLoaded(void) DS_AppData.FilterTblPtr = NULL; /* Execute the function being tested */ - DS_SetFilterTypeCmd(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_SetFilterTypeCmd(&UT_CmdBuf.Buf)); /* Verify results */ UtAssert_UINT32_EQ(DS_AppData.CmdRejectedCounter, 1); @@ -393,7 +393,7 @@ void DS_SetFilterTypeCmd_Test_MessageIDNotInFilterTable(void) UT_SetDefaultReturnValue(UT_KEY(DS_TableFindMsgID), DS_INDEX_NONE); /* Execute the function being tested */ - DS_SetFilterTypeCmd(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_SetFilterTypeCmd(&UT_CmdBuf.Buf)); /* Verify results */ UtAssert_UINT32_EQ(DS_AppData.CmdRejectedCounter, 1); @@ -416,7 +416,7 @@ void DS_SetFilterParmsCmd_Test_Nominal(void) UT_SetDefaultReturnValue(UT_KEY(DS_TableVerifyParms), true); /* Execute the function being tested */ - DS_SetFilterParmsCmd(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_SetFilterParmsCmd(&UT_CmdBuf.Buf)); /* Verify results */ UtAssert_UINT32_EQ(DS_AppData.CmdAcceptedCounter, 1); @@ -440,7 +440,7 @@ void DS_SetFilterParmsCmd_Test_InvalidMessageID(void) CmdPayload->MessageID = CFE_SB_INVALID_MSG_ID; /* Execute the function being tested */ - DS_SetFilterParmsCmd(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_SetFilterParmsCmd(&UT_CmdBuf.Buf)); /* Verify results */ UtAssert_UINT32_EQ(DS_AppData.CmdRejectedCounter, 1); @@ -458,7 +458,7 @@ void DS_SetFilterParmsCmd_Test_InvalidFilterParametersIndex(void) CmdPayload->FilterParmsIndex = DS_FILTERS_PER_PACKET; /* Execute the function being tested */ - DS_SetFilterParmsCmd(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_SetFilterParmsCmd(&UT_CmdBuf.Buf)); /* Verify results */ UtAssert_UINT32_EQ(DS_AppData.CmdRejectedCounter, 1); @@ -481,7 +481,7 @@ void DS_SetFilterParmsCmd_Test_InvalidFilterAlgorithm(void) DS_AppData.FilterTblPtr->Packet->MessageID = DS_UT_MID_1; /* Execute the function being tested */ - DS_SetFilterParmsCmd(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_SetFilterParmsCmd(&UT_CmdBuf.Buf)); /* Verify results */ UtAssert_UINT32_EQ(DS_AppData.CmdRejectedCounter, 1); @@ -504,7 +504,7 @@ void DS_SetFilterParmsCmd_Test_FilterTableNotLoaded(void) DS_AppData.FilterTblPtr = NULL; /* Execute the function being tested */ - DS_SetFilterParmsCmd(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_SetFilterParmsCmd(&UT_CmdBuf.Buf)); /* Verify results */ UtAssert_UINT32_EQ(DS_AppData.CmdRejectedCounter, 1); @@ -527,7 +527,7 @@ void DS_SetFilterParmsCmd_Test_MessageIDNotInFilterTable(void) UT_SetDefaultReturnValue(UT_KEY(DS_TableFindMsgID), DS_INDEX_NONE); /* Execute the function being tested */ - DS_SetFilterParmsCmd(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_SetFilterParmsCmd(&UT_CmdBuf.Buf)); /* Verify results */ UtAssert_UINT32_EQ(DS_AppData.CmdRejectedCounter, 1); @@ -548,7 +548,7 @@ void DS_SetDestTypeCmd_Test_Nominal(void) UT_SetDefaultReturnValue(UT_KEY(DS_TableVerifyType), true); /* Execute the function being tested */ - DS_SetDestTypeCmd(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_SetDestTypeCmd(&UT_CmdBuf.Buf)); /* Verify results */ UtAssert_UINT32_EQ(DS_AppData.CmdAcceptedCounter, 1); @@ -570,7 +570,7 @@ void DS_SetDestTypeCmd_Test_InvalidFileTableIndex(void) CmdPayload->FileTableIndex = 99; /* Execute the function being tested */ - DS_SetDestTypeCmd(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_SetDestTypeCmd(&UT_CmdBuf.Buf)); /* Verify results */ UtAssert_UINT32_EQ(DS_AppData.CmdRejectedCounter, 1); @@ -590,7 +590,7 @@ void DS_SetDestTypeCmd_Test_InvalidFilenameType(void) UT_SetDefaultReturnValue(UT_KEY(DS_TableVerifyFileIndex), true); /* Execute the function being tested */ - DS_SetDestTypeCmd(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_SetDestTypeCmd(&UT_CmdBuf.Buf)); /* Verify results */ UtAssert_UINT32_EQ(DS_AppData.CmdRejectedCounter, 1); @@ -613,7 +613,7 @@ void DS_SetDestTypeCmd_Test_FileTableNotLoaded(void) UT_SetDefaultReturnValue(UT_KEY(DS_TableVerifyType), true); /* Execute the function being tested */ - DS_SetDestTypeCmd(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_SetDestTypeCmd(&UT_CmdBuf.Buf)); /* Verify results */ UtAssert_UINT32_EQ(DS_AppData.CmdRejectedCounter, 1); @@ -634,7 +634,7 @@ void DS_SetDestStateCmd_Test_Nominal(void) UT_SetDefaultReturnValue(UT_KEY(DS_TableVerifyState), true); /* Execute the function being tested */ - DS_SetDestStateCmd(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_SetDestStateCmd(&UT_CmdBuf.Buf)); /* Verify results */ UtAssert_UINT32_EQ(DS_AppData.CmdAcceptedCounter, 1); @@ -658,7 +658,7 @@ void DS_SetDestStateCmd_Test_InvalidFileTableIndex(void) CmdPayload->FileTableIndex = 99; /* Execute the function being tested */ - DS_SetDestStateCmd(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_SetDestStateCmd(&UT_CmdBuf.Buf)); /* Verify results */ UtAssert_UINT32_EQ(DS_AppData.CmdRejectedCounter, 1); @@ -678,7 +678,7 @@ void DS_SetDestStateCmd_Test_InvalidFileState(void) UT_SetDefaultReturnValue(UT_KEY(DS_TableVerifyFileIndex), true); /* Execute the function being tested */ - DS_SetDestStateCmd(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_SetDestStateCmd(&UT_CmdBuf.Buf)); /* Verify results */ UtAssert_UINT32_EQ(DS_AppData.CmdRejectedCounter, 1); @@ -700,7 +700,7 @@ void DS_SetDestStateCmd_Test_FileTableNotLoaded(void) UT_SetDefaultReturnValue(UT_KEY(DS_TableVerifyState), true); /* Execute the function being tested */ - DS_SetDestStateCmd(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_SetDestStateCmd(&UT_CmdBuf.Buf)); /* Verify results */ UtAssert_UINT32_EQ(DS_AppData.CmdRejectedCounter, 1); @@ -720,7 +720,7 @@ void DS_SetDestPathCmd_Test_Nominal(void) UT_SetDefaultReturnValue(UT_KEY(DS_TableVerifyFileIndex), true); /* Execute the function being tested */ - DS_SetDestPathCmd(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_SetDestPathCmd(&UT_CmdBuf.Buf)); /* Verify results */ UtAssert_UINT32_EQ(DS_AppData.CmdAcceptedCounter, 1); @@ -745,7 +745,7 @@ void DS_SetDestPathCmd_Test_InvalidFileTableIndex(void) CmdPayload->FileTableIndex = 99; /* Execute the function being tested */ - DS_SetDestPathCmd(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_SetDestPathCmd(&UT_CmdBuf.Buf)); /* Verify results */ UtAssert_UINT32_EQ(DS_AppData.CmdRejectedCounter, 1); @@ -767,7 +767,7 @@ void DS_SetDestPathCmd_Test_FileTableNotLoaded(void) UT_SetDefaultReturnValue(UT_KEY(DS_TableVerifyFileIndex), true); /* Execute the function being tested */ - DS_SetDestPathCmd(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_SetDestPathCmd(&UT_CmdBuf.Buf)); /* Verify results */ UtAssert_UINT32_EQ(DS_AppData.CmdRejectedCounter, 1); @@ -787,7 +787,7 @@ void DS_SetDestBaseCmd_Test_Nominal(void) UT_SetDefaultReturnValue(UT_KEY(DS_TableVerifyFileIndex), true); /* Execute the function being tested */ - DS_SetDestBaseCmd(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_SetDestBaseCmd(&UT_CmdBuf.Buf)); /* Verify results */ UtAssert_UINT32_EQ(DS_AppData.CmdAcceptedCounter, 1); @@ -812,7 +812,7 @@ void DS_SetDestBaseCmd_Test_InvalidFileTableIndex(void) CmdPayload->FileTableIndex = 99; /* Execute the function being tested */ - DS_SetDestBaseCmd(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_SetDestBaseCmd(&UT_CmdBuf.Buf)); /* Verify results */ UtAssert_UINT32_EQ(DS_AppData.CmdRejectedCounter, 1); @@ -834,7 +834,7 @@ void DS_SetDestBaseCmd_Test_FileTableNotLoaded(void) UT_SetDefaultReturnValue(UT_KEY(DS_TableVerifyFileIndex), true); /* Execute the function being tested */ - DS_SetDestBaseCmd(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_SetDestBaseCmd(&UT_CmdBuf.Buf)); /* Verify results */ UtAssert_UINT32_EQ(DS_AppData.CmdRejectedCounter, 1); @@ -854,7 +854,7 @@ void DS_SetDestExtCmd_Test_Nominal(void) UT_SetDefaultReturnValue(UT_KEY(DS_TableVerifyFileIndex), true); /* Execute the function being tested */ - DS_SetDestExtCmd(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_SetDestExtCmd(&UT_CmdBuf.Buf)); /* Verify results */ UtAssert_UINT32_EQ(DS_AppData.CmdAcceptedCounter, 1); @@ -880,7 +880,7 @@ void DS_SetDestExtCmd_Test_InvalidFileTableIndex(void) CmdPayload->FileTableIndex = 99; /* Execute the function being tested */ - DS_SetDestExtCmd(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_SetDestExtCmd(&UT_CmdBuf.Buf)); /* Verify results */ UtAssert_UINT32_EQ(DS_AppData.CmdRejectedCounter, 1); @@ -902,7 +902,7 @@ void DS_SetDestExtCmd_Test_FileTableNotLoaded(void) UT_SetDefaultReturnValue(UT_KEY(DS_TableVerifyFileIndex), true); /* Execute the function being tested */ - DS_SetDestExtCmd(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_SetDestExtCmd(&UT_CmdBuf.Buf)); /* Verify results */ UtAssert_UINT32_EQ(DS_AppData.CmdRejectedCounter, 1); @@ -923,7 +923,7 @@ void DS_SetDestSizeCmd_Test_Nominal(void) UT_SetDefaultReturnValue(UT_KEY(DS_TableVerifySize), true); /* Execute the function being tested */ - DS_SetDestSizeCmd(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_SetDestSizeCmd(&UT_CmdBuf.Buf)); /* Verify results */ UtAssert_UINT32_EQ(DS_AppData.CmdAcceptedCounter, 1); @@ -946,7 +946,7 @@ void DS_SetDestSizeCmd_Test_InvalidFileTableIndex(void) CmdPayload->MaxFileSize = 100000000; /* Execute the function being tested */ - DS_SetDestSizeCmd(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_SetDestSizeCmd(&UT_CmdBuf.Buf)); /* Verify results */ UtAssert_UINT32_EQ(DS_AppData.CmdRejectedCounter, 1); @@ -968,7 +968,7 @@ void DS_SetDestSizeCmd_Test_InvalidFileSizeLimit(void) UT_SetDefaultReturnValue(UT_KEY(DS_TableVerifyFileIndex), true); /* Execute the function being tested */ - DS_SetDestSizeCmd(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_SetDestSizeCmd(&UT_CmdBuf.Buf)); /* Verify results */ UtAssert_UINT32_EQ(DS_AppData.CmdRejectedCounter, 1); @@ -991,7 +991,7 @@ void DS_SetDestSizeCmd_Test_FileTableNotLoaded(void) UT_SetDefaultReturnValue(UT_KEY(DS_TableVerifySize), true); /* Execute the function being tested */ - DS_SetDestSizeCmd(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_SetDestSizeCmd(&UT_CmdBuf.Buf)); /* Verify results */ UtAssert_UINT32_EQ(DS_AppData.CmdRejectedCounter, 1); @@ -1012,7 +1012,7 @@ void DS_SetDestAgeCmd_Test_Nominal(void) UT_SetDefaultReturnValue(UT_KEY(DS_TableVerifyAge), true); /* Execute the function being tested */ - DS_SetDestAgeCmd(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_SetDestAgeCmd(&UT_CmdBuf.Buf)); /* Verify results */ UtAssert_UINT32_EQ(DS_AppData.CmdAcceptedCounter, 1); @@ -1035,7 +1035,7 @@ void DS_SetDestAgeCmd_Test_InvalidFileTableIndex(void) CmdPayload->MaxFileAge = 1000; /* Execute the function being tested */ - DS_SetDestAgeCmd(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_SetDestAgeCmd(&UT_CmdBuf.Buf)); /* Verify results */ UtAssert_UINT32_EQ(DS_AppData.CmdRejectedCounter, 1); @@ -1057,7 +1057,7 @@ void DS_SetDestAgeCmd_Test_InvalidFileAgeLimit(void) UT_SetDefaultReturnValue(UT_KEY(DS_TableVerifyFileIndex), true); /* Execute the function being tested */ - DS_SetDestAgeCmd(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_SetDestAgeCmd(&UT_CmdBuf.Buf)); /* Verify results */ UtAssert_UINT32_EQ(DS_AppData.CmdRejectedCounter, 1); @@ -1080,7 +1080,7 @@ void DS_SetDestAgeCmd_Test_FileTableNotLoaded(void) UT_SetDefaultReturnValue(UT_KEY(DS_TableVerifyAge), true); /* Execute the function being tested */ - DS_SetDestAgeCmd(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_SetDestAgeCmd(&UT_CmdBuf.Buf)); /* Verify results */ UtAssert_UINT32_EQ(DS_AppData.CmdRejectedCounter, 1); @@ -1101,7 +1101,7 @@ void DS_SetDestCountCmd_Test_Nominal(void) UT_SetDefaultReturnValue(UT_KEY(DS_TableVerifyCount), true); /* Execute the function being tested */ - DS_SetDestCountCmd(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_SetDestCountCmd(&UT_CmdBuf.Buf)); /* Verify results */ UtAssert_UINT32_EQ(DS_AppData.CmdAcceptedCounter, 1); @@ -1125,7 +1125,7 @@ void DS_SetDestCountCmd_Test_InvalidFileTableIndex(void) CmdPayload->SequenceCount = 1; /* Execute the function being tested */ - DS_SetDestCountCmd(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_SetDestCountCmd(&UT_CmdBuf.Buf)); /* Verify results */ UtAssert_UINT32_EQ(DS_AppData.CmdRejectedCounter, 1); @@ -1147,7 +1147,7 @@ void DS_SetDestCountCmd_Test_InvalidFileSequenceCount(void) UT_SetDefaultReturnValue(UT_KEY(DS_TableVerifyFileIndex), true); /* Execute the function being tested */ - DS_SetDestCountCmd(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_SetDestCountCmd(&UT_CmdBuf.Buf)); /* Verify results */ UtAssert_UINT32_EQ(DS_AppData.CmdRejectedCounter, 1); @@ -1170,7 +1170,7 @@ void DS_SetDestCountCmd_Test_FileTableNotLoaded(void) UT_SetDefaultReturnValue(UT_KEY(DS_TableVerifyCount), true); /* Execute the function being tested */ - DS_SetDestCountCmd(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_SetDestCountCmd(&UT_CmdBuf.Buf)); /* Verify results */ UtAssert_UINT32_EQ(DS_AppData.CmdRejectedCounter, 1); @@ -1199,7 +1199,7 @@ void DS_CloseFileCmd_Test_Nominal(void) UT_SetDefaultReturnValue(UT_KEY(DS_TableVerifyFileIndex), true); /* Execute the function being tested */ - DS_CloseFileCmd(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_CloseFileCmd(&UT_CmdBuf.Buf)); /* Verify results */ UtAssert_UINT32_EQ(DS_AppData.CmdAcceptedCounter, 1); @@ -1232,7 +1232,7 @@ void DS_CloseFileCmd_Test_NominalAlreadyClosed(void) UT_SetDefaultReturnValue(UT_KEY(DS_TableVerifyFileIndex), true); /* Execute the function being tested */ - DS_CloseFileCmd(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_CloseFileCmd(&UT_CmdBuf.Buf)); /* Verify results */ UtAssert_UINT32_EQ(DS_AppData.CmdAcceptedCounter, 1); @@ -1257,7 +1257,7 @@ void DS_CloseFileCmd_Test_InvalidFileTableIndex(void) CmdPayload->FileTableIndex = 99; /* Execute the function being tested */ - DS_CloseFileCmd(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_CloseFileCmd(&UT_CmdBuf.Buf)); /* Verify results */ UtAssert_UINT32_EQ(DS_AppData.CmdRejectedCounter, 1); @@ -1281,7 +1281,7 @@ void DS_CloseAllCmd_Test_Nominal(void) #endif /* Execute the function being tested */ - DS_CloseAllCmd(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_CloseAllCmd(&UT_CmdBuf.Buf)); /* Verify results */ UtAssert_UINT32_EQ(DS_AppData.CmdAcceptedCounter, 1); @@ -1334,7 +1334,7 @@ void DS_GetFileInfoCmd_Test_EnabledOpen(void) } /* Execute the function being tested */ - DS_GetFileInfoCmd(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_GetFileInfoCmd(&UT_CmdBuf.Buf)); /* Verify results */ UtAssert_UINT32_EQ(DS_AppData.CmdAcceptedCounter, 1); @@ -1367,7 +1367,7 @@ void DS_GetFileInfoCmd_Test_DisabledClosed(void) DS_AppData.DestFileTblPtr = NULL; /* Execute the function being tested */ - DS_GetFileInfoCmd(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_GetFileInfoCmd(&UT_CmdBuf.Buf)); /* Verify results */ UtAssert_UINT32_EQ(DS_AppData.CmdAcceptedCounter, 1); @@ -1401,7 +1401,7 @@ void DS_AddMIDCmd_Test_Nominal(void) UT_SetDeferredRetcode(UT_KEY(DS_TableFindMsgID), 1, 0); /* Execute the function being tested */ - DS_AddMIDCmd(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_AddMIDCmd(&UT_CmdBuf.Buf)); /* Verify results */ UtAssert_UINT32_EQ(DS_AppData.CmdAcceptedCounter, 1); @@ -1443,7 +1443,7 @@ void DS_AddMIDCmd_Test_InvalidMessageID(void) CmdPayload->MessageID = CFE_SB_INVALID_MSG_ID; /* Execute the function being tested */ - DS_AddMIDCmd(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_AddMIDCmd(&UT_CmdBuf.Buf)); /* Verify results */ UtAssert_UINT32_EQ(DS_AppData.CmdRejectedCounter, 1); @@ -1463,7 +1463,7 @@ void DS_AddMIDCmd_Test_FilterTableNotLoaded(void) DS_AppData.FilterTblPtr = NULL; /* Execute the function being tested */ - DS_AddMIDCmd(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_AddMIDCmd(&UT_CmdBuf.Buf)); /* Verify results */ UtAssert_UINT32_EQ(DS_AppData.CmdRejectedCounter, 1); @@ -1483,7 +1483,7 @@ void DS_AddMIDCmd_Test_MIDAlreadyInFilterTable(void) UT_SetDeferredRetcode(UT_KEY(DS_TableFindMsgID), 1, 1); /* Execute the function being tested */ - DS_AddMIDCmd(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_AddMIDCmd(&UT_CmdBuf.Buf)); /* Verify results */ UtAssert_UINT32_EQ(DS_AppData.CmdRejectedCounter, 1); @@ -1503,7 +1503,7 @@ void DS_AddMIDCmd_Test_FilterTableFull(void) UT_SetDefaultReturnValue(UT_KEY(DS_TableFindMsgID), DS_INDEX_NONE); /* Execute the function being tested */ - DS_AddMIDCmd(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_AddMIDCmd(&UT_CmdBuf.Buf)); /* Verify results */ UtAssert_UINT32_EQ(DS_AppData.CmdRejectedCounter, 1); diff --git a/unit-test/ds_dispatch_tests.c b/unit-test/ds_dispatch_tests.c index c92cc0a..9b5428a 100644 --- a/unit-test/ds_dispatch_tests.c +++ b/unit-test/ds_dispatch_tests.c @@ -68,7 +68,7 @@ void DS_AppProcessMsg_Test_CmdStore(void) UT_SetDefaultReturnValue(UT_KEY(DS_TableFindMsgID), 1); /* Execute the function being tested */ - DS_AppProcessMsg(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_AppProcessMsg(&UT_CmdBuf.Buf)); /* an attempt was made to store this packet */ UtAssert_STUB_COUNT(DS_AppStorePacket, 1); @@ -84,7 +84,7 @@ void DS_AppProcessMsg_Test_CmdNoStore(void) UT_SetDefaultReturnValue(UT_KEY(DS_TableFindMsgID), DS_INDEX_NONE); /* Execute the function being tested */ - DS_AppProcessMsg(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_AppProcessMsg(&UT_CmdBuf.Buf)); /* Verify results */ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); @@ -103,7 +103,7 @@ void DS_AppProcessMsg_Test_HKStore(void) UT_SetDefaultReturnValue(UT_KEY(DS_TableFindMsgID), 1); /* Execute the function being tested */ - DS_AppProcessMsg(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_AppProcessMsg(&UT_CmdBuf.Buf)); UtAssert_STUB_COUNT(DS_AppSendHkCmd, 1); @@ -121,7 +121,7 @@ void DS_AppProcessMsg_Test_HKNoStore(void) UT_SetDefaultReturnValue(UT_KEY(DS_TableFindMsgID), DS_INDEX_NONE); /* Execute the function being tested */ - DS_AppProcessMsg(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_AppProcessMsg(&UT_CmdBuf.Buf)); UtAssert_STUB_COUNT(DS_AppSendHkCmd, 1); @@ -134,7 +134,7 @@ void DS_AppProcessMsg_Test_HKInvalidRequest(void) DS_Dispatch_Test_SetupMsg(CFE_SB_ValueToMsgId(DS_SEND_HK_MID), 0, 1); /* Execute the function being tested */ - DS_AppProcessMsg(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_AppProcessMsg(&UT_CmdBuf.Buf)); /* Verify results */ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); @@ -147,7 +147,7 @@ void DS_AppProcessMsg_Test_UnknownMID(void) DS_Dispatch_Test_SetupMsg(DS_UT_MID_1, 0, 1); /* Execute the function being tested */ - DS_AppProcessMsg(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_AppProcessMsg(&UT_CmdBuf.Buf)); /* Verify results */ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); @@ -161,7 +161,7 @@ void DS_AppProcessCmd_Test_Noop(void) DS_Dispatch_Test_SetupMsg(CFE_SB_ValueToMsgId(DS_CMD_MID), DS_NOOP_CC, sizeof(DS_NoopCmd_t)); /* Execute the function being tested */ - DS_AppProcessCmd(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_AppProcessCmd(&UT_CmdBuf.Buf)); /* Verify results */ UtAssert_STUB_COUNT(DS_NoopCmd, 1); @@ -170,7 +170,7 @@ void DS_AppProcessCmd_Test_Noop(void) DS_Dispatch_Test_SetupMsg(CFE_SB_ValueToMsgId(DS_CMD_MID), DS_NOOP_CC, 1); /* Execute the function being tested */ - DS_AppProcessCmd(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_AppProcessCmd(&UT_CmdBuf.Buf)); /* Should NOT have invoked the handler this time */ UtAssert_STUB_COUNT(DS_NoopCmd, 1); @@ -181,7 +181,7 @@ void DS_AppProcessCmd_Test_Reset(void) DS_Dispatch_Test_SetupMsg(CFE_SB_ValueToMsgId(DS_CMD_MID), DS_RESET_COUNTERS_CC, sizeof(DS_ResetCountersCmd_t)); /* Execute the function being tested */ - DS_AppProcessCmd(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_AppProcessCmd(&UT_CmdBuf.Buf)); /* Verify results */ UtAssert_STUB_COUNT(DS_ResetCountersCmd, 1); @@ -190,7 +190,7 @@ void DS_AppProcessCmd_Test_Reset(void) DS_Dispatch_Test_SetupMsg(CFE_SB_ValueToMsgId(DS_CMD_MID), DS_RESET_COUNTERS_CC, 1); /* Execute the function being tested */ - DS_AppProcessCmd(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_AppProcessCmd(&UT_CmdBuf.Buf)); /* Should NOT have invoked the handler this time */ UtAssert_STUB_COUNT(DS_ResetCountersCmd, 1); @@ -201,7 +201,7 @@ void DS_AppProcessCmd_Test_SetAppState(void) DS_Dispatch_Test_SetupMsg(CFE_SB_ValueToMsgId(DS_CMD_MID), DS_SET_APP_STATE_CC, sizeof(DS_AppStateCmd_t)); /* Execute the function being tested */ - DS_AppProcessCmd(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_AppProcessCmd(&UT_CmdBuf.Buf)); /* Verify results */ UtAssert_STUB_COUNT(DS_SetAppStateCmd, 1); @@ -210,7 +210,7 @@ void DS_AppProcessCmd_Test_SetAppState(void) DS_Dispatch_Test_SetupMsg(CFE_SB_ValueToMsgId(DS_CMD_MID), DS_SET_APP_STATE_CC, 1); /* Execute the function being tested */ - DS_AppProcessCmd(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_AppProcessCmd(&UT_CmdBuf.Buf)); /* Should NOT have invoked the handler this time */ UtAssert_STUB_COUNT(DS_SetAppStateCmd, 1); @@ -221,7 +221,7 @@ void DS_AppProcessCmd_Test_SetFilterFile(void) DS_Dispatch_Test_SetupMsg(CFE_SB_ValueToMsgId(DS_CMD_MID), DS_SET_FILTER_FILE_CC, sizeof(DS_FilterFileCmd_t)); /* Execute the function being tested */ - DS_AppProcessCmd(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_AppProcessCmd(&UT_CmdBuf.Buf)); /* Verify results */ UtAssert_STUB_COUNT(DS_SetFilterFileCmd, 1); @@ -230,7 +230,7 @@ void DS_AppProcessCmd_Test_SetFilterFile(void) DS_Dispatch_Test_SetupMsg(CFE_SB_ValueToMsgId(DS_CMD_MID), DS_SET_FILTER_FILE_CC, 1); /* Execute the function being tested */ - DS_AppProcessCmd(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_AppProcessCmd(&UT_CmdBuf.Buf)); /* Should NOT have invoked the handler this time */ UtAssert_STUB_COUNT(DS_SetFilterFileCmd, 1); @@ -241,7 +241,7 @@ void DS_AppProcessCmd_Test_SetFilterType(void) DS_Dispatch_Test_SetupMsg(CFE_SB_ValueToMsgId(DS_CMD_MID), DS_SET_FILTER_TYPE_CC, sizeof(DS_FilterTypeCmd_t)); /* Execute the function being tested */ - DS_AppProcessCmd(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_AppProcessCmd(&UT_CmdBuf.Buf)); /* Verify results */ UtAssert_STUB_COUNT(DS_SetFilterTypeCmd, 1); @@ -250,7 +250,7 @@ void DS_AppProcessCmd_Test_SetFilterType(void) DS_Dispatch_Test_SetupMsg(CFE_SB_ValueToMsgId(DS_CMD_MID), DS_SET_FILTER_TYPE_CC, 1); /* Execute the function being tested */ - DS_AppProcessCmd(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_AppProcessCmd(&UT_CmdBuf.Buf)); /* Should NOT have invoked the handler this time */ UtAssert_STUB_COUNT(DS_SetFilterTypeCmd, 1); @@ -261,7 +261,7 @@ void DS_AppProcessCmd_Test_SetFilterParms(void) DS_Dispatch_Test_SetupMsg(CFE_SB_ValueToMsgId(DS_CMD_MID), DS_SET_FILTER_PARMS_CC, sizeof(DS_FilterParmsCmd_t)); /* Execute the function being tested */ - DS_AppProcessCmd(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_AppProcessCmd(&UT_CmdBuf.Buf)); /* Verify results */ UtAssert_STUB_COUNT(DS_SetFilterParmsCmd, 1); @@ -270,7 +270,7 @@ void DS_AppProcessCmd_Test_SetFilterParms(void) DS_Dispatch_Test_SetupMsg(CFE_SB_ValueToMsgId(DS_CMD_MID), DS_SET_FILTER_PARMS_CC, 1); /* Execute the function being tested */ - DS_AppProcessCmd(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_AppProcessCmd(&UT_CmdBuf.Buf)); /* Should NOT have invoked the handler this time */ UtAssert_STUB_COUNT(DS_SetFilterParmsCmd, 1); @@ -281,7 +281,7 @@ void DS_AppProcessCmd_Test_SetDestType(void) DS_Dispatch_Test_SetupMsg(CFE_SB_ValueToMsgId(DS_CMD_MID), DS_SET_DEST_TYPE_CC, sizeof(DS_DestTypeCmd_t)); /* Execute the function being tested */ - DS_AppProcessCmd(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_AppProcessCmd(&UT_CmdBuf.Buf)); /* Verify results */ UtAssert_STUB_COUNT(DS_SetDestTypeCmd, 1); @@ -290,7 +290,7 @@ void DS_AppProcessCmd_Test_SetDestType(void) DS_Dispatch_Test_SetupMsg(CFE_SB_ValueToMsgId(DS_CMD_MID), DS_SET_DEST_TYPE_CC, 1); /* Execute the function being tested */ - DS_AppProcessCmd(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_AppProcessCmd(&UT_CmdBuf.Buf)); /* Should NOT have invoked the handler this time */ UtAssert_STUB_COUNT(DS_SetDestTypeCmd, 1); @@ -301,7 +301,7 @@ void DS_AppProcessCmd_Test_SetDestState(void) DS_Dispatch_Test_SetupMsg(CFE_SB_ValueToMsgId(DS_CMD_MID), DS_SET_DEST_STATE_CC, sizeof(DS_DestStateCmd_t)); /* Execute the function being tested */ - DS_AppProcessCmd(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_AppProcessCmd(&UT_CmdBuf.Buf)); /* Verify results */ UtAssert_STUB_COUNT(DS_SetDestStateCmd, 1); @@ -310,7 +310,7 @@ void DS_AppProcessCmd_Test_SetDestState(void) DS_Dispatch_Test_SetupMsg(CFE_SB_ValueToMsgId(DS_CMD_MID), DS_SET_DEST_STATE_CC, 1); /* Execute the function being tested */ - DS_AppProcessCmd(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_AppProcessCmd(&UT_CmdBuf.Buf)); /* Should NOT have invoked the handler this time */ UtAssert_STUB_COUNT(DS_SetDestStateCmd, 1); @@ -321,7 +321,7 @@ void DS_AppProcessCmd_Test_SetDestPath(void) DS_Dispatch_Test_SetupMsg(CFE_SB_ValueToMsgId(DS_CMD_MID), DS_SET_DEST_PATH_CC, sizeof(DS_DestPathCmd_t)); /* Execute the function being tested */ - DS_AppProcessCmd(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_AppProcessCmd(&UT_CmdBuf.Buf)); /* Verify results */ UtAssert_STUB_COUNT(DS_SetDestPathCmd, 1); @@ -330,7 +330,7 @@ void DS_AppProcessCmd_Test_SetDestPath(void) DS_Dispatch_Test_SetupMsg(CFE_SB_ValueToMsgId(DS_CMD_MID), DS_SET_DEST_PATH_CC, 1); /* Execute the function being tested */ - DS_AppProcessCmd(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_AppProcessCmd(&UT_CmdBuf.Buf)); /* Should NOT have invoked the handler this time */ UtAssert_STUB_COUNT(DS_SetDestPathCmd, 1); @@ -341,7 +341,7 @@ void DS_AppProcessCmd_Test_SetDestBase(void) DS_Dispatch_Test_SetupMsg(CFE_SB_ValueToMsgId(DS_CMD_MID), DS_SET_DEST_BASE_CC, sizeof(DS_DestBaseCmd_t)); /* Execute the function being tested */ - DS_AppProcessCmd(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_AppProcessCmd(&UT_CmdBuf.Buf)); /* Verify results */ UtAssert_STUB_COUNT(DS_SetDestBaseCmd, 1); @@ -350,7 +350,7 @@ void DS_AppProcessCmd_Test_SetDestBase(void) DS_Dispatch_Test_SetupMsg(CFE_SB_ValueToMsgId(DS_CMD_MID), DS_SET_DEST_BASE_CC, 1); /* Execute the function being tested */ - DS_AppProcessCmd(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_AppProcessCmd(&UT_CmdBuf.Buf)); /* Verify results */ UtAssert_STUB_COUNT(DS_SetDestBaseCmd, 1); @@ -361,7 +361,7 @@ void DS_AppProcessCmd_Test_SetDestExt(void) DS_Dispatch_Test_SetupMsg(CFE_SB_ValueToMsgId(DS_CMD_MID), DS_SET_DEST_EXT_CC, sizeof(DS_DestExtCmd_t)); /* Execute the function being tested */ - DS_AppProcessCmd(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_AppProcessCmd(&UT_CmdBuf.Buf)); /* Verify results */ UtAssert_STUB_COUNT(DS_SetDestExtCmd, 1); @@ -370,7 +370,7 @@ void DS_AppProcessCmd_Test_SetDestExt(void) DS_Dispatch_Test_SetupMsg(CFE_SB_ValueToMsgId(DS_CMD_MID), DS_SET_DEST_EXT_CC, 1); /* Execute the function being tested */ - DS_AppProcessCmd(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_AppProcessCmd(&UT_CmdBuf.Buf)); /* Should NOT have invoked the handler this time */ UtAssert_STUB_COUNT(DS_SetDestExtCmd, 1); @@ -381,7 +381,7 @@ void DS_AppProcessCmd_Test_SetDestSize(void) DS_Dispatch_Test_SetupMsg(CFE_SB_ValueToMsgId(DS_CMD_MID), DS_SET_DEST_SIZE_CC, sizeof(DS_DestSizeCmd_t)); /* Execute the function being tested */ - DS_AppProcessCmd(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_AppProcessCmd(&UT_CmdBuf.Buf)); /* Verify results */ UtAssert_STUB_COUNT(DS_SetDestSizeCmd, 1); @@ -390,7 +390,7 @@ void DS_AppProcessCmd_Test_SetDestSize(void) DS_Dispatch_Test_SetupMsg(CFE_SB_ValueToMsgId(DS_CMD_MID), DS_SET_DEST_SIZE_CC, 1); /* Execute the function being tested */ - DS_AppProcessCmd(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_AppProcessCmd(&UT_CmdBuf.Buf)); /* Should NOT have invoked the handler this time */ UtAssert_STUB_COUNT(DS_SetDestSizeCmd, 1); @@ -401,7 +401,7 @@ void DS_AppProcessCmd_Test_SetDestAge(void) DS_Dispatch_Test_SetupMsg(CFE_SB_ValueToMsgId(DS_CMD_MID), DS_SET_DEST_AGE_CC, sizeof(DS_DestAgeCmd_t)); /* Execute the function being tested */ - DS_AppProcessCmd(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_AppProcessCmd(&UT_CmdBuf.Buf)); /* Verify results */ UtAssert_STUB_COUNT(DS_SetDestAgeCmd, 1); @@ -410,7 +410,7 @@ void DS_AppProcessCmd_Test_SetDestAge(void) DS_Dispatch_Test_SetupMsg(CFE_SB_ValueToMsgId(DS_CMD_MID), DS_SET_DEST_AGE_CC, 1); /* Execute the function being tested */ - DS_AppProcessCmd(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_AppProcessCmd(&UT_CmdBuf.Buf)); /* Should NOT have invoked the handler this time */ UtAssert_STUB_COUNT(DS_SetDestAgeCmd, 1); @@ -421,7 +421,7 @@ void DS_AppProcessCmd_Test_SetDestCount(void) DS_Dispatch_Test_SetupMsg(CFE_SB_ValueToMsgId(DS_CMD_MID), DS_SET_DEST_COUNT_CC, sizeof(DS_DestCountCmd_t)); /* Execute the function being tested */ - DS_AppProcessCmd(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_AppProcessCmd(&UT_CmdBuf.Buf)); /* Verify results */ UtAssert_STUB_COUNT(DS_SetDestCountCmd, 1); @@ -430,7 +430,7 @@ void DS_AppProcessCmd_Test_SetDestCount(void) DS_Dispatch_Test_SetupMsg(CFE_SB_ValueToMsgId(DS_CMD_MID), DS_SET_DEST_COUNT_CC, 1); /* Execute the function being tested */ - DS_AppProcessCmd(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_AppProcessCmd(&UT_CmdBuf.Buf)); /* Should NOT have invoked the handler this time */ UtAssert_STUB_COUNT(DS_SetDestCountCmd, 1); @@ -441,7 +441,7 @@ void DS_AppProcessCmd_Test_CloseFile(void) DS_Dispatch_Test_SetupMsg(CFE_SB_ValueToMsgId(DS_CMD_MID), DS_CLOSE_FILE_CC, sizeof(DS_CloseFileCmd_t)); /* Execute the function being tested */ - DS_AppProcessCmd(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_AppProcessCmd(&UT_CmdBuf.Buf)); /* Verify results */ UtAssert_STUB_COUNT(DS_CloseFileCmd, 1); @@ -450,7 +450,7 @@ void DS_AppProcessCmd_Test_CloseFile(void) DS_Dispatch_Test_SetupMsg(CFE_SB_ValueToMsgId(DS_CMD_MID), DS_CLOSE_FILE_CC, 1); /* Execute the function being tested */ - DS_AppProcessCmd(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_AppProcessCmd(&UT_CmdBuf.Buf)); /* Should NOT have invoked the handler this time */ UtAssert_STUB_COUNT(DS_CloseFileCmd, 1); @@ -461,7 +461,7 @@ void DS_AppProcessCmd_Test_GetFileInfo(void) DS_Dispatch_Test_SetupMsg(CFE_SB_ValueToMsgId(DS_CMD_MID), DS_GET_FILE_INFO_CC, sizeof(DS_GetFileInfoCmd_t)); /* Execute the function being tested */ - DS_AppProcessCmd(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_AppProcessCmd(&UT_CmdBuf.Buf)); /* Verify results */ UtAssert_STUB_COUNT(DS_GetFileInfoCmd, 1); @@ -470,7 +470,7 @@ void DS_AppProcessCmd_Test_GetFileInfo(void) DS_Dispatch_Test_SetupMsg(CFE_SB_ValueToMsgId(DS_CMD_MID), DS_GET_FILE_INFO_CC, 1); /* Execute the function being tested */ - DS_AppProcessCmd(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_AppProcessCmd(&UT_CmdBuf.Buf)); /* Should NOT have invoked the handler this time */ UtAssert_STUB_COUNT(DS_GetFileInfoCmd, 1); @@ -481,7 +481,7 @@ void DS_AppProcessCmd_Test_AddMID(void) DS_Dispatch_Test_SetupMsg(CFE_SB_ValueToMsgId(DS_CMD_MID), DS_ADD_MID_CC, sizeof(DS_AddMidCmd_t)); /* Execute the function being tested */ - DS_AppProcessCmd(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_AppProcessCmd(&UT_CmdBuf.Buf)); /* Verify results */ UtAssert_STUB_COUNT(DS_AddMIDCmd, 1); @@ -490,7 +490,7 @@ void DS_AppProcessCmd_Test_AddMID(void) DS_Dispatch_Test_SetupMsg(CFE_SB_ValueToMsgId(DS_CMD_MID), DS_ADD_MID_CC, 1); /* Execute the function being tested */ - DS_AppProcessCmd(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_AppProcessCmd(&UT_CmdBuf.Buf)); /* Should NOT have invoked the handler this time */ UtAssert_STUB_COUNT(DS_AddMIDCmd, 1); @@ -501,7 +501,7 @@ void DS_AppProcessCmd_Test_RemoveMID(void) DS_Dispatch_Test_SetupMsg(CFE_SB_ValueToMsgId(DS_CMD_MID), DS_REMOVE_MID_CC, sizeof(DS_RemoveMidCmd_t)); /* Execute the function being tested */ - DS_AppProcessCmd(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_AppProcessCmd(&UT_CmdBuf.Buf)); /* Verify results */ UtAssert_STUB_COUNT(DS_RemoveMIDCmd, 1); @@ -510,7 +510,7 @@ void DS_AppProcessCmd_Test_RemoveMID(void) DS_Dispatch_Test_SetupMsg(CFE_SB_ValueToMsgId(DS_CMD_MID), DS_REMOVE_MID_CC, 1); /* Execute the function being tested */ - DS_AppProcessCmd(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_AppProcessCmd(&UT_CmdBuf.Buf)); /* Should NOT have invoked the handler this time */ UtAssert_STUB_COUNT(DS_RemoveMIDCmd, 1); @@ -521,7 +521,7 @@ void DS_AppProcessCmd_Test_CloseAll(void) DS_Dispatch_Test_SetupMsg(CFE_SB_ValueToMsgId(DS_CMD_MID), DS_CLOSE_ALL_CC, sizeof(DS_CloseAllCmd_t)); /* Execute the function being tested */ - DS_AppProcessCmd(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_AppProcessCmd(&UT_CmdBuf.Buf)); /* Verify results */ UtAssert_STUB_COUNT(DS_CloseAllCmd, 1); @@ -530,7 +530,7 @@ void DS_AppProcessCmd_Test_CloseAll(void) DS_Dispatch_Test_SetupMsg(CFE_SB_ValueToMsgId(DS_CMD_MID), DS_CLOSE_ALL_CC, 1); /* Execute the function being tested */ - DS_AppProcessCmd(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_AppProcessCmd(&UT_CmdBuf.Buf)); /* Should NOT have invoked the handler this time */ UtAssert_STUB_COUNT(DS_CloseAllCmd, 1); @@ -541,7 +541,7 @@ void DS_AppProcessCmd_Test_InvalidCommandCode(void) DS_Dispatch_Test_SetupMsg(CFE_SB_ValueToMsgId(DS_CMD_MID), 99, sizeof(DS_CloseAllCmd_t)); /* Execute the function being tested */ - DS_AppProcessCmd(&UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_AppProcessCmd(&UT_CmdBuf.Buf)); /* Verify results */ UtAssert_UINT32_EQ(DS_AppData.CmdRejectedCounter, 1); diff --git a/unit-test/ds_file_tests.c b/unit-test/ds_file_tests.c index f978e31..baece77 100644 --- a/unit-test/ds_file_tests.c +++ b/unit-test/ds_file_tests.c @@ -97,7 +97,7 @@ void DS_FileStorePacket_Test_Nominal(void) DS_AppData.FileStatus[0].FileSize = 0; /* Execute the function being tested */ - DS_FileStorePacket(MessageID, &UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_FileStorePacket(MessageID, &UT_CmdBuf.Buf)); /* Verify results */ UtAssert_UINT32_EQ(DS_AppData.PassedPktCounter, 1); @@ -125,7 +125,7 @@ void DS_FileStorePacket_Test_PacketNotInTable(void) UT_SetDefaultReturnValue(UT_KEY(DS_TableFindMsgID), DS_INDEX_NONE); /* Execute the function being tested */ - DS_FileStorePacket(MessageID, &UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_FileStorePacket(MessageID, &UT_CmdBuf.Buf)); /* Verify results */ UtAssert_INT32_EQ(DS_AppData.IgnoredPktCounter, 1); @@ -158,7 +158,7 @@ void DS_FileStorePacket_Test_PassedFilterFalse(void) DS_AppData.FileStatus[0].FileState = DS_ENABLED; /* Execute the function being tested */ - DS_FileStorePacket(MessageID, &UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_FileStorePacket(MessageID, &UT_CmdBuf.Buf)); /* Verify results */ UtAssert_UINT32_EQ(DS_AppData.FilteredPktCounter, 1); @@ -189,7 +189,7 @@ void DS_FileStorePacket_Test_DisabledDest(void) DS_AppData.FileStatus[0].FileState = DS_DISABLED; /* Execute the function being tested */ - DS_FileStorePacket(MessageID, &UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_FileStorePacket(MessageID, &UT_CmdBuf.Buf)); /* Verify results */ UtAssert_UINT32_EQ(DS_AppData.FilteredPktCounter, 1); @@ -221,7 +221,7 @@ void DS_FileStorePacket_Test_InvalidIndex(void) DS_AppData.FileStatus[0].FileState = DS_ENABLED; /* Execute the function being tested */ - DS_FileStorePacket(MessageID, &UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_FileStorePacket(MessageID, &UT_CmdBuf.Buf)); /* Verify results */ UtAssert_UINT32_EQ(DS_AppData.FilteredPktCounter, 1); @@ -245,7 +245,7 @@ void DS_FileSetupWrite_Test_Nominal(void) DS_AppData.FileStatus[FileIndex].FileSize = 3; /* Execute the function being tested */ - DS_FileSetupWrite(FileIndex, &UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_FileSetupWrite(FileIndex, &UT_CmdBuf.Buf)); /* Verify results */ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); @@ -304,7 +304,7 @@ void DS_FileSetupWrite_Test_MaxFileSizeExceeded(void) #endif /* Execute the function being tested */ - DS_FileSetupWrite(FileIndex, &UT_CmdBuf.Buf); + UtAssert_VOIDCALL(DS_FileSetupWrite(FileIndex, &UT_CmdBuf.Buf)); /* Verify results */ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); @@ -356,7 +356,7 @@ void DS_FileWriteData_Test_Error(void) DS_AppData.DestFileTblPtr->File[FileIndex].Movename[0] = '\0'; /* Execute the function being tested */ - DS_FileWriteData(FileIndex, &UT_CmdBuf.Buf, DataLength); + UtAssert_VOIDCALL(DS_FileWriteData(FileIndex, &UT_CmdBuf.Buf, DataLength)); /* Verify results */ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); @@ -372,7 +372,7 @@ void DS_FileWriteHeader_Test_PlatformConfigCFE_Nominal(void) DS_AppData.DestFileTblPtr->File[FileIndex].FileNameType = 1; /* Execute the function being tested */ - DS_FileWriteHeader(FileIndex); + UtAssert_VOIDCALL(DS_FileWriteHeader(FileIndex)); /* Verify results */ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); @@ -397,7 +397,7 @@ void DS_FileWriteHeader_Test_PrimaryHeaderError(void) UT_SetDefaultReturnValue(UT_KEY(CFE_FS_WriteHeader), -1); /* Execute the function being tested */ - DS_FileWriteHeader(FileIndex); + UtAssert_VOIDCALL(DS_FileWriteHeader(FileIndex)); /* Verify results */ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); @@ -418,7 +418,7 @@ void DS_FileWriteHeader_Test_SecondaryHeaderError(void) DS_AppData.DestFileTblPtr->File[FileIndex].Movename[0] = '\0'; /* Set to generate secondary header error */ - UT_SetDefaultReturnValue(UT_KEY(OS_write), -1); + UtAssert_VOIDCALL(UT_SetDefaultReturnValue(UT_KEY(OS_write), -1)); /* Execute the function being tested */ DS_FileWriteHeader(FileIndex); @@ -445,7 +445,7 @@ void DS_FileWriteError_Test(void) strncpy(DS_AppData.FileStatus[FileIndex].FileName, "filename", sizeof(DS_AppData.FileStatus[FileIndex].FileName)); /* Execute the function being tested */ - DS_FileWriteError(FileIndex, DataLength, WriteResult); + UtAssert_VOIDCALL(DS_FileWriteError(FileIndex, DataLength, WriteResult)); /* Verify results */ UtAssert_UINT32_EQ(DS_AppData.FileWriteErrCounter, 1); @@ -472,7 +472,7 @@ void DS_FileCreateDest_Test_Nominal(void) DS_AppData.DestFileTblPtr->File[FileIndex].FileNameType = DS_BY_COUNT; /* Execute the function being tested */ - DS_FileCreateDest(FileIndex); + UtAssert_VOIDCALL(DS_FileCreateDest(FileIndex)); /* Verify results */ #if DS_FILE_HEADER_TYPE == DS_FILE_HEADER_CFE @@ -518,7 +518,7 @@ void DS_FileCreateDest_Test_NominalRollover(void) DS_AppData.DestFileTblPtr->File[FileIndex].FileNameType = DS_BY_COUNT; DS_AppData.DestFileTblPtr->File[FileIndex].SequenceCount = 3; /* Execute the function being tested */ - DS_FileCreateDest(FileIndex); + UtAssert_VOIDCALL(DS_FileCreateDest(FileIndex)); /* Verify results */ #if DS_FILE_HEADER_TYPE == DS_FILE_HEADER_CFE @@ -551,7 +551,7 @@ void DS_FileCreateDest_Test_Error(void) UT_SetDefaultReturnValue(UT_KEY(OS_OpenCreate), -1); /* Execute the function being tested */ - DS_FileCreateDest(FileIndex); + UtAssert_VOIDCALL(DS_FileCreateDest(FileIndex)); /* Verify results */ UtAssert_UINT32_EQ(DS_AppData.FileWriteErrCounter, 1); @@ -580,7 +580,7 @@ void DS_FileCreateDest_Test_ClosedFileHandle(void) UT_SetDefaultReturnValue(UT_KEY(CFE_FS_WriteHeader), -1); /* Execute the function being tested */ - DS_FileCreateDest(FileIndex); + UtAssert_VOIDCALL(DS_FileCreateDest(FileIndex)); /* Verify results */ UtAssert_INT32_EQ(DS_AppData.FileWriteCounter, 1); @@ -604,7 +604,7 @@ void DS_FileCreateName_Test_Nominal(void) DS_AppData.FileStatus[FileIndex].FileCount = 1; /* Execute the function being tested */ - DS_FileCreateName(FileIndex); + UtAssert_VOIDCALL(DS_FileCreateName(FileIndex)); /* Verify results */ UtAssert_STRINGBUF_EQ(DS_AppData.FileStatus[FileIndex].FileName, sizeof(DS_AppData.FileStatus[FileIndex].FileName), @@ -630,7 +630,7 @@ void DS_FileCreateName_Test_NominalWithSeparator(void) DS_AppData.FileStatus[FileIndex].FileCount = 1; /* Execute the function being tested */ - DS_FileCreateName(FileIndex); + UtAssert_VOIDCALL(DS_FileCreateName(FileIndex)); /* Verify results */ UtAssert_STRINGBUF_EQ(DS_AppData.FileStatus[FileIndex].FileName, sizeof(DS_AppData.FileStatus[FileIndex].FileName), @@ -656,7 +656,7 @@ void DS_FileCreateName_Test_NominalWithPeriod(void) DS_AppData.FileStatus[FileIndex].FileCount = 1; /* Execute the function being tested */ - DS_FileCreateName(FileIndex); + UtAssert_VOIDCALL(DS_FileCreateName(FileIndex)); /* Verify results */ UtAssert_STRINGBUF_EQ(DS_AppData.FileStatus[FileIndex].FileName, sizeof(DS_AppData.FileStatus[FileIndex].FileName), @@ -676,7 +676,7 @@ void DS_FileCreateName_Test_EmptyPath(void) DS_AppData.FileStatus[FileIndex].FileCount = 1; /* Execute the function being tested */ - DS_FileCreateName(FileIndex); + UtAssert_VOIDCALL(DS_FileCreateName(FileIndex)); /* Verify results */ UtAssert_UINT32_EQ(DS_AppData.FileStatus[FileIndex].FileState, DS_DISABLED); @@ -701,7 +701,7 @@ void DS_FileCreateName_Test_Error(void) DS_AppData.DestFileTblPtr->File[FileIndex].Basename[DS_TOTAL_FNAME_BUFSIZE - 1] = '\0'; /* Execute the function being tested */ - DS_FileCreateName(FileIndex); + UtAssert_VOIDCALL(DS_FileCreateName(FileIndex)); /* Verify results */ UtAssert_UINT32_EQ(DS_AppData.FileStatus[FileIndex].FileState, DS_DISABLED); @@ -796,7 +796,7 @@ void DS_FileCreateSequence_Test_ByCount(void) memset(Sequence, 0, sizeof(Sequence)); /* Execute the function being tested */ - DS_FileCreateSequence(Sequence, DS_BY_COUNT, Count); + UtAssert_VOIDCALL(DS_FileCreateSequence(Sequence, DS_BY_COUNT, Count)); /* Verify results */ UtAssert_STRINGBUF_EQ(Sequence, sizeof(Sequence), StrCompare, sizeof(StrCompare)); @@ -847,7 +847,7 @@ void DS_FileCreateSequence_Test_BadFilenameType(void) DS_AppData.FileStatus[FileIndex].FileCount = 1; /* Execute the function being tested */ - DS_FileCreateSequence(Sequence, 99, DS_AppData.FileStatus[FileIndex].FileCount); + UtAssert_VOIDCALL(DS_FileCreateSequence(Sequence, 99, DS_AppData.FileStatus[FileIndex].FileCount)); /* Verify results */ UtAssert_UINT32_EQ(strncmp(Sequence, "", DS_TOTAL_FNAME_BUFSIZE), 0); @@ -861,7 +861,7 @@ void DS_FileUpdateHeader_Test_PlatformConfigCFE_Nominal(void) int32 FileIndex = 0; /* Execute the function being tested */ - DS_FileUpdateHeader(FileIndex); + UtAssert_VOIDCALL(DS_FileUpdateHeader(FileIndex)); /* Verify results */ UtAssert_UINT32_EQ(DS_AppData.FileUpdateCounter, 1); @@ -878,7 +878,7 @@ void DS_FileUpdateHeader_Test_WriteError(void) UT_SetDefaultReturnValue(UT_KEY(OS_write), -1); /* Execute the function being tested */ - DS_FileUpdateHeader(FileIndex); + UtAssert_VOIDCALL(DS_FileUpdateHeader(FileIndex)); /* Verify results */ UtAssert_UINT32_EQ(DS_AppData.FileUpdateErrCounter, 1); @@ -895,7 +895,7 @@ void DS_FileUpdateHeader_Test_PlatformConfigCFE_SeekError(void) UT_SetDefaultReturnValue(UT_KEY(OS_lseek), -1); /* Execute the function being tested */ - DS_FileUpdateHeader(FileIndex); + UtAssert_VOIDCALL(DS_FileUpdateHeader(FileIndex)); /* Verify results */ UtAssert_UINT32_EQ(DS_AppData.FileUpdateErrCounter, 1); @@ -917,7 +917,7 @@ void DS_FileCloseDest_Test_PlatformConfigMoveFiles_Nominal(void) sizeof(DS_AppData.DestFileTblPtr->File[FileIndex].Movename)); /* Execute the function being tested */ - DS_FileCloseDest(FileIndex); + UtAssert_VOIDCALL(DS_FileCloseDest(FileIndex)); /* Verify results */ UtAssert_BOOL_FALSE(OS_ObjectIdDefined(DS_AppData.FileStatus[FileIndex].FileHandle)); @@ -945,7 +945,7 @@ void DS_FileCloseDest_Test_PlatformConfigMoveFiles_MoveError(void) UT_SetDefaultReturnValue(UT_KEY(OS_mv), -1); /* Execute the function being tested */ - DS_FileCloseDest(FileIndex); + UtAssert_VOIDCALL(DS_FileCloseDest(FileIndex)); UtAssert_UINT32_EQ(DS_AppData.FileStatus[FileIndex].FileAge, 0); UtAssert_UINT32_EQ(DS_AppData.FileStatus[FileIndex].FileSize, 0); @@ -973,7 +973,7 @@ void DS_FileCloseDest_Test_PlatformConfigMoveFiles_FilenameTooLarge(void) sizeof(DS_AppData.DestFileTblPtr->File[FileIndex].Movename)); /* Execute the function being tested */ - DS_FileCloseDest(FileIndex); + UtAssert_VOIDCALL(DS_FileCloseDest(FileIndex)); UtAssert_UINT32_EQ(DS_AppData.FileStatus[FileIndex].FileAge, 0); UtAssert_UINT32_EQ(DS_AppData.FileStatus[FileIndex].FileSize, 0); @@ -1018,7 +1018,7 @@ void DS_FileCloseDest_Test_MoveFilesFalse(void) OS_OpenCreate(&DS_AppData.FileStatus[FileIndex].FileHandle, NULL, 0, 0); /* Execute the function being tested */ - DS_FileCloseDest(FileIndex); + UtAssert_VOIDCALL(DS_FileCloseDest(FileIndex)); /* Verify results */ UtAssert_UINT32_EQ(DS_AppData.FileStatus[FileIndex].FileHandle, OS_OBJECT_ID_UNDEFINED); @@ -1047,7 +1047,7 @@ void DS_FileTestAge_Test_Nominal(void) DS_AppData.DestFileTblPtr->File[FileIndex].MaxFileAge = 3; /* Execute the function being tested */ - DS_FileTestAge(ElapsedSeconds); + UtAssert_VOIDCALL(DS_FileTestAge(ElapsedSeconds)); /* Verify results */ UtAssert_UINT32_EQ(DS_AppData.FileStatus[FileIndex].FileAge, 2); @@ -1060,7 +1060,7 @@ void DS_FileTestAge_Test_NullTable(void) DS_AppData.DestFileTblPtr = NULL; /* Execute the function being tested */ - DS_FileTestAge(ElapsedSeconds); + UtAssert_VOIDCALL(DS_FileTestAge(ElapsedSeconds)); /* Verify results */ UtAssert_STUB_COUNT(OS_close, 0); @@ -1078,7 +1078,7 @@ void DS_FileTestAge_Test_ExceedMaxAge(void) DS_AppData.DestFileTblPtr->File[FileIndex].MaxFileAge = 1; /* Execute the function being tested */ - DS_FileTestAge(ElapsedSeconds); + UtAssert_VOIDCALL(DS_FileTestAge(ElapsedSeconds)); /* Verify results */ UtAssert_UINT32_EQ(DS_AppData.FileStatus[FileIndex].FileAge, 0); @@ -1087,7 +1087,6 @@ void DS_FileTestAge_Test_ExceedMaxAge(void) void DS_IsPacketFiltered_Test_AlgX0(void) { - bool Result; CFE_MSG_Message_t Message; uint16 FilterType = 2; uint16 Alg_N = 0; @@ -1095,15 +1094,11 @@ void DS_IsPacketFiltered_Test_AlgX0(void) uint16 Alg_O = 0; /* Execute the function being tested */ - Result = DS_IsPacketFiltered(&Message, FilterType, Alg_N, Alg_X, Alg_O); - - /* Verify results */ - UtAssert_BOOL_TRUE(Result); + UtAssert_BOOL_TRUE(DS_IsPacketFiltered(&Message, FilterType, Alg_N, Alg_X, Alg_O)); } void DS_IsPacketFiltered_Test_AlgN0(void) { - bool Result; CFE_MSG_Message_t Message; uint16 FilterType = 2; uint16 Alg_N = 0; @@ -1111,15 +1106,11 @@ void DS_IsPacketFiltered_Test_AlgN0(void) uint16 Alg_O = 0; /* Execute the function being tested */ - Result = DS_IsPacketFiltered(&Message, FilterType, Alg_N, Alg_X, Alg_O); - - /* Verify results */ - UtAssert_BOOL_TRUE(Result); + UtAssert_BOOL_TRUE(DS_IsPacketFiltered(&Message, FilterType, Alg_N, Alg_X, Alg_O)); } void DS_IsPacketFiltered_Test_AlgNGreaterX(void) { - bool Result; CFE_MSG_Message_t Message; uint16 FilterType = 2; uint16 Alg_N = 2; @@ -1127,15 +1118,11 @@ void DS_IsPacketFiltered_Test_AlgNGreaterX(void) uint16 Alg_O = 0; /* Execute the function being tested */ - Result = DS_IsPacketFiltered(&Message, FilterType, Alg_N, Alg_X, Alg_O); - - /* Verify results */ - UtAssert_BOOL_TRUE(Result); + UtAssert_BOOL_TRUE(DS_IsPacketFiltered(&Message, FilterType, Alg_N, Alg_X, Alg_O)); } void DS_IsPacketFiltered_Test_Alg0GreaterX(void) { - bool Result; CFE_MSG_Message_t Message; uint16 FilterType = 2; uint16 Alg_N = 1; @@ -1143,15 +1130,11 @@ void DS_IsPacketFiltered_Test_Alg0GreaterX(void) uint16 Alg_O = 2; /* Execute the function being tested */ - Result = DS_IsPacketFiltered(&Message, FilterType, Alg_N, Alg_X, Alg_O); - - /* Verify results */ - UtAssert_BOOL_TRUE(Result); + UtAssert_BOOL_TRUE(DS_IsPacketFiltered(&Message, FilterType, Alg_N, Alg_X, Alg_O)); } void DS_IsPacketFiltered_Test_Alg0EqualX(void) { - bool Result; CFE_MSG_Message_t Message; uint16 FilterType = 2; uint16 Alg_N = 1; @@ -1159,15 +1142,11 @@ void DS_IsPacketFiltered_Test_Alg0EqualX(void) uint16 Alg_O = 1; /* Execute the function being tested */ - Result = DS_IsPacketFiltered(&Message, FilterType, Alg_N, Alg_X, Alg_O); - - /* Verify results */ - UtAssert_BOOL_TRUE(Result); + UtAssert_BOOL_TRUE(DS_IsPacketFiltered(&Message, FilterType, Alg_N, Alg_X, Alg_O)); } void DS_IsPacketFiltered_Test_InvalidFilterType(void) { - bool Result; CFE_MSG_Message_t Message; uint16 FilterType = 0xff; uint16 Alg_N = 1; @@ -1175,15 +1154,11 @@ void DS_IsPacketFiltered_Test_InvalidFilterType(void) uint16 Alg_O = 0; /* Execute the function being tested */ - Result = DS_IsPacketFiltered(&Message, FilterType, Alg_N, Alg_X, Alg_O); - - /* Verify results */ - UtAssert_BOOL_TRUE(Result); + UtAssert_BOOL_TRUE(DS_IsPacketFiltered(&Message, FilterType, Alg_N, Alg_X, Alg_O)); } void DS_IsPacketFiltered_Test_SeqFilter(void) { - bool Result; CFE_MSG_Message_t Message; CFE_MSG_SequenceCount_t SeqCnt = 0; uint16 FilterType = 1; @@ -1196,15 +1171,11 @@ void DS_IsPacketFiltered_Test_SeqFilter(void) UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSequenceCount), &SeqCnt, sizeof(SeqCnt), false); /* Execute the function being tested */ - Result = DS_IsPacketFiltered(&Message, FilterType, Alg_N, Alg_X, Alg_O); - - /* Verify results */ - UtAssert_BOOL_FALSE(Result); + UtAssert_BOOL_FALSE(DS_IsPacketFiltered(&Message, FilterType, Alg_N, Alg_X, Alg_O)); } void DS_IsPacketFiltered_Test_TimeFilter1(void) { - bool Result; CFE_MSG_Message_t Message; CFE_TIME_SysTime_t PacketTime; uint16 FilterType = 2; @@ -1221,15 +1192,11 @@ void DS_IsPacketFiltered_Test_TimeFilter1(void) UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgTime), &PacketTime, sizeof(PacketTime), false); /* Execute the function being tested */ - Result = DS_IsPacketFiltered(&Message, FilterType, Alg_N, Alg_X, Alg_O); - - /* Verify results */ - UtAssert_BOOL_FALSE(Result); + UtAssert_BOOL_FALSE(DS_IsPacketFiltered(&Message, FilterType, Alg_N, Alg_X, Alg_O)); } void DS_IsPacketFiltered_Test_TimeFilter2(void) { - bool Result; CFE_MSG_Message_t Message; CFE_TIME_SysTime_t PacketTime; uint16 FilterType = 2; @@ -1246,15 +1213,11 @@ void DS_IsPacketFiltered_Test_TimeFilter2(void) UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgTime), &PacketTime, sizeof(PacketTime), false); /* Execute the function being tested */ - Result = DS_IsPacketFiltered(&Message, FilterType, Alg_N, Alg_X, Alg_O); - - /* Verify results */ - UtAssert_BOOL_TRUE(Result); + UtAssert_BOOL_TRUE(DS_IsPacketFiltered(&Message, FilterType, Alg_N, Alg_X, Alg_O)); } void DS_IsPacketFiltered_Test_TimeFilter3(void) { - bool Result; CFE_MSG_Message_t Message; CFE_TIME_SysTime_t PacketTime; uint16 FilterType = 2; @@ -1271,10 +1234,7 @@ void DS_IsPacketFiltered_Test_TimeFilter3(void) UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgTime), &PacketTime, sizeof(PacketTime), false); /* Execute the function being tested */ - Result = DS_IsPacketFiltered(&Message, FilterType, Alg_N, Alg_X, Alg_O); - - /* Verify results */ - UtAssert_BOOL_TRUE(Result); + UtAssert_BOOL_TRUE(DS_IsPacketFiltered(&Message, FilterType, Alg_N, Alg_X, Alg_O)); } void DS_FileTransmit_Test_Nominal(void) From 3f41af76c53c1f208d34d07bc0e3a0922f6e1dd9 Mon Sep 17 00:00:00 2001 From: jdfiguer Date: Wed, 31 Jan 2024 15:11:34 -0500 Subject: [PATCH 7/9] Fix #95, Replaces conditionally compiled code with runtime conditional logic --- fsw/inc/ds_extern_typedefs.h | 2 - fsw/src/ds_app.c | 1 + fsw/src/ds_app.h | 2 + fsw/src/ds_file.c | 237 +++++++++++++++++------------------ fsw/src/ds_file.h | 2 - fsw/src/ds_table.c | 16 +-- fsw/tables/ds_file_tbl.c | 32 ----- unit-test/ds_cmds_tests.c | 5 +- unit-test/ds_file_tests.c | 152 +++++++++++----------- unit-test/ds_table_tests.c | 9 +- 10 files changed, 208 insertions(+), 250 deletions(-) diff --git a/fsw/inc/ds_extern_typedefs.h b/fsw/inc/ds_extern_typedefs.h index ab5ddcb..d3b1fee 100644 --- a/fsw/inc/ds_extern_typedefs.h +++ b/fsw/inc/ds_extern_typedefs.h @@ -84,9 +84,7 @@ typedef struct */ typedef struct { -#if (DS_MOVE_FILES == true) char Movename[DS_PATHNAME_BUFSIZE]; /**< \brief Move files to this dir after close */ -#endif char Pathname[DS_PATHNAME_BUFSIZE]; /**< \brief Path portion of filename */ char Basename[DS_BASENAME_BUFSIZE]; /**< \brief Base portion of filename */ char Extension[DS_EXTENSION_BUFSIZE]; /**< \brief Extension portion of filename */ diff --git a/fsw/src/ds_app.c b/fsw/src/ds_app.c index 9f7b74b..9bd982b 100644 --- a/fsw/src/ds_app.c +++ b/fsw/src/ds_app.c @@ -184,6 +184,7 @@ CFE_Status_t DS_AppInitialize(void) memset(&DS_AppData, 0, sizeof(DS_AppData)); DS_AppData.AppEnableState = DS_DEF_ENABLE_STATE; + DS_AppData.EnableMoveFiles = DS_MOVE_FILES; /* ** Mark files as closed diff --git a/fsw/src/ds_app.h b/fsw/src/ds_app.h index 94c731a..488e189 100644 --- a/fsw/src/ds_app.h +++ b/fsw/src/ds_app.h @@ -104,6 +104,8 @@ typedef struct DS_HashLink_t HashLinks[DS_PACKETS_IN_FILTER_TABLE]; /**< \brief Hash table linked list elements */ DS_HashLink_t *HashTable[DS_HASH_TABLE_ENTRIES]; /**< \brief Each hash table entry is a linked list */ + + uint8 EnableMoveFiles; /**< \brief Whether to move files to downlink directory after close */ } DS_AppData_t; /** \brief DS global data structure reference */ diff --git a/fsw/src/ds_file.c b/fsw/src/ds_file.c index f6fd76b..fb9f31c 100644 --- a/fsw/src/ds_file.c +++ b/fsw/src/ds_file.c @@ -376,73 +376,73 @@ void DS_FileWriteData(int32 FileIndex, const void *FileData, uint32 DataLength) void DS_FileWriteHeader(int32 FileIndex) { -#if (DS_FILE_HEADER_TYPE == DS_FILE_HEADER_CFE) - - DS_DestFileEntry_t *DestFile = &DS_AppData.DestFileTblPtr->File[FileIndex]; - DS_AppFileStatus_t *FileStatus = &DS_AppData.FileStatus[FileIndex]; - CFE_FS_Header_t CFE_FS_Header; - DS_FileHeader_t DS_FileHeader; - int32 Result; - - /* - ** Initialize selected parts of the cFE file header... - */ - CFE_FS_InitHeader(&CFE_FS_Header, DS_FILE_HDR_DESCRIPTION, DS_FILE_HDR_SUBTYPE); - - /* - ** Let cFE finish the init and write the primary header... - */ - Result = CFE_FS_WriteHeader(FileStatus->FileHandle, &CFE_FS_Header); - - if (Result == sizeof(CFE_FS_Header_t)) + if (DS_FILE_HEADER_TYPE == DS_FILE_HEADER_CFE) { - /* - ** Success - update file size and data rate counters... - */ - DS_AppData.FileWriteCounter++; - - FileStatus->FileSize += sizeof(CFE_FS_Header_t); - FileStatus->FileGrowth += sizeof(CFE_FS_Header_t); + DS_DestFileEntry_t *DestFile = &DS_AppData.DestFileTblPtr->File[FileIndex]; + DS_AppFileStatus_t *FileStatus = &DS_AppData.FileStatus[FileIndex]; + CFE_FS_Header_t CFE_FS_Header; + DS_FileHeader_t DS_FileHeader; + int32 Result; /* - ** Initialize the DS file header... + ** Initialize selected parts of the cFE file header... */ - memset(&DS_FileHeader, 0, sizeof(DS_FileHeader)); - DS_FileHeader.FileTableIndex = FileIndex; - DS_FileHeader.FileNameType = DestFile->FileNameType; - strncpy(DS_FileHeader.FileName, FileStatus->FileName, sizeof(DS_FileHeader.FileName)); + CFE_FS_InitHeader(&CFE_FS_Header, DS_FILE_HDR_DESCRIPTION, DS_FILE_HDR_SUBTYPE); /* - ** Manually write the secondary header... + ** Let cFE finish the init and write the primary header... */ - Result = OS_write(FileStatus->FileHandle, &DS_FileHeader, sizeof(DS_FileHeader_t)); + Result = CFE_FS_WriteHeader(FileStatus->FileHandle, &CFE_FS_Header); - if (Result == sizeof(DS_FileHeader_t)) + if (Result == sizeof(CFE_FS_Header_t)) { /* ** Success - update file size and data rate counters... */ DS_AppData.FileWriteCounter++; - FileStatus->FileSize += sizeof(DS_FileHeader_t); - FileStatus->FileGrowth += sizeof(DS_FileHeader_t); + FileStatus->FileSize += sizeof(CFE_FS_Header_t); + FileStatus->FileGrowth += sizeof(CFE_FS_Header_t); + + /* + ** Initialize the DS file header... + */ + memset(&DS_FileHeader, 0, sizeof(DS_FileHeader)); + DS_FileHeader.FileTableIndex = FileIndex; + DS_FileHeader.FileNameType = DestFile->FileNameType; + strncpy(DS_FileHeader.FileName, FileStatus->FileName, sizeof(DS_FileHeader.FileName)); + + /* + ** Manually write the secondary header... + */ + Result = OS_write(FileStatus->FileHandle, &DS_FileHeader, sizeof(DS_FileHeader_t)); + + if (Result == sizeof(DS_FileHeader_t)) + { + /* + ** Success - update file size and data rate counters... + */ + DS_AppData.FileWriteCounter++; + + FileStatus->FileSize += sizeof(DS_FileHeader_t); + FileStatus->FileGrowth += sizeof(DS_FileHeader_t); + } + else + { + /* + ** Error - send event, close file and disable destination... + */ + DS_FileWriteError(FileIndex, sizeof(DS_FileHeader_t), Result); + } } else { /* ** Error - send event, close file and disable destination... */ - DS_FileWriteError(FileIndex, sizeof(DS_FileHeader_t), Result); + DS_FileWriteError(FileIndex, sizeof(CFE_FS_Header_t), Result); } } - else - { - /* - ** Error - send event, close file and disable destination... - */ - DS_FileWriteError(FileIndex, sizeof(CFE_FS_Header_t), Result); - } -#endif } /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -761,35 +761,36 @@ void DS_FileCreateSequence(char *Buffer, uint32 Type, uint32 Count) void DS_FileUpdateHeader(int32 FileIndex) { -#if (DS_FILE_HEADER_TYPE == DS_FILE_HEADER_CFE) - /* - ** Update CFE specific header fields... - */ - DS_AppFileStatus_t *FileStatus = &DS_AppData.FileStatus[FileIndex]; - CFE_TIME_SysTime_t CurrentTime = CFE_TIME_GetTime(); - int32 Result; - - Result = OS_lseek(FileStatus->FileHandle, sizeof(CFE_FS_Header_t), OS_SEEK_SET); - - if (Result == sizeof(CFE_FS_Header_t)) + if (DS_FILE_HEADER_TYPE == DS_FILE_HEADER_CFE) { - /* update file close time */ - Result = OS_write(FileStatus->FileHandle, &CurrentTime, sizeof(CFE_TIME_SysTime_t)); + /* + ** Update CFE specific header fields... + */ + DS_AppFileStatus_t *FileStatus = &DS_AppData.FileStatus[FileIndex]; + CFE_TIME_SysTime_t CurrentTime = CFE_TIME_GetTime(); + int32 Result; - if (Result == sizeof(CFE_TIME_SysTime_t)) + Result = OS_lseek(FileStatus->FileHandle, sizeof(CFE_FS_Header_t), OS_SEEK_SET); + + if (Result == sizeof(CFE_FS_Header_t)) { - DS_AppData.FileUpdateCounter++; + /* update file close time */ + Result = OS_write(FileStatus->FileHandle, &CurrentTime, sizeof(CFE_TIME_SysTime_t)); + + if (Result == sizeof(CFE_TIME_SysTime_t)) + { + DS_AppData.FileUpdateCounter++; + } + else + { + DS_AppData.FileUpdateErrCounter++; + } } else { DS_AppData.FileUpdateErrCounter++; } } - else - { - DS_AppData.FileUpdateErrCounter++; - } -#endif } /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -800,68 +801,74 @@ void DS_FileUpdateHeader(int32 FileIndex) void DS_FileCloseDest(int32 FileIndex) { DS_AppFileStatus_t *FileStatus = &DS_AppData.FileStatus[FileIndex]; - -#if (DS_MOVE_FILES == true) - /* - ** Move file from working directory to downlink directory... - */ - int32 OS_result; - int32 PathLength; - char *FileName; - char PathName[DS_TOTAL_FNAME_BUFSIZE]; + int32 OS_result; + int32 PathLength; + char * FileName; + char PathName[DS_TOTAL_FNAME_BUFSIZE]; /* ** First, close the file... */ OS_close(FileStatus->FileHandle); - /* - ** Move file only if table has a downlink directory name... - */ - if (DS_AppData.DestFileTblPtr->File[FileIndex].Movename[0] != '\0') + if (DS_AppData.EnableMoveFiles == DS_ENABLED) { /* - ** Make sure directory name does not end with slash character... + ** Move file only if table has a downlink directory name... */ - CFE_SB_MessageStringGet(PathName, DS_AppData.DestFileTblPtr->File[FileIndex].Movename, NULL, sizeof(PathName), - sizeof(DS_AppData.DestFileTblPtr->File[FileIndex].Movename)); - PathLength = strlen(PathName); - if (PathName[PathLength - 1] == '/') + if (DS_AppData.DestFileTblPtr->File[FileIndex].Movename[0] != '\0') { - PathName[PathLength - 1] = '\0'; - PathLength--; - } - - /* - ** Get a pointer to slash character before the filename... - */ - FileName = strrchr(FileStatus->FileName, '/'); + /* + ** Make sure directory name does not end with slash character... + */ + CFE_SB_MessageStringGet(PathName, DS_AppData.DestFileTblPtr->File[FileIndex].Movename, NULL, + sizeof(PathName), sizeof(DS_AppData.DestFileTblPtr->File[FileIndex].Movename)); + PathLength = strlen(PathName); + if (PathName[PathLength - 1] == '/') + { + PathName[PathLength - 1] = '\0'; + PathLength--; + } - if (FileName != NULL) - { /* - ** Verify that directory name plus filename is not too large... + ** Get a pointer to slash character before the filename... */ - if ((PathLength + strlen(FileName)) < DS_TOTAL_FNAME_BUFSIZE) + FileName = strrchr(FileStatus->FileName, '/'); + + if (FileName != NULL) { /* - ** Append the filename (with slash) to the directory name... + ** Verify that directory name plus filename is not too large... */ - strcat(PathName, FileName); + if ((PathLength + strlen(FileName)) < DS_TOTAL_FNAME_BUFSIZE) + { + /* + ** Append the filename (with slash) to the directory name... + */ + strcat(PathName, FileName); - /* - ** Use OS function to move/rename the file... - */ - OS_result = OS_mv(FileStatus->FileName, PathName); + /* + ** Use OS function to move/rename the file... + */ + OS_result = OS_mv(FileStatus->FileName, PathName); - if (OS_result != OS_SUCCESS) + if (OS_result != OS_SUCCESS) + { + /* + ** Error - send event but leave destination enabled... + */ + CFE_EVS_SendEvent(DS_MOVE_FILE_ERR_EID, CFE_EVS_EventType_ERROR, + "FILE MOVE error: src = '%s', tgt = '%s', result = %d", FileStatus->FileName, + PathName, (int)OS_result); + } + } + else { /* ** Error - send event but leave destination enabled... */ CFE_EVS_SendEvent(DS_MOVE_FILE_ERR_EID, CFE_EVS_EventType_ERROR, - "FILE MOVE error: src = '%s', tgt = '%s', result = %d", FileStatus->FileName, - PathName, (int)OS_result); + "FILE MOVE error: dir name = '%s', filename = '%s'", PathName, FileName); } } else @@ -870,27 +877,13 @@ void DS_FileCloseDest(int32 FileIndex) ** Error - send event but leave destination enabled... */ CFE_EVS_SendEvent(DS_MOVE_FILE_ERR_EID, CFE_EVS_EventType_ERROR, - "FILE MOVE error: dir name = '%s', filename = '%s'", PathName, FileName); + "FILE MOVE error: dir name = '%s', filename = 'NULL'", PathName); } - } - else - { - /* - ** Error - send event but leave destination enabled... - */ - CFE_EVS_SendEvent(DS_MOVE_FILE_ERR_EID, CFE_EVS_EventType_ERROR, - "FILE MOVE error: dir name = '%s', filename = 'NULL'", PathName); - } - /* Update the path name for reporting */ - strncpy(FileStatus->FileName, PathName, sizeof(FileStatus->FileName)); + /* Update the path name for reporting */ + strncpy(FileStatus->FileName, PathName, sizeof(FileStatus->FileName)); + } } -#else - /* - ** Close the file... - */ - OS_close(FileStatus->FileHandle); -#endif /* ** Transmit file information telemetry... diff --git a/fsw/src/ds_file.h b/fsw/src/ds_file.h index c26c9c5..c92e102 100644 --- a/fsw/src/ds_file.h +++ b/fsw/src/ds_file.h @@ -35,7 +35,6 @@ /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#if (DS_FILE_HEADER_TYPE == DS_FILE_HEADER_CFE) /** * \brief DS File Header (follows cFE file header at start of file) */ @@ -49,7 +48,6 @@ typedef struct char FileName[DS_TOTAL_FNAME_BUFSIZE]; /**< \brief On-board filename */ } DS_FileHeader_t; -#endif /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ diff --git a/fsw/src/ds_table.c b/fsw/src/ds_table.c index 2e9d3db..9643e9b 100644 --- a/fsw/src/ds_table.c +++ b/fsw/src/ds_table.c @@ -52,9 +52,10 @@ CFE_Status_t DS_TableInit(void) bool NeedToLoadFilterTable = false; uint16 TableRegisterFlags = CFE_TBL_OPT_SNGL_BUFFER | CFE_TBL_OPT_LOAD_DUMP; -#if (DS_MAKE_TABLES_CRITICAL == 1) - TableRegisterFlags |= CFE_TBL_OPT_CRITICAL; -#endif + if (DS_MAKE_TABLES_CRITICAL == 1) + { + TableRegisterFlags |= CFE_TBL_OPT_CRITICAL; + } /* ** If registration fails for either table then the DS app will @@ -909,10 +910,11 @@ CFE_Status_t DS_TableCreateCDS(void) DS_AppData.FileStatus[i].FileCount = DataStoreBuffer[i]; } -#if (DS_CDS_ENABLE_STATE == 1) - /* Only restore enable/disable state if configured */ - DS_AppData.AppEnableState = (uint8)DataStoreBuffer[DS_DEST_FILE_CNT]; -#endif + if (DS_CDS_ENABLE_STATE == 1) + { + /* Only restore enable/disable state if configured */ + DS_AppData.AppEnableState = (uint8)DataStoreBuffer[DS_DEST_FILE_CNT]; + } } } diff --git a/fsw/tables/ds_file_tbl.c b/fsw/tables/ds_file_tbl.c index 78b990f..e841609 100644 --- a/fsw/tables/ds_file_tbl.c +++ b/fsw/tables/ds_file_tbl.c @@ -74,9 +74,7 @@ DS_DestFileTable_t DS_DestFileTable = { { /* File Index 00 -- event packets only */ { -#if (DS_MOVE_FILES == true) /* .Movename = */ DS_EMPTY_STRING, -#endif /* .Pathname = */ "set_by_cmd_b4_enable", /* .Basename = */ "events", /* .Extension = */ ".dat", @@ -89,9 +87,7 @@ DS_DestFileTable_t DS_DestFileTable = { }, /* File Index 01 -- application housekeeping packets */ { -#if (DS_MOVE_FILES == true) /* .Movename = */ DS_EMPTY_STRING, -#endif /* .Pathname = */ "set_by_cmd_b4_enable", /* .Basename = */ "app", /* .Extension = */ ".hk", @@ -104,9 +100,7 @@ DS_DestFileTable_t DS_DestFileTable = { }, /* File Index 02 -- application telemetry packets */ { -#if (DS_MOVE_FILES == true) /* .Movename = */ DS_EMPTY_STRING, -#endif /* .Pathname = */ "set_by_cmd_b4_enable", /* .Basename = */ "app", /* .Extension = */ ".tlm", @@ -119,9 +113,7 @@ DS_DestFileTable_t DS_DestFileTable = { }, /* File Index 03 -- hardware telemetry packets */ { -#if (DS_MOVE_FILES == true) /* .Movename = */ DS_EMPTY_STRING, -#endif /* .Pathname = */ "set_by_cmd_b4_enable", /* .Basename = */ "hw", /* .Extension = */ "tlm", @@ -134,9 +126,7 @@ DS_DestFileTable_t DS_DestFileTable = { }, /* File Index 04 -- cFE housekeeping packets */ { -#if (DS_MOVE_FILES == true) /* .Movename = */ DS_EMPTY_STRING, -#endif /* .Pathname = */ "set_by_cmd_b4_enable", /* .Basename = */ "cfe", /* .Extension = */ "hk", @@ -149,9 +139,7 @@ DS_DestFileTable_t DS_DestFileTable = { }, /* File Index 05 -- cFE telemetry packets */ { -#if (DS_MOVE_FILES == true) /* .Movename = */ DS_EMPTY_STRING, -#endif /* .Pathname = */ "set_by_cmd_b4_enable", /* .Basename = */ "cfe", /* .Extension = */ "tlm", @@ -164,9 +152,7 @@ DS_DestFileTable_t DS_DestFileTable = { }, /* File Index 06 */ { -#if (DS_MOVE_FILES == true) /* .Movename = */ DS_EMPTY_STRING, -#endif /* .Pathname = */ DS_EMPTY_STRING, /* .Basename = */ DS_EMPTY_STRING, /* .Extension = */ DS_EMPTY_STRING, @@ -179,9 +165,7 @@ DS_DestFileTable_t DS_DestFileTable = { }, /* File Index 07 */ { -#if (DS_MOVE_FILES == true) /* .Movename = */ DS_EMPTY_STRING, -#endif /* .Pathname = */ DS_EMPTY_STRING, /* .Basename = */ DS_EMPTY_STRING, /* .Extension = */ DS_EMPTY_STRING, @@ -194,9 +178,7 @@ DS_DestFileTable_t DS_DestFileTable = { }, /* File Index 08 */ { -#if (DS_MOVE_FILES == true) /* .Movename = */ DS_EMPTY_STRING, -#endif /* .Pathname = */ DS_EMPTY_STRING, /* .Basename = */ DS_EMPTY_STRING, /* .Extension = */ DS_EMPTY_STRING, @@ -209,9 +191,7 @@ DS_DestFileTable_t DS_DestFileTable = { }, /* File Index 09 */ { -#if (DS_MOVE_FILES == true) /* .Movename = */ DS_EMPTY_STRING, -#endif /* .Pathname = */ DS_EMPTY_STRING, /* .Basename = */ DS_EMPTY_STRING, /* .Extension = */ DS_EMPTY_STRING, @@ -224,9 +204,7 @@ DS_DestFileTable_t DS_DestFileTable = { }, /* File Index 10 */ { -#if (DS_MOVE_FILES == true) /* .Movename = */ DS_EMPTY_STRING, -#endif /* .Pathname = */ DS_EMPTY_STRING, /* .Basename = */ DS_EMPTY_STRING, /* .Extension = */ DS_EMPTY_STRING, @@ -239,9 +217,7 @@ DS_DestFileTable_t DS_DestFileTable = { }, /* File Index 11 */ { -#if (DS_MOVE_FILES == true) /* .Movename = */ DS_EMPTY_STRING, -#endif /* .Pathname = */ DS_EMPTY_STRING, /* .Basename = */ DS_EMPTY_STRING, /* .Extension = */ DS_EMPTY_STRING, @@ -254,9 +230,7 @@ DS_DestFileTable_t DS_DestFileTable = { }, /* File Index 12 */ { -#if (DS_MOVE_FILES == true) /* .Movename = */ DS_EMPTY_STRING, -#endif /* .Pathname = */ DS_EMPTY_STRING, /* .Basename = */ DS_EMPTY_STRING, /* .Extension = */ DS_EMPTY_STRING, @@ -269,9 +243,7 @@ DS_DestFileTable_t DS_DestFileTable = { }, /* File Index 13 */ { -#if (DS_MOVE_FILES == true) /* .Movename = */ DS_EMPTY_STRING, -#endif /* .Pathname = */ DS_EMPTY_STRING, /* .Basename = */ DS_EMPTY_STRING, /* .Extension = */ DS_EMPTY_STRING, @@ -284,9 +256,7 @@ DS_DestFileTable_t DS_DestFileTable = { }, /* File Index 14 */ { -#if (DS_MOVE_FILES == true) /* .Movename = */ DS_EMPTY_STRING, -#endif /* .Pathname = */ DS_EMPTY_STRING, /* .Basename = */ DS_EMPTY_STRING, /* .Extension = */ DS_EMPTY_STRING, @@ -299,9 +269,7 @@ DS_DestFileTable_t DS_DestFileTable = { }, /* File Index 15 */ { -#if (DS_MOVE_FILES == true) /* .Movename = */ DS_EMPTY_STRING, -#endif /* .Pathname = */ DS_EMPTY_STRING, /* .Basename = */ DS_EMPTY_STRING, /* .Extension = */ DS_EMPTY_STRING, diff --git a/unit-test/ds_cmds_tests.c b/unit-test/ds_cmds_tests.c index 3b0fc9c..376a601 100644 --- a/unit-test/ds_cmds_tests.c +++ b/unit-test/ds_cmds_tests.c @@ -991,7 +991,7 @@ void DS_SetDestSizeCmd_Test_FileTableNotLoaded(void) UT_SetDefaultReturnValue(UT_KEY(DS_TableVerifySize), true); /* Execute the function being tested */ - UtAssert_VOIDCALL(DS_SetDestSizeCmd(&UT_CmdBuf.Buf)); + UtAssert_VOIDCALL(DS_SetDestSizeCmd(&UT_CmdBuf.Buf)); /* Verify results */ UtAssert_UINT32_EQ(DS_AppData.CmdRejectedCounter, 1); @@ -1270,15 +1270,14 @@ void DS_CloseFileCmd_Test_InvalidFileTableIndex(void) void DS_CloseAllCmd_Test_Nominal(void) { uint32 i; + DS_AppData.EnableMoveFiles = DS_ENABLED; for (i = 1; i < DS_DEST_FILE_CNT; i++) { DS_AppData.FileStatus[i].FileHandle = OS_OBJECT_ID_UNDEFINED; } -#if (DS_MOVE_FILES == true) strncpy(DS_AppData.DestFileTblPtr->File[0].Movename, "", DS_PATHNAME_BUFSIZE); -#endif /* Execute the function being tested */ UtAssert_VOIDCALL(DS_CloseAllCmd(&UT_CmdBuf.Buf)); diff --git a/unit-test/ds_file_tests.c b/unit-test/ds_file_tests.c index baece77..a350d06 100644 --- a/unit-test/ds_file_tests.c +++ b/unit-test/ds_file_tests.c @@ -269,10 +269,9 @@ void DS_FileSetupWrite_Test_FileHandleClosed(void) DS_AppData.FileStatus[FileIndex].FileCount = 0; DS_AppData.FileStatus[FileIndex].FileSize = 3; - /* Fail writing the header so the data won't write */ - UT_SetDefaultReturnValue(UT_KEY(CFE_FS_WriteHeader), -1); + /* Fail creating the destination file so the file handle remains closed*/ + UT_SetDefaultReturnValue(UT_KEY(OS_OpenCreate), OS_ERROR); - /* Execute the function being tested */ UtAssert_VOIDCALL(DS_FileSetupWrite(FileIndex, &UT_CmdBuf.Buf)); /* Verify results */ @@ -283,8 +282,9 @@ void DS_FileSetupWrite_Test_FileHandleClosed(void) void DS_FileSetupWrite_Test_MaxFileSizeExceeded(void) { - int32 FileIndex = 0; - size_t forced_Size = sizeof(DS_NoopCmd_t); + int32 FileIndex = 0; + size_t forced_Size = sizeof(DS_NoopCmd_t); + DS_AppData.EnableMoveFiles = DS_ENABLED; UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &forced_Size, sizeof(forced_Size), false); @@ -297,11 +297,8 @@ void DS_FileSetupWrite_Test_MaxFileSizeExceeded(void) UT_DS_SetDestFileEntry(&DS_AppData.DestFileTblPtr->File[FileIndex]); strncpy(DS_AppData.FileStatus[FileIndex].FileName, "directory1/", sizeof(DS_AppData.FileStatus[FileIndex].FileName)); - -#if (DS_MOVE_FILES == true) strncpy(DS_AppData.DestFileTblPtr->File[FileIndex].Movename, "directory2/movename/", sizeof(DS_AppData.DestFileTblPtr->File[FileIndex].Movename)); -#endif /* Execute the function being tested */ UtAssert_VOIDCALL(DS_FileSetupWrite(FileIndex, &UT_CmdBuf.Buf)); @@ -364,7 +361,6 @@ void DS_FileWriteData_Test_Error(void) UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, DS_WRITE_FILE_ERR_EID); } -#if DS_FILE_HEADER_TYPE == DS_FILE_HEADER_CFE void DS_FileWriteHeader_Test_PlatformConfigCFE_Nominal(void) { int32 FileIndex = 0; @@ -381,9 +377,7 @@ void DS_FileWriteHeader_Test_PlatformConfigCFE_Nominal(void) UtAssert_UINT32_EQ(DS_AppData.FileStatus[FileIndex].FileSize, sizeof(CFE_FS_Header_t) + sizeof(DS_FileHeader_t)); UtAssert_UINT32_EQ(DS_AppData.FileStatus[FileIndex].FileGrowth, sizeof(CFE_FS_Header_t) + sizeof(DS_FileHeader_t)); } -#endif -#if DS_FILE_HEADER_TYPE == DS_FILE_HEADER_CFE void DS_FileWriteHeader_Test_PrimaryHeaderError(void) { int32 FileIndex = 0; @@ -403,9 +397,7 @@ void DS_FileWriteHeader_Test_PrimaryHeaderError(void) UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); /* Generates 1 event message we don't care about in this test */ } -#endif -#if DS_FILE_HEADER_TYPE == DS_FILE_HEADER_CFE void DS_FileWriteHeader_Test_SecondaryHeaderError(void) { int32 FileIndex = 0; @@ -427,9 +419,7 @@ void DS_FileWriteHeader_Test_SecondaryHeaderError(void) UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); /* Generates 1 event message we don't care about in this test */ } -#endif -#if DS_FILE_HEADER_TYPE == DS_FILE_HEADER_CFE void DS_FileWriteError_Test(void) { int32 FileIndex = 0; @@ -454,7 +444,6 @@ void DS_FileWriteError_Test(void) UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventType, CFE_EVS_EventType_ERROR); UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, DS_WRITE_FILE_ERR_EID); } -#endif void DS_FileCreateDest_Test_Nominal(void) { @@ -475,11 +464,14 @@ void DS_FileCreateDest_Test_Nominal(void) UtAssert_VOIDCALL(DS_FileCreateDest(FileIndex)); /* Verify results */ -#if DS_FILE_HEADER_TYPE == DS_FILE_HEADER_CFE - UtAssert_INT32_EQ(DS_AppData.FileWriteCounter, 3); -#else - UtAssert_INT32_EQ(DS_AppData.FileWriteCounter, 1); -#endif + if (DS_FILE_HEADER_TYPE == DS_FILE_HEADER_CFE) + { + UtAssert_INT32_EQ(DS_AppData.FileWriteCounter, 3); + } + else + { + UtAssert_INT32_EQ(DS_AppData.FileWriteCounter, 1); + } /* the file handle should have been reset and should not be closed */ UtAssert_BOOL_FALSE(OS_ObjectIdEqual(DS_AppData.FileStatus[FileIndex].FileHandle, DS_UT_OBJID_1)); @@ -510,7 +502,7 @@ void DS_FileCreateDest_Test_NominalRollover(void) strncpy(DS_AppData.FileStatus[FileIndex].FileName, "filename", sizeof(DS_AppData.FileStatus[FileIndex].FileName)); DS_AppData.FileStatus[FileIndex].FileCount = DS_MAX_SEQUENCE_COUNT; - DS_AppData.FileStatus[FileIndex].FileHandle = DS_UT_OBJID_1; + DS_AppData.FileStatus[FileIndex].FileHandle = OS_OBJECT_ID_UNDEFINED; /* Set to fail the condition "if (Result < 0)" */ UT_SetDefaultReturnValue(UT_KEY(OS_OpenCreate), OS_SUCCESS); @@ -521,11 +513,14 @@ void DS_FileCreateDest_Test_NominalRollover(void) UtAssert_VOIDCALL(DS_FileCreateDest(FileIndex)); /* Verify results */ -#if DS_FILE_HEADER_TYPE == DS_FILE_HEADER_CFE - UtAssert_INT32_EQ(DS_AppData.FileWriteCounter, 3); -#else - UtAssert_INT32_EQ(DS_AppData.FileWriteCounter, 1); -#endif + if (DS_FILE_HEADER_TYPE == DS_FILE_HEADER_CFE) + { + UtAssert_INT32_EQ(DS_AppData.FileWriteCounter, 3); + } + else + { + UtAssert_INT32_EQ(DS_AppData.FileWriteCounter, 1); + } /* the file handle should have been reset and should not be closed */ UtAssert_BOOL_FALSE(OS_ObjectIdEqual(DS_AppData.FileStatus[FileIndex].FileHandle, DS_UT_OBJID_1)); @@ -577,7 +572,10 @@ void DS_FileCreateDest_Test_ClosedFileHandle(void) DS_AppData.DestFileTblPtr->File[FileIndex].Movename[0] = '\0'; /* Set to fail header write, which will call OS_close and clear the handle */ - UT_SetDefaultReturnValue(UT_KEY(CFE_FS_WriteHeader), -1); + if (DS_FILE_HEADER_TYPE == DS_FILE_HEADER_CFE) + { + UT_SetDefaultReturnValue(UT_KEY(CFE_FS_WriteHeader), -1); + } /* Execute the function being tested */ UtAssert_VOIDCALL(DS_FileCreateDest(FileIndex)); @@ -782,7 +780,6 @@ void DS_FileCreateName_Test_ExtensionZero(void) UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); } -#if DS_FILE_HEADER_TYPE == DS_FILE_HEADER_CFE void DS_FileCreateSequence_Test_ByCount(void) { const uint32 Count = 1; @@ -802,9 +799,7 @@ void DS_FileCreateSequence_Test_ByCount(void) UtAssert_STRINGBUF_EQ(Sequence, sizeof(Sequence), StrCompare, sizeof(StrCompare)); UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); } -#endif -#if DS_FILE_HEADER_TYPE == DS_FILE_HEADER_CFE void DS_FileCreateSequence_Test_ByTime(void) { int32 FileIndex = 0; @@ -831,9 +826,7 @@ void DS_FileCreateSequence_Test_ByTime(void) UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); } -#endif -#if DS_FILE_HEADER_TYPE == DS_FILE_HEADER_CFE void DS_FileCreateSequence_Test_BadFilenameType(void) { int32 FileIndex = 0; @@ -853,9 +846,7 @@ void DS_FileCreateSequence_Test_BadFilenameType(void) UtAssert_UINT32_EQ(strncmp(Sequence, "", DS_TOTAL_FNAME_BUFSIZE), 0); UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); } -#endif -#if DS_FILE_HEADER_TYPE == DS_FILE_HEADER_CFE void DS_FileUpdateHeader_Test_PlatformConfigCFE_Nominal(void) { int32 FileIndex = 0; @@ -867,9 +858,7 @@ void DS_FileUpdateHeader_Test_PlatformConfigCFE_Nominal(void) UtAssert_UINT32_EQ(DS_AppData.FileUpdateCounter, 1); UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); } -#endif -#if DS_FILE_HEADER_TYPE == DS_FILE_HEADER_CFE void DS_FileUpdateHeader_Test_WriteError(void) { int32 FileIndex = 0; @@ -884,9 +873,7 @@ void DS_FileUpdateHeader_Test_WriteError(void) UtAssert_UINT32_EQ(DS_AppData.FileUpdateErrCounter, 1); UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); } -#endif -#if DS_FILE_HEADER_TYPE == DS_FILE_HEADER_CFE void DS_FileUpdateHeader_Test_PlatformConfigCFE_SeekError(void) { int32 FileIndex = 0; @@ -901,9 +888,7 @@ void DS_FileUpdateHeader_Test_PlatformConfigCFE_SeekError(void) UtAssert_UINT32_EQ(DS_AppData.FileUpdateErrCounter, 1); UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); } -#endif -#if (DS_MOVE_FILES == true) void DS_FileCloseDest_Test_PlatformConfigMoveFiles_Nominal(void) { int32 FileIndex = 0; @@ -915,6 +900,7 @@ void DS_FileCloseDest_Test_PlatformConfigMoveFiles_Nominal(void) sizeof(DS_AppData.FileStatus[FileIndex].FileName)); strncpy(DS_AppData.DestFileTblPtr->File[FileIndex].Movename, "directory2/movename/", sizeof(DS_AppData.DestFileTblPtr->File[FileIndex].Movename)); + DS_AppData.EnableMoveFiles = DS_ENABLED; /* Execute the function being tested */ UtAssert_VOIDCALL(DS_FileCloseDest(FileIndex)); @@ -926,9 +912,7 @@ void DS_FileCloseDest_Test_PlatformConfigMoveFiles_Nominal(void) UtAssert_UINT32_EQ(DS_AppData.FileStatus[FileIndex].FileName[0], 0); UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); } -#endif -#if (DS_MOVE_FILES == true) void DS_FileCloseDest_Test_PlatformConfigMoveFiles_MoveError(void) { int32 FileIndex = 0; @@ -940,6 +924,7 @@ void DS_FileCloseDest_Test_PlatformConfigMoveFiles_MoveError(void) sizeof(DS_AppData.FileStatus[FileIndex].FileName)); strncpy(DS_AppData.DestFileTblPtr->File[FileIndex].Movename, "directory2/movename/", sizeof(DS_AppData.DestFileTblPtr->File[FileIndex].Movename)); + DS_AppData.EnableMoveFiles = DS_ENABLED; /* Set to generate error message DS_MOVE_FILE_ERR_EID */ UT_SetDefaultReturnValue(UT_KEY(OS_mv), -1); @@ -954,23 +939,22 @@ void DS_FileCloseDest_Test_PlatformConfigMoveFiles_MoveError(void) UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventType, CFE_EVS_EventType_ERROR); UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); } -#endif -#if (DS_MOVE_FILES == true) void DS_FileCloseDest_Test_PlatformConfigMoveFiles_FilenameTooLarge(void) { - int32 FileIndex = 0; + int32 FileIndex = 0; const char DirName[] = "directory1/"; - + /* Set up the handle */ OS_OpenCreate(&DS_AppData.FileStatus[FileIndex].FileHandle, NULL, 0, 0); - + size_t DirNameLen = sizeof(DirName); strncpy(DS_AppData.FileStatus[FileIndex].FileName, DirName, DirNameLen); - memset(&DS_AppData.FileStatus[FileIndex].FileName[DirNameLen-1], 'f', DS_TOTAL_FNAME_BUFSIZE - DirNameLen); - DS_AppData.FileStatus[FileIndex].FileName[DS_TOTAL_FNAME_BUFSIZE-1] = '\0'; + memset(&DS_AppData.FileStatus[FileIndex].FileName[DirNameLen - 1], 'f', DS_TOTAL_FNAME_BUFSIZE - DirNameLen); + DS_AppData.FileStatus[FileIndex].FileName[DS_TOTAL_FNAME_BUFSIZE - 1] = '\0'; strncpy(DS_AppData.DestFileTblPtr->File[FileIndex].Movename, "directory2/movename/", sizeof(DS_AppData.DestFileTblPtr->File[FileIndex].Movename)); + DS_AppData.EnableMoveFiles = DS_ENABLED; /* Execute the function being tested */ UtAssert_VOIDCALL(DS_FileCloseDest(FileIndex)); @@ -982,9 +966,7 @@ void DS_FileCloseDest_Test_PlatformConfigMoveFiles_FilenameTooLarge(void) UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventType, CFE_EVS_EventType_ERROR); UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); } -#endif -#if (DS_MOVE_FILES == true) void DS_FileCloseDest_Test_PlatformConfigMoveFiles_FilenameNull(void) { int32 FileIndex = 0; @@ -994,6 +976,7 @@ void DS_FileCloseDest_Test_PlatformConfigMoveFiles_FilenameNull(void) strncpy(DS_AppData.DestFileTblPtr->File[FileIndex].Movename, "directory2/movename", sizeof(DS_AppData.DestFileTblPtr->File[FileIndex].Movename)); + DS_AppData.EnableMoveFiles = DS_ENABLED; /* Execute the function being tested */ UtAssert_VOIDCALL(DS_FileCloseDest(FileIndex)); @@ -1007,27 +990,43 @@ void DS_FileCloseDest_Test_PlatformConfigMoveFiles_FilenameNull(void) UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventType, CFE_EVS_EventType_ERROR); UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); } -#endif -#if (DS_MOVE_FILES == false) -void DS_FileCloseDest_Test_MoveFilesFalse(void) +void DS_FileCloseDest_Test_PlatformConfigMoveFiles_MovenameNull(void) { int32 FileIndex = 0; /* Set up the handle */ OS_OpenCreate(&DS_AppData.FileStatus[FileIndex].FileHandle, NULL, 0, 0); + strncpy(DS_AppData.DestFileTblPtr->File[FileIndex].Movename, "", + sizeof(DS_AppData.DestFileTblPtr->File[FileIndex].Movename)); + DS_AppData.EnableMoveFiles = DS_ENABLED; + /* Execute the function being tested */ UtAssert_VOIDCALL(DS_FileCloseDest(FileIndex)); /* Verify results */ - UtAssert_UINT32_EQ(DS_AppData.FileStatus[FileIndex].FileHandle, OS_OBJECT_ID_UNDEFINED); + UtAssert_STUB_COUNT(CFE_SB_MessageStringGet, 0); +} + +void DS_FileCloseDest_Test_PlatformConfigMoveFiles_DisableMoveFiles(void) +{ + int32 FileIndex = 0; + + /* Set up the handle */ + OS_OpenCreate(&DS_AppData.FileStatus[FileIndex].FileHandle, NULL, 0, 0); + DS_AppData.EnableMoveFiles = DS_DISABLED; + + /* Execute the function being tested */ + UtAssert_VOIDCALL(DS_FileCloseDest(FileIndex)); + + /* Verify results */ + UtAssert_BOOL_FALSE(OS_ObjectIdDefined(DS_AppData.FileStatus[FileIndex].FileHandle)); UtAssert_UINT32_EQ(DS_AppData.FileStatus[FileIndex].FileAge, 0); UtAssert_UINT32_EQ(DS_AppData.FileStatus[FileIndex].FileSize, 0); UtAssert_UINT32_EQ(DS_AppData.FileStatus[FileIndex].FileName[0], 0); UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); } -#endif void DS_FileTestAge_Test_Nominal(void) { @@ -1283,24 +1282,24 @@ void UtTest_Setup(void) UT_DS_TEST_ADD(DS_FileWriteData_Test_Nominal); UT_DS_TEST_ADD(DS_FileWriteData_Test_Error); -#if DS_FILE_HEADER_TYPE == DS_FILE_HEADER_CFE - UT_DS_TEST_ADD(DS_FileWriteHeader_Test_PlatformConfigCFE_Nominal); - UT_DS_TEST_ADD(DS_FileWriteHeader_Test_PrimaryHeaderError); - UT_DS_TEST_ADD(DS_FileWriteHeader_Test_SecondaryHeaderError); -#endif + if (DS_FILE_HEADER_TYPE == DS_FILE_HEADER_CFE) + { + UT_DS_TEST_ADD(DS_FileWriteHeader_Test_PlatformConfigCFE_Nominal); + UT_DS_TEST_ADD(DS_FileWriteHeader_Test_PrimaryHeaderError); + UT_DS_TEST_ADD(DS_FileWriteHeader_Test_SecondaryHeaderError); + } -#if DS_FILE_HEADER_TYPE == DS_FILE_HEADER_CFE - UT_DS_TEST_ADD(DS_FileWriteError_Test); -#endif + if (DS_FILE_HEADER_TYPE == DS_FILE_HEADER_CFE) + { + UT_DS_TEST_ADD(DS_FileWriteError_Test); + } UT_DS_TEST_ADD(DS_FileCreateDest_Test_Nominal); UT_DS_TEST_ADD(DS_FileCreateDest_Test_StringTerminate); UT_DS_TEST_ADD(DS_FileCreateDest_Test_NominalRollover); UT_DS_TEST_ADD(DS_FileCreateDest_Test_Error); -#if DS_FILE_HEADER_TYPE == DS_FILE_HEADER_CFE UT_DS_TEST_ADD(DS_FileCreateDest_Test_ClosedFileHandle); -#endif UT_DS_TEST_ADD(DS_FileCreateName_Test_Nominal); UT_DS_TEST_ADD(DS_FileCreateName_Test_NominalWithSeparator); @@ -1311,26 +1310,23 @@ void UtTest_Setup(void) UT_DS_TEST_ADD(DS_FileCreateName_Test_PathBaseSeqExtTooLarge); UT_DS_TEST_ADD(DS_FileCreateName_Test_ExtensionZero); -#if DS_FILE_HEADER_TYPE == DS_FILE_HEADER_CFE UT_DS_TEST_ADD(DS_FileCreateSequence_Test_ByCount); UT_DS_TEST_ADD(DS_FileCreateSequence_Test_ByTime); UT_DS_TEST_ADD(DS_FileCreateSequence_Test_BadFilenameType); -#endif -#if DS_FILE_HEADER_TYPE == DS_FILE_HEADER_CFE - UT_DS_TEST_ADD(DS_FileUpdateHeader_Test_PlatformConfigCFE_Nominal); - UT_DS_TEST_ADD(DS_FileUpdateHeader_Test_WriteError); - UT_DS_TEST_ADD(DS_FileUpdateHeader_Test_PlatformConfigCFE_SeekError); -#endif + if (DS_FILE_HEADER_TYPE == DS_FILE_HEADER_CFE) + { + UT_DS_TEST_ADD(DS_FileUpdateHeader_Test_PlatformConfigCFE_Nominal); + UT_DS_TEST_ADD(DS_FileUpdateHeader_Test_WriteError); + UT_DS_TEST_ADD(DS_FileUpdateHeader_Test_PlatformConfigCFE_SeekError); + } -#if (DS_MOVE_FILES == true) UT_DS_TEST_ADD(DS_FileCloseDest_Test_PlatformConfigMoveFiles_Nominal); UT_DS_TEST_ADD(DS_FileCloseDest_Test_PlatformConfigMoveFiles_MoveError); UT_DS_TEST_ADD(DS_FileCloseDest_Test_PlatformConfigMoveFiles_FilenameTooLarge); UT_DS_TEST_ADD(DS_FileCloseDest_Test_PlatformConfigMoveFiles_FilenameNull); -#else - UT_DS_TEST_ADD(DS_FileCloseDest_Test_MoveFilesFalse); -#endif + UT_DS_TEST_ADD(DS_FileCloseDest_Test_PlatformConfigMoveFiles_MovenameNull); + UT_DS_TEST_ADD(DS_FileCloseDest_Test_PlatformConfigMoveFiles_DisableMoveFiles); UT_DS_TEST_ADD(DS_FileTestAge_Test_Nominal); UT_DS_TEST_ADD(DS_FileTestAge_Test_ExceedMaxAge); diff --git a/unit-test/ds_table_tests.c b/unit-test/ds_table_tests.c index 7b58da5..f0eee13 100644 --- a/unit-test/ds_table_tests.c +++ b/unit-test/ds_table_tests.c @@ -1394,10 +1394,11 @@ void DS_TableCreateCDS_Test_PreExistingCDSArea(void) UtAssert_UINT32_EQ(DS_AppData.FileStatus[DS_DEST_FILE_CNT / 2].FileCount, 0); UtAssert_UINT32_EQ(DS_AppData.FileStatus[DS_DEST_FILE_CNT - 1].FileCount, 0); -#if (DS_CDS_ENABLE_STATE == 1) - /* only test if configured */ - UtAssert_UINT32_EQ(DS_AppData.AppEnableState, 0); -#endif + if (DS_CDS_ENABLE_STATE == 1) + { + /* only test if configured */ + UtAssert_UINT32_EQ(DS_AppData.AppEnableState, 0); + } UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); } From a5f1a8e68a0b60c4780979497a3a66ba918794e1 Mon Sep 17 00:00:00 2001 From: jdfiguer Date: Mon, 10 Jun 2024 08:30:07 -0400 Subject: [PATCH 8/9] Fix #127, Adds static analysis comments and replaces strncpy with snprintf This commit addresses issues flagged during static analysis by: - Adding JSC 2.1 disposition comments. - Replacing strncpy with snprintf to enhance safety and compliance. - Changes DS_TABLE_VERIFY_ERR from 0xFFFFFFFF to -1 --- fsw/src/ds_app.c | 3 +-- fsw/src/ds_appdefs.h | 2 +- fsw/src/ds_cmds.c | 2 +- fsw/src/ds_file.c | 4 ++-- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/fsw/src/ds_app.c b/fsw/src/ds_app.c index 9bd982b..4807f91 100644 --- a/fsw/src/ds_app.c +++ b/fsw/src/ds_app.c @@ -358,8 +358,7 @@ void DS_AppSendHkCmd(void) Status = CFE_TBL_GetInfo(&FilterTblInfo, FilterTblName); if (Status == CFE_SUCCESS) { - strncpy(PayloadPtr->FilterTblFilename, FilterTblInfo.LastFileLoaded, OS_MAX_PATH_LEN - 1); - PayloadPtr->FilterTblFilename[OS_MAX_PATH_LEN - 1] = '\0'; + snprintf(PayloadPtr->FilterTblFilename, OS_MAX_PATH_LEN, "%s", FilterTblInfo.LastFileLoaded); } else { diff --git a/fsw/src/ds_appdefs.h b/fsw/src/ds_appdefs.h index 01d950a..1b071c0 100644 --- a/fsw/src/ds_appdefs.h +++ b/fsw/src/ds_appdefs.h @@ -43,7 +43,7 @@ #define DS_PATH_SEPARATOR '/' /**< \brief File system path separator */ -#define DS_TABLE_VERIFY_ERR 0xFFFFFFFF /**< \brief Table verification error return value */ +#define DS_TABLE_VERIFY_ERR -1 /**< \brief Table verification error return value */ #define DS_FILE_HEADER_NONE 0 /**< \brief File header type is NONE */ #define DS_FILE_HEADER_CFE 1 /**< \brief File header type is CFE */ diff --git a/fsw/src/ds_cmds.c b/fsw/src/ds_cmds.c index 581f034..2efc26f 100644 --- a/fsw/src/ds_cmds.c +++ b/fsw/src/ds_cmds.c @@ -1096,7 +1096,7 @@ void DS_GetFileInfoCmd(const CFE_SB_Buffer_t *BufPtr) /* ** Set current open filename... */ - strncpy(FileInfoPtr->FileName, DS_AppData.FileStatus[i].FileName, sizeof(FileInfoPtr->FileName)); + snprintf(FileInfoPtr->FileName, sizeof(FileInfoPtr->FileName), "%s", DS_AppData.FileStatus[i].FileName); } } diff --git a/fsw/src/ds_file.c b/fsw/src/ds_file.c index fb9f31c..f302685 100644 --- a/fsw/src/ds_file.c +++ b/fsw/src/ds_file.c @@ -881,7 +881,7 @@ void DS_FileCloseDest(int32 FileIndex) } /* Update the path name for reporting */ - strncpy(FileStatus->FileName, PathName, sizeof(FileStatus->FileName)); + snprintf(FileStatus->FileName, sizeof(FileStatus->FileName), "%s", PathName); } } @@ -991,7 +991,7 @@ void DS_FileTransmit(DS_AppFileStatus_t *FileStatus) /* ** Set current open filename... */ - strncpy(FileInfo->FileName, FileStatus->FileName, sizeof(FileInfo->FileName)); + snprintf(FileInfo->FileName, sizeof(FileInfo->FileName), "%s", FileStatus->FileName); /* ** Timestamp and send file info telemetry... From 1427a22cf1e419cf212193e65f6269a97d43040b Mon Sep 17 00:00:00 2001 From: "Lucas, John P." Date: Tue, 23 Jul 2024 09:04:09 -0400 Subject: [PATCH 9/9] [nasa/nos3#176] Change from bools to int32 across the entire application; --- fsw/src/ds_dispatch.c | 2 +- fsw/src/ds_file.c | 10 +++--- fsw/src/ds_file.h | 2 +- fsw/src/ds_table.c | 44 +++++++++++------------ fsw/src/ds_table.h | 20 +++++------ unit-test/stubs/ds_file_stubs.c | 6 ++-- unit-test/stubs/ds_table_stubs.c | 60 ++++++++++++++++---------------- unit-test/stubs/stub_basetypes.h | 1 - 8 files changed, 72 insertions(+), 73 deletions(-) diff --git a/fsw/src/ds_dispatch.c b/fsw/src/ds_dispatch.c index c264caf..ed5cd01 100644 --- a/fsw/src/ds_dispatch.c +++ b/fsw/src/ds_dispatch.c @@ -77,7 +77,7 @@ #include -bool DS_VerifyLength(const CFE_SB_Buffer_t *BufPtr, size_t ExpectedLength, uint16 FailEventID, const char *CommandName) +int32 DS_VerifyLength(const CFE_SB_Buffer_t *BufPtr, size_t ExpectedLength, uint16 FailEventID, const char *CommandName) { size_t ActualLength = 0; diff --git a/fsw/src/ds_file.c b/fsw/src/ds_file.c index f302685..fa923ce 100644 --- a/fsw/src/ds_file.c +++ b/fsw/src/ds_file.c @@ -53,7 +53,7 @@ /* Apply common filter algorithm to Software Bus packet */ /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -bool DS_IsPacketFiltered(CFE_MSG_Message_t *MessagePtr, uint16 FilterType, uint16 Algorithm_N, uint16 Algorithm_X, +int32 DS_IsPacketFiltered(CFE_MSG_Message_t *MessagePtr, uint16 FilterType, uint16 Algorithm_N, uint16 Algorithm_X, uint16 Algorithm_O) { /* @@ -61,7 +61,7 @@ bool DS_IsPacketFiltered(CFE_MSG_Message_t *MessagePtr, uint16 FilterType, uint1 ** Algorithm_X = out of every group of this many packets ** Algorithm_O = starting at this offset within the group */ - bool PacketIsFiltered = false; + int32 PacketIsFiltered = false; CFE_TIME_SysTime_t PacketTime; uint16 PacketValue; uint16 Seconds; @@ -188,8 +188,8 @@ void DS_FileStorePacket(CFE_SB_MsgId_t MessageID, const CFE_SB_Buffer_t *BufPtr) { DS_PacketEntry_t *PacketEntry = NULL; DS_FilterParms_t *FilterParms = NULL; - bool PassedFilter = false; - bool FilterResult = false; + int32 PassedFilter = false; + int32 FilterResult = false; int32 FilterIndex = 0; int32 FileIndex = 0; int32 i = 0; @@ -271,7 +271,7 @@ void DS_FileSetupWrite(int32 FileIndex, const CFE_SB_Buffer_t *BufPtr) { DS_DestFileEntry_t *DestFile = &DS_AppData.DestFileTblPtr->File[FileIndex]; DS_AppFileStatus_t *FileStatus = &DS_AppData.FileStatus[FileIndex]; - bool OpenNewFile = false; + int32 OpenNewFile = false; size_t PacketLength = 0; /* diff --git a/fsw/src/ds_file.h b/fsw/src/ds_file.h index c92e102..53f8d9e 100644 --- a/fsw/src/ds_file.h +++ b/fsw/src/ds_file.h @@ -322,7 +322,7 @@ void DS_FileTransmit(DS_AppFileStatus_t *FileStatus); * \retval true The packet should be filtered (not used) * \retval false The packet should not be filtered (used) */ -bool DS_IsPacketFiltered(CFE_MSG_Message_t *MessagePtr, uint16 FilterType, uint16 Algorithm_N, uint16 Algorithm_X, +int32 DS_IsPacketFiltered(CFE_MSG_Message_t *MessagePtr, uint16 FilterType, uint16 Algorithm_N, uint16 Algorithm_X, uint16 Algorithm_O); #endif diff --git a/fsw/src/ds_table.c b/fsw/src/ds_table.c index 9643e9b..0015d1d 100644 --- a/fsw/src/ds_table.c +++ b/fsw/src/ds_table.c @@ -48,8 +48,8 @@ CFE_Status_t DS_TableInit(void) { CFE_Status_t Result1; CFE_Status_t Result2; - bool NeedToLoadDestTable = false; - bool NeedToLoadFilterTable = false; + int32 NeedToLoadDestTable = false; + int32 NeedToLoadFilterTable = false; uint16 TableRegisterFlags = CFE_TBL_OPT_SNGL_BUFFER | CFE_TBL_OPT_LOAD_DUMP; if (DS_MAKE_TABLES_CRITICAL == 1) @@ -441,10 +441,10 @@ CFE_Status_t DS_TableVerifyDestFile(const void *TableData) /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -bool DS_TableVerifyDestFileEntry(DS_DestFileEntry_t *DestFileEntry, uint8 TableIndex, int32 ErrorCount) +int32 DS_TableVerifyDestFileEntry(DS_DestFileEntry_t *DestFileEntry, uint8 TableIndex, int32 ErrorCount) { const char *CommonErrorText = "Destination file table verify err:"; - bool Result = true; + int32 Result = true; /* ** Perform the following "per table entry" validation: @@ -563,11 +563,11 @@ CFE_Status_t DS_TableVerifyFilter(const void *TableData) /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -bool DS_TableVerifyFilterEntry(DS_PacketEntry_t *PacketEntry, int32 TableIndex, int32 ErrorCount) +int32 DS_TableVerifyFilterEntry(DS_PacketEntry_t *PacketEntry, int32 TableIndex, int32 ErrorCount) { const char * CommonErrorText = "Filter table verify err:"; DS_FilterParms_t *FilterParms; - bool Result = true; + int32 Result = true; int32 i = 0; /* @@ -640,10 +640,10 @@ bool DS_TableVerifyFilterEntry(DS_PacketEntry_t *PacketEntry, int32 TableIndex, /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -bool DS_TableEntryUnused(const void *TableEntry, int32 BufferSize) +int32 DS_TableEntryUnused(const void *TableEntry, int32 BufferSize) { const char *Buffer = (char *)TableEntry; - bool Result = true; + int32 Result = true; int32 i = 0; for (i = 0; i < BufferSize; i++) @@ -664,9 +664,9 @@ bool DS_TableEntryUnused(const void *TableEntry, int32 BufferSize) /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -bool DS_TableVerifyFileIndex(uint16 FileTableIndex) +int32 DS_TableVerifyFileIndex(uint16 FileTableIndex) { - bool Result = true; + int32 Result = true; if (FileTableIndex >= DS_DEST_FILE_CNT) { @@ -682,9 +682,9 @@ bool DS_TableVerifyFileIndex(uint16 FileTableIndex) /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -bool DS_TableVerifyParms(uint16 Algorithm_N, uint16 Algorithm_X, uint16 Algorithm_O) +int32 DS_TableVerifyParms(uint16 Algorithm_N, uint16 Algorithm_X, uint16 Algorithm_O) { - bool Result = true; + int32 Result = true; /* ** Unused entries (all zero's) are valid @@ -716,9 +716,9 @@ bool DS_TableVerifyParms(uint16 Algorithm_N, uint16 Algorithm_X, uint16 Algorith /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -bool DS_TableVerifyType(uint16 TimeVsCount) +int32 DS_TableVerifyType(uint16 TimeVsCount) { - bool Result = true; + int32 Result = true; if ((TimeVsCount != DS_BY_COUNT) && (TimeVsCount != DS_BY_TIME)) { @@ -734,9 +734,9 @@ bool DS_TableVerifyType(uint16 TimeVsCount) /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -bool DS_TableVerifyState(uint16 EnableState) +int32 DS_TableVerifyState(uint16 EnableState) { - bool Result = true; + int32 Result = true; if ((EnableState != DS_ENABLED) && (EnableState != DS_DISABLED)) { @@ -752,9 +752,9 @@ bool DS_TableVerifyState(uint16 EnableState) /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -bool DS_TableVerifySize(uint32 MaxFileSize) +int32 DS_TableVerifySize(uint32 MaxFileSize) { - bool Result = true; + int32 Result = true; if (MaxFileSize < DS_FILE_MIN_SIZE_LIMIT) { @@ -770,9 +770,9 @@ bool DS_TableVerifySize(uint32 MaxFileSize) /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -bool DS_TableVerifyAge(uint32 MaxFileAge) +int32 DS_TableVerifyAge(uint32 MaxFileAge) { - bool Result = true; + int32 Result = true; if (MaxFileAge < DS_FILE_MIN_AGE_LIMIT) { @@ -788,9 +788,9 @@ bool DS_TableVerifyAge(uint32 MaxFileAge) /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -bool DS_TableVerifyCount(uint32 SequenceCount) +int32 DS_TableVerifyCount(uint32 SequenceCount) { - bool Result = true; + int32 Result = true; if (SequenceCount > DS_MAX_SEQUENCE_COUNT) { diff --git a/fsw/src/ds_table.h b/fsw/src/ds_table.h index ac12f02..42137a9 100644 --- a/fsw/src/ds_table.h +++ b/fsw/src/ds_table.h @@ -162,7 +162,7 @@ CFE_Status_t DS_TableVerifyDestFile(const void *TableData); * * \sa #DS_DestFileEntry_t, #DS_TableVerifyDestFile */ -bool DS_TableVerifyDestFileEntry(DS_DestFileEntry_t *DestFileEntry, uint8 TableIndex, int32 ErrorCount); +int32 DS_TableVerifyDestFileEntry(DS_DestFileEntry_t *DestFileEntry, uint8 TableIndex, int32 ErrorCount); /** * \brief Verify packet filter table data @@ -208,7 +208,7 @@ CFE_Status_t DS_TableVerifyFilter(const void *TableData); * * \sa #DS_PacketEntry_t, #DS_FilterParms_t, #DS_TableVerifyFilter */ -bool DS_TableVerifyFilterEntry(DS_PacketEntry_t *PacketEntry, int32 TableIndex, int32 ErrorCount); +int32 DS_TableVerifyFilterEntry(DS_PacketEntry_t *PacketEntry, int32 TableIndex, int32 ErrorCount); /** * \brief Test for unused table entry @@ -229,7 +229,7 @@ bool DS_TableVerifyFilterEntry(DS_PacketEntry_t *PacketEntry, int32 TableIndex, * * \sa #DS_PacketEntry_t, #DS_FilterParms_t, #DS_DestFileEntry_t */ -bool DS_TableEntryUnused(const void *TableEntry, int32 BufferSize); +int32 DS_TableEntryUnused(const void *TableEntry, int32 BufferSize); /** * \brief Verify destination file index @@ -262,7 +262,7 @@ bool DS_TableEntryUnused(const void *TableEntry, int32 BufferSize); * * \sa #DS_PacketEntry_t, #DS_FilterParms_t, #DS_DestFileEntry_t */ -bool DS_TableVerifyFileIndex(uint16 FileTableIndex); +int32 DS_TableVerifyFileIndex(uint16 FileTableIndex); /** * \brief Verify packet filter parameters @@ -286,7 +286,7 @@ bool DS_TableVerifyFileIndex(uint16 FileTableIndex); * * \sa #DS_TableVerifyType, #DS_TableVerifyState, #DS_DestFileEntry_t */ -bool DS_TableVerifyParms(uint16 Algorithm_N, uint16 Algorithm_X, uint16 Algorithm_O); +int32 DS_TableVerifyParms(uint16 Algorithm_N, uint16 Algorithm_X, uint16 Algorithm_O); /** * \brief Verify packet filter type or filename type @@ -311,7 +311,7 @@ bool DS_TableVerifyParms(uint16 Algorithm_N, uint16 Algorithm_X, uint16 Algorith * * \sa #DS_TableVerifyState, #DS_TableVerifySize, #DS_DestFileEntry_t */ -bool DS_TableVerifyType(uint16 TimeVsCount); +int32 DS_TableVerifyType(uint16 TimeVsCount); /** * \brief Verify application or destination file enable/disable state @@ -333,7 +333,7 @@ bool DS_TableVerifyType(uint16 TimeVsCount); * * \sa #DS_TableVerifySize, #DS_TableVerifyAge, #DS_DestFileEntry_t */ -bool DS_TableVerifyState(uint16 EnableState); +int32 DS_TableVerifyState(uint16 EnableState); /** * \brief Verify destination file max size limit @@ -354,7 +354,7 @@ bool DS_TableVerifyState(uint16 EnableState); * * \sa #DS_TableVerifyAge, #DS_TableVerifyCount, #DS_DestFileEntry_t */ -bool DS_TableVerifySize(uint32 MaxFileSize); +int32 DS_TableVerifySize(uint32 MaxFileSize); /** * \brief Verify destination file max age limit @@ -375,7 +375,7 @@ bool DS_TableVerifySize(uint32 MaxFileSize); * * \sa #DS_TableVerifySize, #DS_TableVerifyCount, #DS_DestFileEntry_t */ -bool DS_TableVerifyAge(uint32 MaxFileAge); +int32 DS_TableVerifyAge(uint32 MaxFileAge); /** * \brief Verify destination file sequence count @@ -396,7 +396,7 @@ bool DS_TableVerifyAge(uint32 MaxFileAge); * * \sa #DS_TableVerifySize, #DS_TableVerifyAge, #DS_DestFileEntry_t */ -bool DS_TableVerifyCount(uint32 SequenceCount); +int32 DS_TableVerifyCount(uint32 SequenceCount); /** * \brief Subscribe to packet filter table packets diff --git a/unit-test/stubs/ds_file_stubs.c b/unit-test/stubs/ds_file_stubs.c index 4b47a64..88a5332 100644 --- a/unit-test/stubs/ds_file_stubs.c +++ b/unit-test/stubs/ds_file_stubs.c @@ -183,10 +183,10 @@ void DS_FileWriteHeader(int32 FileIndex) * Generated stub function for DS_IsPacketFiltered() * ---------------------------------------------------- */ -bool DS_IsPacketFiltered(CFE_MSG_Message_t *MessagePtr, uint16 FilterType, uint16 Algorithm_N, uint16 Algorithm_X, +int32 DS_IsPacketFiltered(CFE_MSG_Message_t *MessagePtr, uint16 FilterType, uint16 Algorithm_N, uint16 Algorithm_X, uint16 Algorithm_O) { - UT_GenStub_SetupReturnBuffer(DS_IsPacketFiltered, bool); + UT_GenStub_SetupReturnBuffer(DS_IsPacketFiltered, int32); UT_GenStub_AddParam(DS_IsPacketFiltered, CFE_MSG_Message_t *, MessagePtr); UT_GenStub_AddParam(DS_IsPacketFiltered, uint16, FilterType); @@ -196,5 +196,5 @@ bool DS_IsPacketFiltered(CFE_MSG_Message_t *MessagePtr, uint16 FilterType, uint1 UT_GenStub_Execute(DS_IsPacketFiltered, Basic, NULL); - return UT_GenStub_GetReturnValue(DS_IsPacketFiltered, bool); + return UT_GenStub_GetReturnValue(DS_IsPacketFiltered, int32); } diff --git a/unit-test/stubs/ds_table_stubs.c b/unit-test/stubs/ds_table_stubs.c index 2e06e5a..fb90c74 100644 --- a/unit-test/stubs/ds_table_stubs.c +++ b/unit-test/stubs/ds_table_stubs.c @@ -73,16 +73,16 @@ void DS_TableCreateHash(void) * Generated stub function for DS_TableEntryUnused() * ---------------------------------------------------- */ -bool DS_TableEntryUnused(const void *TableEntry, int32 BufferSize) +int32 DS_TableEntryUnused(const void *TableEntry, int32 BufferSize) { - UT_GenStub_SetupReturnBuffer(DS_TableEntryUnused, bool); + UT_GenStub_SetupReturnBuffer(DS_TableEntryUnused, int32); UT_GenStub_AddParam(DS_TableEntryUnused, const void *, TableEntry); UT_GenStub_AddParam(DS_TableEntryUnused, int32, BufferSize); UT_GenStub_Execute(DS_TableEntryUnused, Basic, NULL); - return UT_GenStub_GetReturnValue(DS_TableEntryUnused, bool); + return UT_GenStub_GetReturnValue(DS_TableEntryUnused, int32); } /* @@ -191,15 +191,15 @@ void DS_TableUpdateCDS(void) * Generated stub function for DS_TableVerifyAge() * ---------------------------------------------------- */ -bool DS_TableVerifyAge(uint32 MaxFileAge) +int32 DS_TableVerifyAge(uint32 MaxFileAge) { - UT_GenStub_SetupReturnBuffer(DS_TableVerifyAge, bool); + UT_GenStub_SetupReturnBuffer(DS_TableVerifyAge, int32); UT_GenStub_AddParam(DS_TableVerifyAge, uint32, MaxFileAge); UT_GenStub_Execute(DS_TableVerifyAge, Basic, NULL); - return UT_GenStub_GetReturnValue(DS_TableVerifyAge, bool); + return UT_GenStub_GetReturnValue(DS_TableVerifyAge, int32); } /* @@ -207,15 +207,15 @@ bool DS_TableVerifyAge(uint32 MaxFileAge) * Generated stub function for DS_TableVerifyCount() * ---------------------------------------------------- */ -bool DS_TableVerifyCount(uint32 SequenceCount) +int32 DS_TableVerifyCount(uint32 SequenceCount) { - UT_GenStub_SetupReturnBuffer(DS_TableVerifyCount, bool); + UT_GenStub_SetupReturnBuffer(DS_TableVerifyCount, int32); UT_GenStub_AddParam(DS_TableVerifyCount, uint32, SequenceCount); UT_GenStub_Execute(DS_TableVerifyCount, Basic, NULL); - return UT_GenStub_GetReturnValue(DS_TableVerifyCount, bool); + return UT_GenStub_GetReturnValue(DS_TableVerifyCount, int32); } /* @@ -239,9 +239,9 @@ CFE_Status_t DS_TableVerifyDestFile(const void *TableData) * Generated stub function for DS_TableVerifyDestFileEntry() * ---------------------------------------------------- */ -bool DS_TableVerifyDestFileEntry(DS_DestFileEntry_t *DestFileEntry, uint8 TableIndex, int32 ErrorCount) +int32 DS_TableVerifyDestFileEntry(DS_DestFileEntry_t *DestFileEntry, uint8 TableIndex, int32 ErrorCount) { - UT_GenStub_SetupReturnBuffer(DS_TableVerifyDestFileEntry, bool); + UT_GenStub_SetupReturnBuffer(DS_TableVerifyDestFileEntry, int32); UT_GenStub_AddParam(DS_TableVerifyDestFileEntry, DS_DestFileEntry_t *, DestFileEntry); UT_GenStub_AddParam(DS_TableVerifyDestFileEntry, uint8, TableIndex); @@ -249,7 +249,7 @@ bool DS_TableVerifyDestFileEntry(DS_DestFileEntry_t *DestFileEntry, uint8 TableI UT_GenStub_Execute(DS_TableVerifyDestFileEntry, Basic, NULL); - return UT_GenStub_GetReturnValue(DS_TableVerifyDestFileEntry, bool); + return UT_GenStub_GetReturnValue(DS_TableVerifyDestFileEntry, int32); } /* @@ -257,15 +257,15 @@ bool DS_TableVerifyDestFileEntry(DS_DestFileEntry_t *DestFileEntry, uint8 TableI * Generated stub function for DS_TableVerifyFileIndex() * ---------------------------------------------------- */ -bool DS_TableVerifyFileIndex(uint16 FileTableIndex) +int32 DS_TableVerifyFileIndex(uint16 FileTableIndex) { - UT_GenStub_SetupReturnBuffer(DS_TableVerifyFileIndex, bool); + UT_GenStub_SetupReturnBuffer(DS_TableVerifyFileIndex, int32); UT_GenStub_AddParam(DS_TableVerifyFileIndex, uint16, FileTableIndex); UT_GenStub_Execute(DS_TableVerifyFileIndex, Basic, NULL); - return UT_GenStub_GetReturnValue(DS_TableVerifyFileIndex, bool); + return UT_GenStub_GetReturnValue(DS_TableVerifyFileIndex, int32); } /* @@ -289,9 +289,9 @@ CFE_Status_t DS_TableVerifyFilter(const void *TableData) * Generated stub function for DS_TableVerifyFilterEntry() * ---------------------------------------------------- */ -bool DS_TableVerifyFilterEntry(DS_PacketEntry_t *PacketEntry, int32 TableIndex, int32 ErrorCount) +int32 DS_TableVerifyFilterEntry(DS_PacketEntry_t *PacketEntry, int32 TableIndex, int32 ErrorCount) { - UT_GenStub_SetupReturnBuffer(DS_TableVerifyFilterEntry, bool); + UT_GenStub_SetupReturnBuffer(DS_TableVerifyFilterEntry, int32); UT_GenStub_AddParam(DS_TableVerifyFilterEntry, DS_PacketEntry_t *, PacketEntry); UT_GenStub_AddParam(DS_TableVerifyFilterEntry, int32, TableIndex); @@ -299,7 +299,7 @@ bool DS_TableVerifyFilterEntry(DS_PacketEntry_t *PacketEntry, int32 TableIndex, UT_GenStub_Execute(DS_TableVerifyFilterEntry, Basic, NULL); - return UT_GenStub_GetReturnValue(DS_TableVerifyFilterEntry, bool); + return UT_GenStub_GetReturnValue(DS_TableVerifyFilterEntry, int32); } /* @@ -307,9 +307,9 @@ bool DS_TableVerifyFilterEntry(DS_PacketEntry_t *PacketEntry, int32 TableIndex, * Generated stub function for DS_TableVerifyParms() * ---------------------------------------------------- */ -bool DS_TableVerifyParms(uint16 Algorithm_N, uint16 Algorithm_X, uint16 Algorithm_O) +int32 DS_TableVerifyParms(uint16 Algorithm_N, uint16 Algorithm_X, uint16 Algorithm_O) { - UT_GenStub_SetupReturnBuffer(DS_TableVerifyParms, bool); + UT_GenStub_SetupReturnBuffer(DS_TableVerifyParms, int32); UT_GenStub_AddParam(DS_TableVerifyParms, uint16, Algorithm_N); UT_GenStub_AddParam(DS_TableVerifyParms, uint16, Algorithm_X); @@ -317,7 +317,7 @@ bool DS_TableVerifyParms(uint16 Algorithm_N, uint16 Algorithm_X, uint16 Algorith UT_GenStub_Execute(DS_TableVerifyParms, Basic, NULL); - return UT_GenStub_GetReturnValue(DS_TableVerifyParms, bool); + return UT_GenStub_GetReturnValue(DS_TableVerifyParms, int32); } /* @@ -325,15 +325,15 @@ bool DS_TableVerifyParms(uint16 Algorithm_N, uint16 Algorithm_X, uint16 Algorith * Generated stub function for DS_TableVerifySize() * ---------------------------------------------------- */ -bool DS_TableVerifySize(uint32 MaxFileSize) +int32 DS_TableVerifySize(uint32 MaxFileSize) { - UT_GenStub_SetupReturnBuffer(DS_TableVerifySize, bool); + UT_GenStub_SetupReturnBuffer(DS_TableVerifySize, int32); UT_GenStub_AddParam(DS_TableVerifySize, uint32, MaxFileSize); UT_GenStub_Execute(DS_TableVerifySize, Basic, NULL); - return UT_GenStub_GetReturnValue(DS_TableVerifySize, bool); + return UT_GenStub_GetReturnValue(DS_TableVerifySize, int32); } /* @@ -341,15 +341,15 @@ bool DS_TableVerifySize(uint32 MaxFileSize) * Generated stub function for DS_TableVerifyState() * ---------------------------------------------------- */ -bool DS_TableVerifyState(uint16 EnableState) +int32 DS_TableVerifyState(uint16 EnableState) { - UT_GenStub_SetupReturnBuffer(DS_TableVerifyState, bool); + UT_GenStub_SetupReturnBuffer(DS_TableVerifyState, int32); UT_GenStub_AddParam(DS_TableVerifyState, uint16, EnableState); UT_GenStub_Execute(DS_TableVerifyState, Basic, NULL); - return UT_GenStub_GetReturnValue(DS_TableVerifyState, bool); + return UT_GenStub_GetReturnValue(DS_TableVerifyState, int32); } /* @@ -357,13 +357,13 @@ bool DS_TableVerifyState(uint16 EnableState) * Generated stub function for DS_TableVerifyType() * ---------------------------------------------------- */ -bool DS_TableVerifyType(uint16 TimeVsCount) +int32 DS_TableVerifyType(uint16 TimeVsCount) { - UT_GenStub_SetupReturnBuffer(DS_TableVerifyType, bool); + UT_GenStub_SetupReturnBuffer(DS_TableVerifyType, int32); UT_GenStub_AddParam(DS_TableVerifyType, uint16, TimeVsCount); UT_GenStub_Execute(DS_TableVerifyType, Basic, NULL); - return UT_GenStub_GetReturnValue(DS_TableVerifyType, bool); + return UT_GenStub_GetReturnValue(DS_TableVerifyType, int32); } diff --git a/unit-test/stubs/stub_basetypes.h b/unit-test/stubs/stub_basetypes.h index 0d2144d..0b63486 100644 --- a/unit-test/stubs/stub_basetypes.h +++ b/unit-test/stubs/stub_basetypes.h @@ -37,6 +37,5 @@ #include /* for correct size_t and ptrdiff_t types */ #include /* for correct fixed-width integer types */ #include /* for correct INT_MAX, etc. */ -#include /* for correct boolean semantics */ #endif