From a9c81797a417e7cf569406a306fe39ff809e5873 Mon Sep 17 00:00:00 2001 From: Joseph Hickey Date: Fri, 17 Mar 2023 17:00:30 -0400 Subject: [PATCH] Fix #95, convert message dispatchers to pattern Adhere to the message dispatch pattern used by CFE and framework apps --- fsw/src/fm_app.c | 4 +- fsw/src/fm_app.h | 4 +- fsw/src/fm_cmds.c | 121 +++--- fsw/src/fm_cmds.h | 163 ++++---- fsw/src/fm_dispatch.c | 120 +++--- fsw/src/fm_dispatch.h | 38 +- unit-test/fm_cmds_tests.c | 590 ++++----------------------- unit-test/fm_dispatch_tests.c | 146 +++---- unit-test/stubs/fm_app_stubs.c | 8 +- unit-test/stubs/fm_cmd_utils_stubs.c | 18 +- unit-test/stubs/fm_cmds_stubs.c | 144 +++---- unit-test/stubs/fm_dispatch_stubs.c | 304 ++++++++++++++ unit-test/utilities/fm_test_utils.h | 2 +- 13 files changed, 773 insertions(+), 889 deletions(-) diff --git a/fsw/src/fm_app.c b/fsw/src/fm_app.c index a1b4579..ef6b809 100644 --- a/fsw/src/fm_app.c +++ b/fsw/src/fm_app.c @@ -246,7 +246,7 @@ int32 FM_AppInit(void) /* FM application -- housekeeping request packet processor */ /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -void FM_SendHkCmd(const CFE_SB_Buffer_t *BufPtr) +CFE_Status_t FM_SendHkCmd(const FM_SendHkCmd_t *MsgPtr) { FM_HousekeepingPkt_Payload_t *PayloadPtr; @@ -279,4 +279,6 @@ void FM_SendHkCmd(const CFE_SB_Buffer_t *BufPtr) CFE_SB_TimeStampMsg(CFE_MSG_PTR(FM_GlobalData.HousekeepingPkt.TelemetryHeader)); CFE_SB_TransmitMsg(CFE_MSG_PTR(FM_GlobalData.HousekeepingPkt.TelemetryHeader), true); + + return CFE_SUCCESS; } diff --git a/fsw/src/fm_app.h b/fsw/src/fm_app.h index 560b725..53dc4df 100644 --- a/fsw/src/fm_app.h +++ b/fsw/src/fm_app.h @@ -174,11 +174,11 @@ int32 FM_AppInit(void); * * \par Assumptions, External Events, and Notes: None * - * \param [in] BufPtr Pointer to Software Bus command packet. + * \param [in] MsgPtr Pointer to Software Bus command packet. * * \sa #FM_SendHkCmd_t, #FM_HousekeepingPkt_t */ -void FM_SendHkCmd(const CFE_SB_Buffer_t *BufPtr); +CFE_Status_t FM_SendHkCmd(const FM_SendHkCmd_t *MsgPtr); /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ diff --git a/fsw/src/fm_cmds.c b/fsw/src/fm_cmds.c index 9e576ef..be4e75c 100644 --- a/fsw/src/fm_cmds.c +++ b/fsw/src/fm_cmds.c @@ -45,7 +45,24 @@ * This is done as a macro so it can be applied consistently to all * message processing functions, based on the way FM defines its messages. */ -#define FM_GET_CMD_PAYLOAD(ptr, type) (&((const type *)(ptr))->Payload) +#define FM_GET_CMD_PAYLOAD(ptr, type) (&(ptr)->Payload) + +/* + * --------------------------------------------------------------------- + * Internal helper function to convert boolean status to CFE_Status_t + * --------------------------------------------------------------------- + */ +static inline CFE_Status_t FM_CommandResultToStatus(bool CommandResult) +{ + if (CommandResult) + { + return CFE_SUCCESS; + } + else + { + return CFE_STATUS_INCORRECT_STATE; + } +} /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ @@ -53,14 +70,14 @@ /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -bool FM_NoopCmd(const CFE_SB_Buffer_t *BufPtr) +CFE_Status_t FM_NoopCmd(const FM_NoopCmd_t *MsgPtr) { const char *CmdText = "No-op"; CFE_EVS_SendEvent(FM_NOOP_CMD_EID, CFE_EVS_EventType_INFORMATION, "%s command: FM version %d.%d.%d.%d", CmdText, FM_MAJOR_VERSION, FM_MINOR_VERSION, FM_REVISION, FM_MISSION_REV); - return true; + return CFE_SUCCESS; } /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -69,7 +86,7 @@ bool FM_NoopCmd(const CFE_SB_Buffer_t *BufPtr) /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -bool FM_ResetCountersCmd(const CFE_SB_Buffer_t *BufPtr) +CFE_Status_t FM_ResetCountersCmd(const FM_ResetCountersCmd_t *MsgPtr) { const char *CmdText = "Reset Counters"; @@ -83,7 +100,7 @@ bool FM_ResetCountersCmd(const CFE_SB_Buffer_t *BufPtr) /* Send command completion event (debug) */ CFE_EVS_SendEvent(FM_RESET_CMD_EID, CFE_EVS_EventType_DEBUG, "%s command", CmdText); - return true; + return CFE_SUCCESS; } /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -92,13 +109,13 @@ bool FM_ResetCountersCmd(const CFE_SB_Buffer_t *BufPtr) /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -bool FM_CopyFileCmd(const CFE_SB_Buffer_t *BufPtr) +CFE_Status_t FM_CopyFileCmd(const FM_CopyFileCmd_t *MsgPtr) { FM_ChildQueueEntry_t *CmdArgs = NULL; const char * CmdText = "Copy File"; bool CommandResult; - const FM_OvwSourceTargetFilename_Payload_t *CmdPtr = FM_GET_CMD_PAYLOAD(BufPtr, FM_CopyFileCmd_t); + const FM_OvwSourceTargetFilename_Payload_t *CmdPtr = FM_GET_CMD_PAYLOAD(MsgPtr, FM_CopyFileCmd_t); /* Verify that overwrite argument is valid */ CommandResult = FM_VerifyOverwrite(CmdPtr->Overwrite, FM_COPY_OVR_ERR_EID, CmdText); @@ -145,7 +162,7 @@ bool FM_CopyFileCmd(const CFE_SB_Buffer_t *BufPtr) FM_InvokeChildTask(); } - return CommandResult; + return FM_CommandResultToStatus(CommandResult); } /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -154,13 +171,13 @@ bool FM_CopyFileCmd(const CFE_SB_Buffer_t *BufPtr) /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -bool FM_MoveFileCmd(const CFE_SB_Buffer_t *BufPtr) +CFE_Status_t FM_MoveFileCmd(const FM_MoveFileCmd_t *MsgPtr) { FM_ChildQueueEntry_t *CmdArgs = NULL; const char * CmdText = "Move File"; bool CommandResult; - const FM_OvwSourceTargetFilename_Payload_t *CmdPtr = FM_GET_CMD_PAYLOAD(BufPtr, FM_MoveFileCmd_t); + const FM_OvwSourceTargetFilename_Payload_t *CmdPtr = FM_GET_CMD_PAYLOAD(MsgPtr, FM_MoveFileCmd_t); /* Verify that overwrite argument is valid */ CommandResult = FM_VerifyOverwrite(CmdPtr->Overwrite, FM_MOVE_OVR_ERR_EID, CmdText); @@ -208,7 +225,7 @@ bool FM_MoveFileCmd(const CFE_SB_Buffer_t *BufPtr) FM_InvokeChildTask(); } - return CommandResult; + return FM_CommandResultToStatus(CommandResult); } /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -217,13 +234,13 @@ bool FM_MoveFileCmd(const CFE_SB_Buffer_t *BufPtr) /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -bool FM_RenameFileCmd(const CFE_SB_Buffer_t *BufPtr) +CFE_Status_t FM_RenameFileCmd(const FM_RenameFileCmd_t *MsgPtr) { FM_ChildQueueEntry_t *CmdArgs = NULL; const char * CmdText = "Rename File"; bool CommandResult; - const FM_SourceTargetFileName_Payload_t *CmdPtr = FM_GET_CMD_PAYLOAD(BufPtr, FM_RenameFileCmd_t); + const FM_SourceTargetFileName_Payload_t *CmdPtr = FM_GET_CMD_PAYLOAD(MsgPtr, FM_RenameFileCmd_t); /* Verify that source file exists and is not a directory */ CommandResult = FM_VerifyFileExists(CmdPtr->Source, sizeof(CmdPtr->Source), FM_RENAME_SRC_BASE_EID, CmdText); @@ -258,7 +275,7 @@ bool FM_RenameFileCmd(const CFE_SB_Buffer_t *BufPtr) FM_InvokeChildTask(); } - return CommandResult; + return FM_CommandResultToStatus(CommandResult); } /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -267,13 +284,13 @@ bool FM_RenameFileCmd(const CFE_SB_Buffer_t *BufPtr) /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -bool FM_DeleteFileCmd(const CFE_SB_Buffer_t *BufPtr) +CFE_Status_t FM_DeleteFileCmd(const FM_DeleteFileCmd_t *MsgPtr) { FM_ChildQueueEntry_t *CmdArgs = NULL; const char * CmdText = "Delete File"; bool CommandResult; - const FM_SingleFilename_Payload_t *CmdPtr = FM_GET_CMD_PAYLOAD(BufPtr, FM_DeleteFileCmd_t); + const FM_SingleFilename_Payload_t *CmdPtr = FM_GET_CMD_PAYLOAD(MsgPtr, FM_DeleteFileCmd_t); /* Verify that file exists, is not a directory and is not open */ CommandResult = FM_VerifyFileClosed(CmdPtr->Filename, sizeof(CmdPtr->Filename), FM_DELETE_SRC_BASE_EID, CmdText); @@ -290,7 +307,7 @@ bool FM_DeleteFileCmd(const CFE_SB_Buffer_t *BufPtr) CmdArgs = &FM_GlobalData.ChildQueue[FM_GlobalData.ChildWriteIndex]; /* Set handshake queue command args - might be global or internal CC */ - CFE_MSG_GetFcnCode(&BufPtr->Msg, &CmdArgs->CommandCode); + CFE_MSG_GetFcnCode(CFE_MSG_PTR(MsgPtr->CommandHeader), &CmdArgs->CommandCode); strncpy(CmdArgs->Source1, CmdPtr->Filename, OS_MAX_PATH_LEN - 1); CmdArgs->Source1[OS_MAX_PATH_LEN - 1] = '\0'; @@ -298,7 +315,7 @@ bool FM_DeleteFileCmd(const CFE_SB_Buffer_t *BufPtr) FM_InvokeChildTask(); } - return CommandResult; + return FM_CommandResultToStatus(CommandResult); } /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -307,14 +324,14 @@ bool FM_DeleteFileCmd(const CFE_SB_Buffer_t *BufPtr) /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -bool FM_DeleteAllFilesCmd(const CFE_SB_Buffer_t *BufPtr) +CFE_Status_t FM_DeleteAllFilesCmd(const FM_DeleteAllFilesCmd_t *MsgPtr) { const char * CmdText = "Delete All Files"; char DirWithSep[OS_MAX_PATH_LEN] = "\0"; FM_ChildQueueEntry_t *CmdArgs = NULL; bool CommandResult; - const FM_DirectoryName_Payload_t *CmdPtr = FM_GET_CMD_PAYLOAD(BufPtr, FM_DeleteAllFilesCmd_t); + const FM_DirectoryName_Payload_t *CmdPtr = FM_GET_CMD_PAYLOAD(MsgPtr, FM_DeleteAllFilesCmd_t); /* Verify that the directory exists */ CommandResult = @@ -348,7 +365,7 @@ bool FM_DeleteAllFilesCmd(const CFE_SB_Buffer_t *BufPtr) FM_InvokeChildTask(); } - return CommandResult; + return FM_CommandResultToStatus(CommandResult); } /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -357,13 +374,13 @@ bool FM_DeleteAllFilesCmd(const CFE_SB_Buffer_t *BufPtr) /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -bool FM_DecompressFileCmd(const CFE_SB_Buffer_t *BufPtr) +CFE_Status_t FM_DecompressFileCmd(const FM_DecompressFileCmd_t *MsgPtr) { const char * CmdText = "Decompress File"; FM_ChildQueueEntry_t *CmdArgs = NULL; bool CommandResult; - const FM_SourceTargetFileName_Payload_t *CmdPtr = FM_GET_CMD_PAYLOAD(BufPtr, FM_DecompressFileCmd_t); + const FM_SourceTargetFileName_Payload_t *CmdPtr = FM_GET_CMD_PAYLOAD(MsgPtr, FM_DecompressFileCmd_t); /* Verify that source file exists, is not a directory and is not open */ CommandResult = FM_VerifyFileClosed(CmdPtr->Source, sizeof(CmdPtr->Source), FM_DECOM_SRC_BASE_EID, CmdText); @@ -396,7 +413,7 @@ bool FM_DecompressFileCmd(const CFE_SB_Buffer_t *BufPtr) FM_InvokeChildTask(); } - return CommandResult; + return FM_CommandResultToStatus(CommandResult); } /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -405,13 +422,13 @@ bool FM_DecompressFileCmd(const CFE_SB_Buffer_t *BufPtr) /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -bool FM_ConcatFilesCmd(const CFE_SB_Buffer_t *BufPtr) +CFE_Status_t FM_ConcatFilesCmd(const FM_ConcatFilesCmd_t *MsgPtr) { const char * CmdText = "Concat Files"; FM_ChildQueueEntry_t *CmdArgs = NULL; bool CommandResult; - const FM_TwoSourceOneTarget_Payload_t *CmdPtr = FM_GET_CMD_PAYLOAD(BufPtr, FM_ConcatFilesCmd_t); + const FM_TwoSourceOneTarget_Payload_t *CmdPtr = FM_GET_CMD_PAYLOAD(MsgPtr, FM_ConcatFilesCmd_t); /* Verify that source file #1 exists, is not a directory and is not open */ CommandResult = FM_VerifyFileClosed(CmdPtr->Source1, sizeof(CmdPtr->Source1), FM_CONCAT_SRC1_BASE_EID, CmdText); @@ -452,7 +469,7 @@ bool FM_ConcatFilesCmd(const CFE_SB_Buffer_t *BufPtr) FM_InvokeChildTask(); } - return CommandResult; + return FM_CommandResultToStatus(CommandResult); } /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -461,14 +478,14 @@ bool FM_ConcatFilesCmd(const CFE_SB_Buffer_t *BufPtr) /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -bool FM_GetFileInfoCmd(const CFE_SB_Buffer_t *BufPtr) +CFE_Status_t FM_GetFileInfoCmd(const FM_GetFileInfoCmd_t *MsgPtr) { const char * CmdText = "Get File Info"; FM_ChildQueueEntry_t *CmdArgs = NULL; bool CommandResult = true; uint32 FilenameState = FM_NAME_IS_INVALID; - const FM_FilenameAndCRC_Payload_t *CmdPtr = FM_GET_CMD_PAYLOAD(BufPtr, FM_GetFileInfoCmd_t); + const FM_FilenameAndCRC_Payload_t *CmdPtr = FM_GET_CMD_PAYLOAD(MsgPtr, FM_GetFileInfoCmd_t); /* Verify that the source name is valid for a file or directory */ FilenameState = @@ -507,7 +524,7 @@ bool FM_GetFileInfoCmd(const CFE_SB_Buffer_t *BufPtr) FM_InvokeChildTask(); } - return CommandResult; + return FM_CommandResultToStatus(CommandResult); } /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -516,7 +533,7 @@ bool FM_GetFileInfoCmd(const CFE_SB_Buffer_t *BufPtr) /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -bool FM_GetOpenFilesCmd(const CFE_SB_Buffer_t *BufPtr) +CFE_Status_t FM_GetOpenFilesCmd(const FM_GetOpenFilesCmd_t *MsgPtr) { const char *CmdText = "Get Open Files"; uint32 NumOpenFiles = 0; @@ -539,7 +556,7 @@ bool FM_GetOpenFilesCmd(const CFE_SB_Buffer_t *BufPtr) /* Send command completion event (debug) */ CFE_EVS_SendEvent(FM_GET_OPEN_FILES_CMD_EID, CFE_EVS_EventType_DEBUG, "%s command", CmdText); - return true; + return CFE_SUCCESS; } /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -548,13 +565,13 @@ bool FM_GetOpenFilesCmd(const CFE_SB_Buffer_t *BufPtr) /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -bool FM_CreateDirectoryCmd(const CFE_SB_Buffer_t *BufPtr) +CFE_Status_t FM_CreateDirectoryCmd(const FM_CreateDirectoryCmd_t *MsgPtr) { FM_ChildQueueEntry_t *CmdArgs = NULL; const char * CmdText = "Create Directory"; bool CommandResult; - const FM_DirectoryName_Payload_t *CmdPtr = FM_GET_CMD_PAYLOAD(BufPtr, FM_CreateDirectoryCmd_t); + const FM_DirectoryName_Payload_t *CmdPtr = FM_GET_CMD_PAYLOAD(MsgPtr, FM_CreateDirectoryCmd_t); /* Verify that the directory name is not already in use */ CommandResult = @@ -580,7 +597,7 @@ bool FM_CreateDirectoryCmd(const CFE_SB_Buffer_t *BufPtr) FM_InvokeChildTask(); } - return CommandResult; + return FM_CommandResultToStatus(CommandResult); } /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -589,13 +606,13 @@ bool FM_CreateDirectoryCmd(const CFE_SB_Buffer_t *BufPtr) /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -bool FM_DeleteDirectoryCmd(const CFE_SB_Buffer_t *BufPtr) +CFE_Status_t FM_DeleteDirectoryCmd(const FM_DeleteDirectoryCmd_t *MsgPtr) { FM_ChildQueueEntry_t *CmdArgs = NULL; const char * CmdText = "Delete Directory"; bool CommandResult; - const FM_DirectoryName_Payload_t *CmdPtr = FM_GET_CMD_PAYLOAD(BufPtr, FM_DeleteDirectoryCmd_t); + const FM_DirectoryName_Payload_t *CmdPtr = FM_GET_CMD_PAYLOAD(MsgPtr, FM_DeleteDirectoryCmd_t); /* Verify that the directory exists */ CommandResult = @@ -621,7 +638,7 @@ bool FM_DeleteDirectoryCmd(const CFE_SB_Buffer_t *BufPtr) FM_InvokeChildTask(); } - return CommandResult; + return FM_CommandResultToStatus(CommandResult); } /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -630,7 +647,7 @@ bool FM_DeleteDirectoryCmd(const CFE_SB_Buffer_t *BufPtr) /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -bool FM_GetDirListFileCmd(const CFE_SB_Buffer_t *BufPtr) +CFE_Status_t FM_GetDirListFileCmd(const FM_GetDirListFileCmd_t *MsgPtr) { const char * CmdText = "Directory List to File"; char DirWithSep[OS_MAX_PATH_LEN] = "\0"; @@ -638,7 +655,7 @@ bool FM_GetDirListFileCmd(const CFE_SB_Buffer_t *BufPtr) FM_ChildQueueEntry_t *CmdArgs = NULL; bool CommandResult; - const FM_GetDirectoryToFile_Payload_t *CmdPtr = FM_GET_CMD_PAYLOAD(BufPtr, FM_GetDirListFileCmd_t); + const FM_GetDirectoryToFile_Payload_t *CmdPtr = FM_GET_CMD_PAYLOAD(MsgPtr, FM_GetDirListFileCmd_t); /* Verify that source directory exists */ CommandResult = @@ -694,7 +711,7 @@ bool FM_GetDirListFileCmd(const CFE_SB_Buffer_t *BufPtr) FM_InvokeChildTask(); } - return CommandResult; + return FM_CommandResultToStatus(CommandResult); } /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -703,14 +720,14 @@ bool FM_GetDirListFileCmd(const CFE_SB_Buffer_t *BufPtr) /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -bool FM_GetDirListPktCmd(const CFE_SB_Buffer_t *BufPtr) +CFE_Status_t FM_GetDirListPktCmd(const FM_GetDirListPktCmd_t *MsgPtr) { const char * CmdText = "Directory List to Packet"; char DirWithSep[OS_MAX_PATH_LEN] = "\0"; FM_ChildQueueEntry_t *CmdArgs = NULL; bool CommandResult; - const FM_GetDirectoryToPkt_Payload_t *CmdPtr = FM_GET_CMD_PAYLOAD(BufPtr, FM_GetDirListPktCmd_t); + const FM_GetDirectoryToPkt_Payload_t *CmdPtr = FM_GET_CMD_PAYLOAD(MsgPtr, FM_GetDirListPktCmd_t); /* Verify that source directory exists */ CommandResult = @@ -746,7 +763,7 @@ bool FM_GetDirListPktCmd(const CFE_SB_Buffer_t *BufPtr) FM_InvokeChildTask(); } - return CommandResult; + return FM_CommandResultToStatus(CommandResult); } /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -755,7 +772,7 @@ bool FM_GetDirListPktCmd(const CFE_SB_Buffer_t *BufPtr) /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -bool FM_MonitorFilesystemSpaceCmd(const CFE_SB_Buffer_t *BufPtr) +CFE_Status_t FM_MonitorFilesystemSpaceCmd(const FM_MonitorFilesystemSpaceCmd_t *MsgPtr) { const char *CmdText = "Get Free Space"; bool CommandResult = true; @@ -834,7 +851,7 @@ bool FM_MonitorFilesystemSpaceCmd(const CFE_SB_Buffer_t *BufPtr) CFE_EVS_SendEvent(FM_MONITOR_FILESYSTEM_SPACE_CMD_EID, CFE_EVS_EventType_DEBUG, "%s command", CmdText); } - return CommandResult; + return FM_CommandResultToStatus(CommandResult); } /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -843,12 +860,12 @@ bool FM_MonitorFilesystemSpaceCmd(const CFE_SB_Buffer_t *BufPtr) /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -bool FM_SetTableStateCmd(const CFE_SB_Buffer_t *BufPtr) +CFE_Status_t FM_SetTableStateCmd(const FM_SetTableStateCmd_t *MsgPtr) { const char *CmdText = "Set Table State"; bool CommandResult = true; - const FM_TableIndexAndState_Payload_t *CmdPtr = FM_GET_CMD_PAYLOAD(BufPtr, FM_SetTableStateCmd_t); + const FM_TableIndexAndState_Payload_t *CmdPtr = FM_GET_CMD_PAYLOAD(MsgPtr, FM_SetTableStateCmd_t); if (FM_GlobalData.MonitorTablePtr == NULL) { @@ -898,7 +915,7 @@ bool FM_SetTableStateCmd(const CFE_SB_Buffer_t *BufPtr) (int)CmdPtr->TableEntryState); } - return CommandResult; + return FM_CommandResultToStatus(CommandResult); } /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -907,14 +924,14 @@ bool FM_SetTableStateCmd(const CFE_SB_Buffer_t *BufPtr) /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -bool FM_SetPermissionsCmd(const CFE_SB_Buffer_t *BufPtr) +CFE_Status_t FM_SetPermissionsCmd(const FM_SetPermissionsCmd_t *MsgPtr) { FM_ChildQueueEntry_t *CmdArgs = NULL; const char * CmdText = "Set Permissions"; bool CommandResult = true; bool FilenameState = FM_NAME_IS_INVALID; - const FM_FilenameAndMode_Payload_t *CmdPtr = FM_GET_CMD_PAYLOAD(BufPtr, FM_SetPermissionsCmd_t); + const FM_FilenameAndMode_Payload_t *CmdPtr = FM_GET_CMD_PAYLOAD(MsgPtr, FM_SetPermissionsCmd_t); FilenameState = FM_VerifyNameValid(CmdPtr->FileName, sizeof(CmdPtr->FileName), 0, CmdText); @@ -943,5 +960,5 @@ bool FM_SetPermissionsCmd(const CFE_SB_Buffer_t *BufPtr) FM_InvokeChildTask(); } - return CommandResult; + return FM_CommandResultToStatus(CommandResult); } diff --git a/fsw/src/fm_cmds.h b/fsw/src/fm_cmds.h index bb89fcb..e5955e4 100644 --- a/fsw/src/fm_cmds.h +++ b/fsw/src/fm_cmds.h @@ -25,6 +25,7 @@ #define FM_CMDS_H #include "cfe.h" +#include "fm_msg.h" /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ @@ -41,15 +42,14 @@ * * \par Assumptions, External Events, and Notes: * - * \param [in] BufPtr Pointer to Software Bus command packet. + * \param [in] MsgPtr Pointer to Software Bus command packet. * - * \return Boolean command success response - * \retval true Command successful - * \retval false Command not successful + * \returns CFE status response + * \retval #CFE_SUCCESS Command successful * * \sa #FM_NOOP_CC, #FM_NoopCmd_t */ -bool FM_NoopCmd(const CFE_SB_Buffer_t *BufPtr); +CFE_Status_t FM_NoopCmd(const FM_NoopCmd_t *MsgPtr); /** * \brief Reset Counters Command Handler Function @@ -59,15 +59,14 @@ bool FM_NoopCmd(const CFE_SB_Buffer_t *BufPtr); * * \par Assumptions, External Events, and Notes: * - * \param [in] BufPtr Pointer to Software Bus command packet. + * \param [in] MsgPtr Pointer to Software Bus command packet. * - * \return Boolean command success response - * \retval true Command successful - * \retval false Command not successful + * \returns CFE status response + * \retval #CFE_SUCCESS Command successful * * \sa #FM_RESET_COUNTERS_CC, #FM_ResetCountersCmd_t */ -bool FM_ResetCountersCmd(const CFE_SB_Buffer_t *BufPtr); +CFE_Status_t FM_ResetCountersCmd(const FM_ResetCountersCmd_t *MsgPtr); /** * \brief Copy File Command Handler Function @@ -85,15 +84,14 @@ bool FM_ResetCountersCmd(const CFE_SB_Buffer_t *BufPtr); * * \par Assumptions, External Events, and Notes: * - * \param [in] BufPtr Pointer to Software Bus command packet. + * \param [in] MsgPtr Pointer to Software Bus command packet. * - * \return Boolean command success response - * \retval true Command successful - * \retval false Command not successful + * \returns CFE status response + * \retval #CFE_SUCCESS Command successful * * \sa #FM_COPY_FILE_CC, #FM_CopyFileCmd_t */ -bool FM_CopyFileCmd(const CFE_SB_Buffer_t *BufPtr); +CFE_Status_t FM_CopyFileCmd(const FM_CopyFileCmd_t *MsgPtr); /** * \brief Move File Command Handler Function @@ -104,15 +102,14 @@ bool FM_CopyFileCmd(const CFE_SB_Buffer_t *BufPtr); * * \par Assumptions, External Events, and Notes: * - * \param [in] BufPtr Pointer to Software Bus command packet. + * \param [in] MsgPtr Pointer to Software Bus command packet. * - * \return Boolean command success response - * \retval true Command successful - * \retval false Command not successful + * \returns CFE status response + * \retval #CFE_SUCCESS Command successful * * \sa #FM_MOVE_FILE_CC, #FM_MoveFileCmd_t */ -bool FM_MoveFileCmd(const CFE_SB_Buffer_t *BufPtr); +CFE_Status_t FM_MoveFileCmd(const FM_MoveFileCmd_t *MsgPtr); /** * \brief Rename File Command Handler Function @@ -123,15 +120,14 @@ bool FM_MoveFileCmd(const CFE_SB_Buffer_t *BufPtr); * * \par Assumptions, External Events, and Notes: * - * \param [in] BufPtr Pointer to Software Bus command packet. + * \param [in] MsgPtr Pointer to Software Bus command packet. * - * \return Boolean command success response - * \retval true Command successful - * \retval false Command not successful + * \returns CFE status response + * \retval #CFE_SUCCESS Command successful * * \sa #FM_RENAME_FILE_CC, #FM_RenameFileCmd_t */ -bool FM_RenameFileCmd(const CFE_SB_Buffer_t *BufPtr); +CFE_Status_t FM_RenameFileCmd(const FM_RenameFileCmd_t *MsgPtr); /** * \brief Delete File Command Handler Function @@ -141,15 +137,14 @@ bool FM_RenameFileCmd(const CFE_SB_Buffer_t *BufPtr); * * \par Assumptions, External Events, and Notes: * - * \param [in] BufPtr Pointer to Software Bus command packet. + * \param [in] MsgPtr Pointer to Software Bus command packet. * - * \return Boolean command success response - * \retval true Command successful - * \retval false Command not successful + * \returns CFE status response + * \retval #CFE_SUCCESS Command successful * * \sa #FM_DELETE_FILE_CC, #FM_DeleteFileCmd_t */ -bool FM_DeleteFileCmd(const CFE_SB_Buffer_t *BufPtr); +CFE_Status_t FM_DeleteFileCmd(const FM_DeleteFileCmd_t *MsgPtr); /** * \brief Delete All Files Command Handler Function @@ -167,15 +162,14 @@ bool FM_DeleteFileCmd(const CFE_SB_Buffer_t *BufPtr); * * \par Assumptions, External Events, and Notes: * - * \param [in] BufPtr Pointer to Software Bus command packet. + * \param [in] MsgPtr Pointer to Software Bus command packet. * - * \return Boolean command success response - * \retval true Command successful - * \retval false Command not successful + * \returns CFE status response + * \retval #CFE_SUCCESS Command successful * * \sa #FM_DELETE_ALL_FILES_CC, #FM_DeleteAllFilesCmd_t */ -bool FM_DeleteAllFilesCmd(const CFE_SB_Buffer_t *BufPtr); +CFE_Status_t FM_DeleteAllFilesCmd(const FM_DeleteAllFilesCmd_t *MsgPtr); /** * \brief Decompress Files Command Handler Function @@ -194,15 +188,14 @@ bool FM_DeleteAllFilesCmd(const CFE_SB_Buffer_t *BufPtr); * * \par Assumptions, External Events, and Notes: * - * \param [in] BufPtr Pointer to Software Bus command packet. + * \param [in] MsgPtr Pointer to Software Bus command packet. * - * \return Boolean command success response - * \retval true Command successful - * \retval false Command not successful + * \returns CFE status response + * \retval #CFE_SUCCESS Command successful * * \sa #FM_DECOMPRESS_FILE_CC, #FM_DecompressFileCmd_t */ -bool FM_DecompressFileCmd(const CFE_SB_Buffer_t *BufPtr); +CFE_Status_t FM_DecompressFileCmd(const FM_DecompressFileCmd_t *MsgPtr); /** * \brief Concatenate Files Command Handler Function @@ -222,15 +215,14 @@ bool FM_DecompressFileCmd(const CFE_SB_Buffer_t *BufPtr); * * \par Assumptions, External Events, and Notes: * - * \param [in] BufPtr Pointer to Software Bus command packet. + * \param [in] MsgPtr Pointer to Software Bus command packet. * - * \return Boolean command success response - * \retval true Command successful - * \retval false Command not successful + * \returns CFE status response + * \retval #CFE_SUCCESS Command successful * * \sa #FM_CONCAT_FILES_CC, #FM_ConcatFilesCmd_t */ -bool FM_ConcatFilesCmd(const CFE_SB_Buffer_t *BufPtr); +CFE_Status_t FM_ConcatFilesCmd(const FM_ConcatFilesCmd_t *MsgPtr); /** * \brief Get File Information Command Handler Function @@ -249,15 +241,14 @@ bool FM_ConcatFilesCmd(const CFE_SB_Buffer_t *BufPtr); * * \par Assumptions, External Events, and Notes: * - * \param [in] BufPtr Pointer to Software Bus command packet. + * \param [in] MsgPtr Pointer to Software Bus command packet. * - * \return Boolean command success response - * \retval true Command successful - * \retval false Command not successful + * \returns CFE status response + * \retval #CFE_SUCCESS Command successful * * \sa #FM_GET_FILE_INFO_CC, #FM_GetFileInfoCmd_t, #FM_FileInfoPkt_t */ -bool FM_GetFileInfoCmd(const CFE_SB_Buffer_t *BufPtr); +CFE_Status_t FM_GetFileInfoCmd(const FM_GetFileInfoCmd_t *MsgPtr); /** * \brief Get Open Files List Command Handler Function @@ -268,15 +259,14 @@ bool FM_GetFileInfoCmd(const CFE_SB_Buffer_t *BufPtr); * * \par Assumptions, External Events, and Notes: * - * \param [in] BufPtr Pointer to Software Bus command packet. + * \param [in] MsgPtr Pointer to Software Bus command packet. * - * \return Boolean command success response - * \retval true Command successful - * \retval false Command not successful + * \returns CFE status response + * \retval #CFE_SUCCESS Command successful * * \sa #FM_GET_OPEN_FILES_CC, #FM_GetOpenFilesCmd_t, #FM_OpenFilesPkt_t */ -bool FM_GetOpenFilesCmd(const CFE_SB_Buffer_t *BufPtr); +CFE_Status_t FM_GetOpenFilesCmd(const FM_GetOpenFilesCmd_t *MsgPtr); /** * \brief Create Directory Command Handler Function @@ -286,15 +276,14 @@ bool FM_GetOpenFilesCmd(const CFE_SB_Buffer_t *BufPtr); * * \par Assumptions, External Events, and Notes: * - * \param [in] BufPtr Pointer to Software Bus command packet. + * \param [in] MsgPtr Pointer to Software Bus command packet. * - * \return Boolean command success response - * \retval true Command successful - * \retval false Command not successful + * \returns CFE status response + * \retval #CFE_SUCCESS Command successful * * \sa #FM_CREATE_DIRECTORY_CC, #FM_CreateDirectoryCmd_t */ -bool FM_CreateDirectoryCmd(const CFE_SB_Buffer_t *BufPtr); +CFE_Status_t FM_CreateDirectoryCmd(const FM_CreateDirectoryCmd_t *MsgPtr); /** * \brief Delete Directory Command Handler Function @@ -304,15 +293,14 @@ bool FM_CreateDirectoryCmd(const CFE_SB_Buffer_t *BufPtr); * * \par Assumptions, External Events, and Notes: * - * \param [in] BufPtr Pointer to Software Bus command packet. + * \param [in] MsgPtr Pointer to Software Bus command packet. * - * \return Boolean command success response - * \retval true Command successful - * \retval false Command not successful + * \returns CFE status response + * \retval #CFE_SUCCESS Command successful * * \sa #FM_DELETE_DIRECTORY_CC, #FM_DeleteDirectoryCmd_t */ -bool FM_DeleteDirectoryCmd(const CFE_SB_Buffer_t *BufPtr); +CFE_Status_t FM_DeleteDirectoryCmd(const FM_DeleteDirectoryCmd_t *MsgPtr); /** * \brief Get Directory List to Packet Command Handler Function @@ -330,16 +318,15 @@ bool FM_DeleteDirectoryCmd(const CFE_SB_Buffer_t *BufPtr); * * \par Assumptions, External Events, and Notes: * - * \param [in] BufPtr Pointer to Software Bus command packet. + * \param [in] MsgPtr Pointer to Software Bus command packet. * - * \return Boolean command success response - * \retval true Command successful - * \retval false Command not successful + * \returns CFE status response + * \retval #CFE_SUCCESS Command successful * * \sa #FM_GET_DIR_LIST_FILE_CC, #FM_GetDirListFileCmd_t, * #FM_DirListFileStats_t, FM_DirListEntry_t */ -bool FM_GetDirListFileCmd(const CFE_SB_Buffer_t *BufPtr); +CFE_Status_t FM_GetDirListFileCmd(const FM_GetDirListFileCmd_t *MsgPtr); /** * \brief Get Directory List to Packet Command Handler Function @@ -358,15 +345,14 @@ bool FM_GetDirListFileCmd(const CFE_SB_Buffer_t *BufPtr); * * \par Assumptions, External Events, and Notes: * - * \param [in] BufPtr Pointer to Software Bus command packet. + * \param [in] MsgPtr Pointer to Software Bus command packet. * - * \return Boolean command success response - * \retval true Command successful - * \retval false Command not successful + * \returns CFE status response + * \retval #CFE_SUCCESS Command successful * * \sa #FM_GET_DIR_LIST_PKT_CC, #FM_GetDirListPktCmd_t, #FM_DirListPkt_t */ -bool FM_GetDirListPktCmd(const CFE_SB_Buffer_t *BufPtr); +CFE_Status_t FM_GetDirListPktCmd(const FM_GetDirListPktCmd_t *MsgPtr); /** * \brief Monitor Filesystem Command Handler Function @@ -378,15 +364,14 @@ bool FM_GetDirListPktCmd(const CFE_SB_Buffer_t *BufPtr); * * \par Assumptions, External Events, and Notes: * - * \param [in] BufPtr Pointer to Software Bus command packet. + * \param [in] MsgPtr Pointer to Software Bus command packet. * - * \return Boolean command success response - * \retval true Command successful - * \retval false Command not successful + * \returns CFE status response + * \retval #CFE_SUCCESS Command successful * * \sa #FM_MONITOR_FILESYSTEM_SPACE_CC, #FM_MonitorFilesystemSpaceCmd_t, #FM_MonitorReportPkt_t */ -bool FM_MonitorFilesystemSpaceCmd(const CFE_SB_Buffer_t *BufPtr); +CFE_Status_t FM_MonitorFilesystemSpaceCmd(const FM_MonitorFilesystemSpaceCmd_t *MsgPtr); /** * \brief Set Table Entry State Command Handler Function @@ -397,15 +382,14 @@ bool FM_MonitorFilesystemSpaceCmd(const CFE_SB_Buffer_t *BufPtr); * * \par Assumptions, External Events, and Notes: * - * \param [in] BufPtr Pointer to Software Bus command packet. + * \param [in] MsgPtr Pointer to Software Bus command packet. * - * \return Boolean command success response - * \retval true Command successful - * \retval false Command not successful + * \returns CFE status response + * \retval #CFE_SUCCESS Command successful * * \sa #FM_SET_TABLE_STATE_CC, #FM_SetTableStateCmd_t, #FM_MonitorTableEntry_t */ -bool FM_SetTableStateCmd(const CFE_SB_Buffer_t *BufPtr); +CFE_Status_t FM_SetTableStateCmd(const FM_SetTableStateCmd_t *MsgPtr); /** * \brief Set File Permissions of a file @@ -415,14 +399,13 @@ bool FM_SetTableStateCmd(const CFE_SB_Buffer_t *BufPtr); * * \par Assumptions, External Events, and Notes: * - * \param [in] BufPtr Pointer to Software Bus command packet. + * \param [in] MsgPtr Pointer to Software Bus command packet. * - * \return Boolean command success response - * \retval true Command successful - * \retval false Command not successful + * \returns CFE status response + * \retval #CFE_SUCCESS Command successful * * \sa #FM_SET_PERMISSIONS_CC, #FM_SetPermissionsCmd_t, #FM_SET_PERM_CMD_EID, #FM_SET_PERM_ERR_EID */ -bool FM_SetPermissionsCmd(const CFE_SB_Buffer_t *BufPtr); +CFE_Status_t FM_SetPermissionsCmd(const FM_SetPermissionsCmd_t *MsgPtr); #endif diff --git a/fsw/src/fm_dispatch.c b/fsw/src/fm_dispatch.c index e7b2262..23be1c2 100644 --- a/fsw/src/fm_dispatch.c +++ b/fsw/src/fm_dispatch.c @@ -72,15 +72,15 @@ bool FM_IsValidCmdPktLength(const CFE_MSG_Message_t *MsgPtr, size_t ExpectedLeng /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -bool FM_NoopVerifyDispatch(const CFE_SB_Buffer_t *BufPtr) +CFE_Status_t FM_NoopVerifyDispatch(const CFE_SB_Buffer_t *BufPtr) { /* Verify message length */ if (!FM_IsValidCmdPktLength(&BufPtr->Msg, sizeof(FM_NoopCmd_t), FM_NOOP_PKT_ERR_EID, "No-op")) { - return false; + return CFE_STATUS_WRONG_MSG_LENGTH; } - return FM_NoopCmd(BufPtr); + return FM_NoopCmd((const FM_NoopCmd_t *)BufPtr); } /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -89,15 +89,15 @@ bool FM_NoopVerifyDispatch(const CFE_SB_Buffer_t *BufPtr) /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -bool FM_ResetCountersVerifyDispatch(const CFE_SB_Buffer_t *BufPtr) +CFE_Status_t FM_ResetCountersVerifyDispatch(const CFE_SB_Buffer_t *BufPtr) { /* Verify message length */ if (!FM_IsValidCmdPktLength(&BufPtr->Msg, sizeof(FM_ResetCountersCmd_t), FM_RESET_PKT_ERR_EID, "Reset Counters")) { - return false; + return CFE_STATUS_WRONG_MSG_LENGTH; } - return FM_ResetCountersCmd(BufPtr); + return FM_ResetCountersCmd((const FM_ResetCountersCmd_t *)BufPtr); } /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -106,15 +106,15 @@ bool FM_ResetCountersVerifyDispatch(const CFE_SB_Buffer_t *BufPtr) /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -bool FM_CopyFileVerifyDispatch(const CFE_SB_Buffer_t *BufPtr) +CFE_Status_t FM_CopyFileVerifyDispatch(const CFE_SB_Buffer_t *BufPtr) { /* Verify command packet length */ if (!FM_IsValidCmdPktLength(&BufPtr->Msg, sizeof(FM_CopyFileCmd_t), FM_COPY_PKT_ERR_EID, "Copy File")) { - return false; + return CFE_STATUS_WRONG_MSG_LENGTH; } - return FM_CopyFileCmd(BufPtr); + return FM_CopyFileCmd((const FM_CopyFileCmd_t *)BufPtr); } /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -123,15 +123,15 @@ bool FM_CopyFileVerifyDispatch(const CFE_SB_Buffer_t *BufPtr) /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -bool FM_MoveFileVerifyDispatch(const CFE_SB_Buffer_t *BufPtr) +CFE_Status_t FM_MoveFileVerifyDispatch(const CFE_SB_Buffer_t *BufPtr) { /* Verify command packet length */ if (!FM_IsValidCmdPktLength(&BufPtr->Msg, sizeof(FM_MoveFileCmd_t), FM_MOVE_PKT_ERR_EID, "Move File")) { - return false; + return CFE_STATUS_WRONG_MSG_LENGTH; } - return FM_MoveFileCmd(BufPtr); + return FM_MoveFileCmd((const FM_MoveFileCmd_t *)BufPtr); } /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -140,15 +140,15 @@ bool FM_MoveFileVerifyDispatch(const CFE_SB_Buffer_t *BufPtr) /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -bool FM_RenameFileVerifyDispatch(const CFE_SB_Buffer_t *BufPtr) +CFE_Status_t FM_RenameFileVerifyDispatch(const CFE_SB_Buffer_t *BufPtr) { /* Verify command packet length */ if (!FM_IsValidCmdPktLength(&BufPtr->Msg, sizeof(FM_RenameFileCmd_t), FM_RENAME_PKT_ERR_EID, "Rename File")) { - return false; + return CFE_STATUS_WRONG_MSG_LENGTH; } - return FM_RenameFileCmd(BufPtr); + return FM_RenameFileCmd((const FM_RenameFileCmd_t *)BufPtr); } /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -157,15 +157,15 @@ bool FM_RenameFileVerifyDispatch(const CFE_SB_Buffer_t *BufPtr) /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -bool FM_DeleteFileVerifyDispatch(const CFE_SB_Buffer_t *BufPtr) +CFE_Status_t FM_DeleteFileVerifyDispatch(const CFE_SB_Buffer_t *BufPtr) { /* Verify command packet length */ if (!FM_IsValidCmdPktLength(&BufPtr->Msg, sizeof(FM_DeleteFileCmd_t), FM_DELETE_PKT_ERR_EID, "Delete File")) { - return false; + return CFE_STATUS_WRONG_MSG_LENGTH; } - return FM_DeleteFileCmd(BufPtr); + return FM_DeleteFileCmd((const FM_DeleteFileCmd_t *)BufPtr); } /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -174,16 +174,16 @@ bool FM_DeleteFileVerifyDispatch(const CFE_SB_Buffer_t *BufPtr) /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -bool FM_DeleteAllFilesVerifyDispatch(const CFE_SB_Buffer_t *BufPtr) +CFE_Status_t FM_DeleteAllFilesVerifyDispatch(const CFE_SB_Buffer_t *BufPtr) { /* Verify message length */ if (!FM_IsValidCmdPktLength(&BufPtr->Msg, sizeof(FM_DeleteAllFilesCmd_t), FM_DELETE_ALL_PKT_ERR_EID, "Delete All Files")) { - return false; + return CFE_STATUS_WRONG_MSG_LENGTH; } - return FM_DeleteAllFilesCmd(BufPtr); + return FM_DeleteAllFilesCmd((const FM_DeleteAllFilesCmd_t *)BufPtr); } /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -192,15 +192,15 @@ bool FM_DeleteAllFilesVerifyDispatch(const CFE_SB_Buffer_t *BufPtr) /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -bool FM_DecompressFileVerifyDispatch(const CFE_SB_Buffer_t *BufPtr) +CFE_Status_t FM_DecompressFileVerifyDispatch(const CFE_SB_Buffer_t *BufPtr) { /* Verify command packet length */ if (!FM_IsValidCmdPktLength(&BufPtr->Msg, sizeof(FM_DecompressFileCmd_t), FM_DECOM_PKT_ERR_EID, "Decompress File")) { - return false; + return CFE_STATUS_WRONG_MSG_LENGTH; } - return FM_DecompressFileCmd(BufPtr); + return FM_DecompressFileCmd((const FM_DecompressFileCmd_t *)BufPtr); } /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -209,15 +209,15 @@ bool FM_DecompressFileVerifyDispatch(const CFE_SB_Buffer_t *BufPtr) /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -bool FM_ConcatFilesVerifyDispatch(const CFE_SB_Buffer_t *BufPtr) +CFE_Status_t FM_ConcatFilesVerifyDispatch(const CFE_SB_Buffer_t *BufPtr) { /* Verify command packet length */ if (!FM_IsValidCmdPktLength(&BufPtr->Msg, sizeof(FM_ConcatFilesCmd_t), FM_CONCAT_PKT_ERR_EID, "Concat Files")) { - return false; + return CFE_STATUS_WRONG_MSG_LENGTH; } - return FM_ConcatFilesCmd(BufPtr); + return FM_ConcatFilesCmd((const FM_ConcatFilesCmd_t *)BufPtr); } /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -226,16 +226,16 @@ bool FM_ConcatFilesVerifyDispatch(const CFE_SB_Buffer_t *BufPtr) /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -bool FM_GetFileInfoVerifyDispatch(const CFE_SB_Buffer_t *BufPtr) +CFE_Status_t FM_GetFileInfoVerifyDispatch(const CFE_SB_Buffer_t *BufPtr) { /* Verify command packet length */ if (!FM_IsValidCmdPktLength(&BufPtr->Msg, sizeof(FM_GetFileInfoCmd_t), FM_GET_FILE_INFO_PKT_ERR_EID, "Get File Info")) { - return false; + return CFE_STATUS_WRONG_MSG_LENGTH; } - return FM_GetFileInfoCmd(BufPtr); + return FM_GetFileInfoCmd((const FM_GetFileInfoCmd_t *)BufPtr); } /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -244,16 +244,16 @@ bool FM_GetFileInfoVerifyDispatch(const CFE_SB_Buffer_t *BufPtr) /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -bool FM_GetOpenFilesVerifyDispatch(const CFE_SB_Buffer_t *BufPtr) +CFE_Status_t FM_GetOpenFilesVerifyDispatch(const CFE_SB_Buffer_t *BufPtr) { /* Verify command packet length */ if (!FM_IsValidCmdPktLength(&BufPtr->Msg, sizeof(FM_GetOpenFilesCmd_t), FM_GET_OPEN_FILES_PKT_ERR_EID, "Get Open Files")) { - return false; + return CFE_STATUS_WRONG_MSG_LENGTH; } - return FM_GetOpenFilesCmd(BufPtr); + return FM_GetOpenFilesCmd((const FM_GetOpenFilesCmd_t *)BufPtr); } /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -262,16 +262,16 @@ bool FM_GetOpenFilesVerifyDispatch(const CFE_SB_Buffer_t *BufPtr) /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -bool FM_CreateDirectoryVerifyDispatch(const CFE_SB_Buffer_t *BufPtr) +CFE_Status_t FM_CreateDirectoryVerifyDispatch(const CFE_SB_Buffer_t *BufPtr) { /* Verify command packet length */ if (!FM_IsValidCmdPktLength(&BufPtr->Msg, sizeof(FM_CreateDirectoryCmd_t), FM_CREATE_DIR_PKT_ERR_EID, "Create Directory")) { - return false; + return CFE_STATUS_WRONG_MSG_LENGTH; } - return FM_CreateDirectoryCmd(BufPtr); + return FM_CreateDirectoryCmd((const FM_CreateDirectoryCmd_t *)BufPtr); } /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -280,16 +280,16 @@ bool FM_CreateDirectoryVerifyDispatch(const CFE_SB_Buffer_t *BufPtr) /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -bool FM_DeleteDirectoryVerifyDispatch(const CFE_SB_Buffer_t *BufPtr) +CFE_Status_t FM_DeleteDirectoryVerifyDispatch(const CFE_SB_Buffer_t *BufPtr) { /* Verify command packet length */ if (!FM_IsValidCmdPktLength(&BufPtr->Msg, sizeof(FM_DeleteDirectoryCmd_t), FM_DELETE_DIR_PKT_ERR_EID, "Delete Directory")) { - return false; + return CFE_STATUS_WRONG_MSG_LENGTH; } - return FM_DeleteDirectoryCmd(BufPtr); + return FM_DeleteDirectoryCmd((const FM_DeleteDirectoryCmd_t *)BufPtr); } /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -298,16 +298,16 @@ bool FM_DeleteDirectoryVerifyDispatch(const CFE_SB_Buffer_t *BufPtr) /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -bool FM_GetDirListFileVerifyDispatch(const CFE_SB_Buffer_t *BufPtr) +CFE_Status_t FM_GetDirListFileVerifyDispatch(const CFE_SB_Buffer_t *BufPtr) { /* Verify command packet length */ if (!FM_IsValidCmdPktLength(&BufPtr->Msg, sizeof(FM_GetDirListFileCmd_t), FM_GET_DIR_FILE_PKT_ERR_EID, "Directory List to File")) { - return false; + return CFE_STATUS_WRONG_MSG_LENGTH; } - return FM_GetDirListFileCmd(BufPtr); + return FM_GetDirListFileCmd((const FM_GetDirListFileCmd_t *)BufPtr); } /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -316,16 +316,16 @@ bool FM_GetDirListFileVerifyDispatch(const CFE_SB_Buffer_t *BufPtr) /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -bool FM_GetDirListPktVerifyDispatch(const CFE_SB_Buffer_t *BufPtr) +CFE_Status_t FM_GetDirListPktVerifyDispatch(const CFE_SB_Buffer_t *BufPtr) { /* Verify command packet length */ if (!FM_IsValidCmdPktLength(&BufPtr->Msg, sizeof(FM_GetDirListPktCmd_t), FM_GET_DIR_PKT_PKT_ERR_EID, "Directory List to Packet")) { - return false; + return CFE_STATUS_WRONG_MSG_LENGTH; } - return FM_GetDirListPktCmd(BufPtr); + return FM_GetDirListPktCmd((const FM_GetDirListPktCmd_t *)BufPtr); } /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -334,16 +334,16 @@ bool FM_GetDirListPktVerifyDispatch(const CFE_SB_Buffer_t *BufPtr) /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -bool FM_MonitorFilesystemSpaceVerifyDispatch(const CFE_SB_Buffer_t *BufPtr) +CFE_Status_t FM_MonitorFilesystemSpaceVerifyDispatch(const CFE_SB_Buffer_t *BufPtr) { /* Verify command packet length */ if (!FM_IsValidCmdPktLength(&BufPtr->Msg, sizeof(FM_MonitorFilesystemSpaceCmd_t), FM_GET_FREE_SPACE_PKT_ERR_EID, "Get Free Space")) { - return false; + return CFE_STATUS_WRONG_MSG_LENGTH; } - return FM_MonitorFilesystemSpaceCmd(BufPtr); + return FM_MonitorFilesystemSpaceCmd((const FM_MonitorFilesystemSpaceCmd_t *)BufPtr); } /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -352,16 +352,16 @@ bool FM_MonitorFilesystemSpaceVerifyDispatch(const CFE_SB_Buffer_t *BufPtr) /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -bool FM_SetTableStateVerifyDispatch(const CFE_SB_Buffer_t *BufPtr) +CFE_Status_t FM_SetTableStateVerifyDispatch(const CFE_SB_Buffer_t *BufPtr) { /* Verify command packet length */ if (!FM_IsValidCmdPktLength(&BufPtr->Msg, sizeof(FM_SetTableStateCmd_t), FM_SET_TABLE_STATE_PKT_ERR_EID, "Set Table State")) { - return false; + return CFE_STATUS_WRONG_MSG_LENGTH; } - return FM_SetTableStateCmd(BufPtr); + return FM_SetTableStateCmd((const FM_SetTableStateCmd_t *)BufPtr); } /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -370,15 +370,15 @@ bool FM_SetTableStateVerifyDispatch(const CFE_SB_Buffer_t *BufPtr) /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -bool FM_SetPermissionsVerifyDispatch(const CFE_SB_Buffer_t *BufPtr) +CFE_Status_t FM_SetPermissionsVerifyDispatch(const CFE_SB_Buffer_t *BufPtr) { /* Verify command packet length */ if (!FM_IsValidCmdPktLength(&BufPtr->Msg, sizeof(FM_SetPermissionsCmd_t), FM_SET_PERM_ERR_EID, "Set Permissions")) { - return false; + return CFE_STATUS_WRONG_MSG_LENGTH; } - return FM_SetPermissionsCmd(BufPtr); + return FM_SetPermissionsCmd((const FM_SetPermissionsCmd_t *)BufPtr); } /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -387,15 +387,15 @@ bool FM_SetPermissionsVerifyDispatch(const CFE_SB_Buffer_t *BufPtr) /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -void FM_SendHkVerifyDispatch(const CFE_SB_Buffer_t *BufPtr) +CFE_Status_t FM_SendHkVerifyDispatch(const CFE_SB_Buffer_t *BufPtr) { /* Verify command packet length */ if (!FM_IsValidCmdPktLength(&BufPtr->Msg, sizeof(FM_SendHkCmd_t), FM_HK_REQ_ERR_EID, "HK Request")) { - return; + return CFE_STATUS_WRONG_MSG_LENGTH; } - FM_SendHkCmd(BufPtr); + return FM_SendHkCmd((const FM_SendHkCmd_t *)BufPtr); } /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -437,7 +437,7 @@ void FM_ProcessPkt(const CFE_SB_Buffer_t *BufPtr) /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ void FM_ProcessCmd(const CFE_SB_Buffer_t *BufPtr) { - bool Result; + CFE_Status_t Result; CFE_MSG_FcnCode_t CommandCode = 0; CFE_MSG_GetFcnCode(&BufPtr->Msg, &CommandCode); @@ -518,13 +518,13 @@ void FM_ProcessCmd(const CFE_SB_Buffer_t *BufPtr) break; default: - Result = false; + Result = CFE_STATUS_BAD_COMMAND_CODE; CFE_EVS_SendEvent(FM_CC_ERR_EID, CFE_EVS_EventType_ERROR, "Main loop error: invalid command code: cc = %d", CommandCode); break; } - if (Result) + if (Result == CFE_SUCCESS) { /* Increment command success counter */ if (CommandCode != FM_RESET_COUNTERS_CC) diff --git a/fsw/src/fm_dispatch.h b/fsw/src/fm_dispatch.h index f998068..23e099a 100644 --- a/fsw/src/fm_dispatch.h +++ b/fsw/src/fm_dispatch.h @@ -80,24 +80,24 @@ bool FM_IsValidCmdPktLength(const CFE_MSG_Message_t *MsgPtr, size_t ExpectedLeng * Internal dispatch function for each command - * These are declared here so they can be directly invoked by the unit test for coverage */ -bool FM_NoopVerifyDispatch(const CFE_SB_Buffer_t *BufPtr); -bool FM_ResetCountersVerifyDispatch(const CFE_SB_Buffer_t *BufPtr); -bool FM_CopyFileVerifyDispatch(const CFE_SB_Buffer_t *BufPtr); -bool FM_MoveFileVerifyDispatch(const CFE_SB_Buffer_t *BufPtr); -bool FM_RenameFileVerifyDispatch(const CFE_SB_Buffer_t *BufPtr); -bool FM_DeleteFileVerifyDispatch(const CFE_SB_Buffer_t *BufPtr); -bool FM_DeleteAllFilesVerifyDispatch(const CFE_SB_Buffer_t *BufPtr); -bool FM_DecompressFileVerifyDispatch(const CFE_SB_Buffer_t *BufPtr); -bool FM_ConcatFilesVerifyDispatch(const CFE_SB_Buffer_t *BufPtr); -bool FM_GetFileInfoVerifyDispatch(const CFE_SB_Buffer_t *BufPtr); -bool FM_GetOpenFilesVerifyDispatch(const CFE_SB_Buffer_t *BufPtr); -bool FM_CreateDirectoryVerifyDispatch(const CFE_SB_Buffer_t *BufPtr); -bool FM_DeleteDirectoryVerifyDispatch(const CFE_SB_Buffer_t *BufPtr); -bool FM_GetDirListFileVerifyDispatch(const CFE_SB_Buffer_t *BufPtr); -bool FM_GetDirListPktVerifyDispatch(const CFE_SB_Buffer_t *BufPtr); -bool FM_MonitorFilesystemSpaceVerifyDispatch(const CFE_SB_Buffer_t *BufPtr); -bool FM_SetTableStateVerifyDispatch(const CFE_SB_Buffer_t *BufPtr); -bool FM_SetPermissionsVerifyDispatch(const CFE_SB_Buffer_t *BufPtr); -void FM_SendHkVerifyDispatch(const CFE_SB_Buffer_t *BufPtr); +CFE_Status_t FM_NoopVerifyDispatch(const CFE_SB_Buffer_t *BufPtr); +CFE_Status_t FM_ResetCountersVerifyDispatch(const CFE_SB_Buffer_t *BufPtr); +CFE_Status_t FM_CopyFileVerifyDispatch(const CFE_SB_Buffer_t *BufPtr); +CFE_Status_t FM_MoveFileVerifyDispatch(const CFE_SB_Buffer_t *BufPtr); +CFE_Status_t FM_RenameFileVerifyDispatch(const CFE_SB_Buffer_t *BufPtr); +CFE_Status_t FM_DeleteFileVerifyDispatch(const CFE_SB_Buffer_t *BufPtr); +CFE_Status_t FM_DeleteAllFilesVerifyDispatch(const CFE_SB_Buffer_t *BufPtr); +CFE_Status_t FM_DecompressFileVerifyDispatch(const CFE_SB_Buffer_t *BufPtr); +CFE_Status_t FM_ConcatFilesVerifyDispatch(const CFE_SB_Buffer_t *BufPtr); +CFE_Status_t FM_GetFileInfoVerifyDispatch(const CFE_SB_Buffer_t *BufPtr); +CFE_Status_t FM_GetOpenFilesVerifyDispatch(const CFE_SB_Buffer_t *BufPtr); +CFE_Status_t FM_CreateDirectoryVerifyDispatch(const CFE_SB_Buffer_t *BufPtr); +CFE_Status_t FM_DeleteDirectoryVerifyDispatch(const CFE_SB_Buffer_t *BufPtr); +CFE_Status_t FM_GetDirListFileVerifyDispatch(const CFE_SB_Buffer_t *BufPtr); +CFE_Status_t FM_GetDirListPktVerifyDispatch(const CFE_SB_Buffer_t *BufPtr); +CFE_Status_t FM_MonitorFilesystemSpaceVerifyDispatch(const CFE_SB_Buffer_t *BufPtr); +CFE_Status_t FM_SetTableStateVerifyDispatch(const CFE_SB_Buffer_t *BufPtr); +CFE_Status_t FM_SetPermissionsVerifyDispatch(const CFE_SB_Buffer_t *BufPtr); +CFE_Status_t FM_SendHkVerifyDispatch(const CFE_SB_Buffer_t *BufPtr); #endif diff --git a/unit-test/fm_cmds_tests.c b/unit-test/fm_cmds_tests.c index 4614ab7..2d8e271 100644 --- a/unit-test/fm_cmds_tests.c +++ b/unit-test/fm_cmds_tests.c @@ -33,6 +33,7 @@ #include "fm_cmd_utils.h" #include "fm_perfids.h" #include "fm_platform_cfg.h" +#include "fm_dispatch.h" #include "fm_verify.h" #include @@ -48,8 +49,6 @@ #include "utassert.h" #include "utstubs.h" -uint8 call_count_CFE_EVS_SendEvent; - /* ********************************************************************************** ** TEST CASE FUNCTIONS @@ -65,21 +64,14 @@ void Test_FM_NoopCmd_Success(void) char ExpectedEventString[CFE_MISSION_EVS_MAX_MESSAGE_LENGTH]; snprintf(ExpectedEventString, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH, "%%s command: FM version %%d.%%d.%%d.%%d"); - bool Result = FM_NoopCmd(&UT_CmdBuf.Buf); - - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); + UtAssert_INT32_EQ(FM_NoopCmd(&UT_CmdBuf.NoopCmd), CFE_SUCCESS); /* Assert */ - UtAssert_True(Result == true, "FM_NoopCmd returned true"); - - UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 1); - + UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, FM_NOOP_CMD_EID); - UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventType, CFE_EVS_EventType_INFORMATION); strCmpResult = strncmp(ExpectedEventString, context_CFE_EVS_SendEvent[0].Spec, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH); - UtAssert_True(strCmpResult == 0, "Event string matched expected result, '%s'", context_CFE_EVS_SendEvent[0].Spec); } @@ -96,6 +88,7 @@ void Test_FM_ResetCountersCmd_Success(void) { int32 strCmpResult; char ExpectedEventString[CFE_MISSION_EVS_MAX_MESSAGE_LENGTH]; + snprintf(ExpectedEventString, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH, "%%s command"); FM_GlobalData.CommandCounter = 1; @@ -104,21 +97,14 @@ void Test_FM_ResetCountersCmd_Success(void) FM_GlobalData.ChildCmdErrCounter = 1; FM_GlobalData.ChildCmdWarnCounter = 1; - bool Result = FM_ResetCountersCmd(&UT_CmdBuf.Buf); - - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); + UtAssert_INT32_EQ(FM_ResetCountersCmd(&UT_CmdBuf.ResetCountersCmd), CFE_SUCCESS); /* Assert */ - UtAssert_True(Result == true, "FM_ResetCountersCmd returned true"); - - UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 1); - + UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, FM_RESET_CMD_EID); - UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventType, CFE_EVS_EventType_DEBUG); strCmpResult = strncmp(ExpectedEventString, context_CFE_EVS_SendEvent[0].Spec, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH); - UtAssert_True(strCmpResult == 0, "Event string matched expected result, '%s'", context_CFE_EVS_SendEvent[0].Spec); UtAssert_INT32_EQ(FM_GlobalData.CommandCounter, 0); @@ -154,14 +140,7 @@ void Test_FM_CopyFileCmd_Success(void) UT_SetDefaultReturnValue(UT_KEY(FM_VerifyFileNotOpen), true); UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), true); - bool Result = FM_CopyFileCmd(&UT_CmdBuf.Buf); - - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); - - /* Assert */ - UtAssert_True(Result == true, "FM_CopyFileCmd returned true"); - - UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 0); + UtAssert_INT32_EQ(FM_CopyFileCmd(&UT_CmdBuf.CopyFileCmd), CFE_SUCCESS); UtAssert_INT32_EQ(FM_GlobalData.ChildQueue[0].CommandCode, FM_COPY_FILE_CC); } @@ -176,14 +155,7 @@ void Test_FM_CopyFileCmd_BadOverwrite(void) UT_SetDefaultReturnValue(UT_KEY(FM_VerifyFileNotOpen), true); UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), true); - bool Result = FM_CopyFileCmd(&UT_CmdBuf.Buf); - - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); - - /* Assert */ - UtAssert_True(Result == false, "FM_CopyFileCmd returned false"); - - UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 0); + UtAssert_INT32_EQ(FM_CopyFileCmd(&UT_CmdBuf.CopyFileCmd), CFE_STATUS_INCORRECT_STATE); UtAssert_INT32_EQ(FM_GlobalData.ChildQueue[0].CommandCode, 0); } @@ -198,14 +170,7 @@ void Test_FM_CopyFileCmd_SourceNotExist(void) UT_SetDefaultReturnValue(UT_KEY(FM_VerifyFileNotOpen), true); UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), true); - bool Result = FM_CopyFileCmd(&UT_CmdBuf.Buf); - - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); - - /* Assert */ - UtAssert_True(Result == false, "FM_CopyFileCmd returned false"); - - UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 0); + UtAssert_INT32_EQ(FM_CopyFileCmd(&UT_CmdBuf.CopyFileCmd), CFE_STATUS_INCORRECT_STATE); UtAssert_INT32_EQ(FM_GlobalData.ChildQueue[0].CommandCode, 0); } @@ -220,14 +185,7 @@ void Test_FM_CopyFileCmd_NoOverwriteTargetExists(void) UT_SetDefaultReturnValue(UT_KEY(FM_VerifyFileNotOpen), true); UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), true); - bool Result = FM_CopyFileCmd(&UT_CmdBuf.Buf); - - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); - - /* Assert */ - UtAssert_True(Result == false, "FM_CopyFileCmd returned false"); - - UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 0); + UtAssert_INT32_EQ(FM_CopyFileCmd(&UT_CmdBuf.CopyFileCmd), CFE_STATUS_INCORRECT_STATE); UtAssert_INT32_EQ(FM_GlobalData.ChildQueue[0].CommandCode, 0); } @@ -247,14 +205,7 @@ void Test_FM_CopyFileCmd_OverwriteFileOpen(void) UT_SetDefaultReturnValue(UT_KEY(FM_VerifyFileNotOpen), false); UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), true); - bool Result = FM_CopyFileCmd(&UT_CmdBuf.Buf); - - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); - - /* Assert */ - UtAssert_True(Result == false, "FM_CopyFileCmd returned false"); - - UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 0); + UtAssert_INT32_EQ(FM_CopyFileCmd(&UT_CmdBuf.CopyFileCmd), CFE_STATUS_INCORRECT_STATE); UtAssert_INT32_EQ(FM_GlobalData.ChildQueue[0].CommandCode, 0); } @@ -269,14 +220,7 @@ void Test_FM_CopyFileCmd_NoChildTask(void) UT_SetDefaultReturnValue(UT_KEY(FM_VerifyFileNotOpen), true); UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), false); - bool Result = FM_CopyFileCmd(&UT_CmdBuf.Buf); - - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); - - /* Assert */ - UtAssert_True(Result == false, "FM_CopyFileCmd returned false"); - - UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 0); + UtAssert_INT32_EQ(FM_CopyFileCmd(&UT_CmdBuf.CopyFileCmd), CFE_STATUS_INCORRECT_STATE); UtAssert_INT32_EQ(FM_GlobalData.ChildQueue[0].CommandCode, 0); } @@ -313,14 +257,7 @@ void Test_FM_MoveFileCmd_Success(void) UT_SetDefaultReturnValue(UT_KEY(FM_VerifyFileNotOpen), true); UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), true); - bool Result = FM_MoveFileCmd(&UT_CmdBuf.Buf); - - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); - - /* Assert */ - UtAssert_True(Result == true, "FM_MoveFileCmd returned true"); - - UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 0); + UtAssert_INT32_EQ(FM_MoveFileCmd(&UT_CmdBuf.MoveFileCmd), CFE_SUCCESS); UtAssert_INT32_EQ(FM_GlobalData.ChildQueue[0].CommandCode, FM_MOVE_FILE_CC); } @@ -335,14 +272,7 @@ void Test_FM_MoveFileCmd_BadOverwrite(void) UT_SetDefaultReturnValue(UT_KEY(FM_VerifyFileNotOpen), true); UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), true); - bool Result = FM_MoveFileCmd(&UT_CmdBuf.Buf); - - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); - - /* Assert */ - UtAssert_True(Result == false, "FM_MoveFileCmd returned false"); - - UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 0); + UtAssert_INT32_EQ(FM_MoveFileCmd(&UT_CmdBuf.MoveFileCmd), CFE_STATUS_INCORRECT_STATE); UtAssert_INT32_EQ(FM_GlobalData.ChildQueue[0].CommandCode, 0); } @@ -357,14 +287,7 @@ void Test_FM_MoveFileCmd_SourceNotExist(void) UT_SetDefaultReturnValue(UT_KEY(FM_VerifyFileNotOpen), true); UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), true); - bool Result = FM_MoveFileCmd(&UT_CmdBuf.Buf); - - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); - - /* Assert */ - UtAssert_True(Result == false, "FM_MoveFileCmd returned false"); - - UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 0); + UtAssert_INT32_EQ(FM_MoveFileCmd(&UT_CmdBuf.MoveFileCmd), CFE_STATUS_INCORRECT_STATE); UtAssert_INT32_EQ(FM_GlobalData.ChildQueue[0].CommandCode, 0); } @@ -379,14 +302,7 @@ void Test_FM_MoveFileCmd_NoOverwriteTargetExists(void) UT_SetDefaultReturnValue(UT_KEY(FM_VerifyFileNotOpen), true); UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), true); - bool Result = FM_MoveFileCmd(&UT_CmdBuf.Buf); - - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); - - /* Assert */ - UtAssert_True(Result == false, "FM_MoveFileCmd returned false"); - - UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 0); + UtAssert_INT32_EQ(FM_MoveFileCmd(&UT_CmdBuf.MoveFileCmd), CFE_STATUS_INCORRECT_STATE); UtAssert_INT32_EQ(FM_GlobalData.ChildQueue[0].CommandCode, 0); } @@ -406,14 +322,7 @@ void Test_FM_MoveFileCmd_OverwriteFileOpen(void) UT_SetDefaultReturnValue(UT_KEY(FM_VerifyFileNotOpen), false); UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), true); - bool Result = FM_MoveFileCmd(&UT_CmdBuf.Buf); - - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); - - /* Assert */ - UtAssert_True(Result == false, "FM_MoveFileCmd returned false"); - - UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 0); + UtAssert_INT32_EQ(FM_MoveFileCmd(&UT_CmdBuf.MoveFileCmd), CFE_STATUS_INCORRECT_STATE); UtAssert_INT32_EQ(FM_GlobalData.ChildQueue[0].CommandCode, 0); } @@ -428,14 +337,7 @@ void Test_FM_MoveFileCmd_NoChildTask(void) UT_SetDefaultReturnValue(UT_KEY(FM_VerifyFileNotOpen), true); UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), false); - bool Result = FM_MoveFileCmd(&UT_CmdBuf.Buf); - - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); - - /* Assert */ - UtAssert_True(Result == false, "FM_MoveFileCmd returned false"); - - UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 0); + UtAssert_INT32_EQ(FM_MoveFileCmd(&UT_CmdBuf.MoveFileCmd), CFE_STATUS_INCORRECT_STATE); UtAssert_INT32_EQ(FM_GlobalData.ChildQueue[0].CommandCode, 0); } @@ -477,14 +379,7 @@ void Test_FM_RenameFileCmd_Success(void) UT_SetDefaultReturnValue(UT_KEY(FM_VerifyFileNoExist), true); UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), true); - bool Result = FM_RenameFileCmd(&UT_CmdBuf.Buf); - - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); - - /* Assert */ - UtAssert_True(Result == true, "FM_RenameFileCmd returned true"); - - UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 0); + UtAssert_INT32_EQ(FM_RenameFileCmd(&UT_CmdBuf.RenameFileCmd), CFE_SUCCESS); UtAssert_INT32_EQ(FM_GlobalData.ChildQueue[0].CommandCode, FM_RENAME_FILE_CC); } @@ -497,14 +392,7 @@ void Test_FM_RenameFileCmd_SourceNotExist(void) UT_SetDefaultReturnValue(UT_KEY(FM_VerifyFileNoExist), true); UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), true); - bool Result = FM_RenameFileCmd(&UT_CmdBuf.Buf); - - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); - - /* Assert */ - UtAssert_True(Result == false, "FM_RenameFileCmd returned false"); - - UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 0); + UtAssert_INT32_EQ(FM_RenameFileCmd(&UT_CmdBuf.RenameFileCmd), CFE_STATUS_INCORRECT_STATE); UtAssert_INT32_EQ(FM_GlobalData.ChildQueue[0].CommandCode, 0); } @@ -517,14 +405,7 @@ void Test_FM_RenameFileCmd_TargetExists(void) UT_SetDefaultReturnValue(UT_KEY(FM_VerifyFileNoExist), false); UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), true); - bool Result = FM_RenameFileCmd(&UT_CmdBuf.Buf); - - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); - - /* Assert */ - UtAssert_True(Result == false, "FM_RenameFileCmd returned false"); - - UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 0); + UtAssert_INT32_EQ(FM_RenameFileCmd(&UT_CmdBuf.RenameFileCmd), CFE_STATUS_INCORRECT_STATE); UtAssert_INT32_EQ(FM_GlobalData.ChildQueue[0].CommandCode, 0); } @@ -537,14 +418,7 @@ void Test_FM_RenameFileCmd_NoChildTask(void) UT_SetDefaultReturnValue(UT_KEY(FM_VerifyFileNoExist), true); UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), false); - bool Result = FM_RenameFileCmd(&UT_CmdBuf.Buf); - - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); - - /* Assert */ - UtAssert_True(Result == false, "FM_RenameFileCmd returned false"); - - UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 0); + UtAssert_INT32_EQ(FM_RenameFileCmd(&UT_CmdBuf.RenameFileCmd), CFE_STATUS_INCORRECT_STATE); UtAssert_INT32_EQ(FM_GlobalData.ChildQueue[0].CommandCode, 0); } @@ -576,14 +450,7 @@ void Test_FM_DeleteFileCmd_Success(void) UT_SetDefaultReturnValue(UT_KEY(FM_VerifyFileClosed), true); UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), true); - bool Result = FM_DeleteFileCmd(&UT_CmdBuf.Buf); - - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); - - /* Assert */ - UtAssert_True(Result == true, "FM_DeleteFileCmd returned true"); - - UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 0); + UtAssert_INT32_EQ(FM_DeleteFileCmd(&UT_CmdBuf.DeleteFileCmd), CFE_SUCCESS); UtAssert_INT32_EQ(FM_GlobalData.ChildQueue[0].CommandCode, FM_DELETE_FILE_CC); } @@ -598,14 +465,7 @@ void Test_FM_DeleteFileCmd_FileNotClosed(void) UT_SetDefaultReturnValue(UT_KEY(FM_VerifyFileClosed), false); UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), true); - bool Result = FM_DeleteFileCmd(&UT_CmdBuf.Buf); - - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); - - /* Assert */ - UtAssert_True(Result == false, "FM_DeleteFileCmd returned false"); - - UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 0); + UtAssert_INT32_EQ(FM_DeleteFileCmd(&UT_CmdBuf.DeleteFileCmd), CFE_STATUS_INCORRECT_STATE); UtAssert_INT32_EQ(FM_GlobalData.ChildQueue[0].CommandCode, 0); } @@ -620,14 +480,7 @@ void Test_FM_DeleteFileCmd_NoChildTask(void) UT_SetDefaultReturnValue(UT_KEY(FM_VerifyFileClosed), true); UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), false); - bool Result = FM_DeleteFileCmd(&UT_CmdBuf.Buf); - - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); - - /* Assert */ - UtAssert_True(Result == false, "FM_DeleteFileCmd returned false"); - - UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 0); + UtAssert_INT32_EQ(FM_DeleteFileCmd(&UT_CmdBuf.DeleteFileCmd), CFE_STATUS_INCORRECT_STATE); UtAssert_INT32_EQ(FM_GlobalData.ChildQueue[0].CommandCode, 0); } @@ -659,14 +512,7 @@ void Test_FM_DeleteAllFilesCmd_Success(void) UT_SetDefaultReturnValue(UT_KEY(FM_VerifyDirExists), true); UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), true); - bool Result = FM_DeleteAllFilesCmd(&UT_CmdBuf.Buf); - - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); - - /* Assert */ - UtAssert_True(Result == true, "FM_DeleteAllFilesCmd returned true"); - - UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 0); + UtAssert_INT32_EQ(FM_DeleteAllFilesCmd(&UT_CmdBuf.DeleteAllFilesCmd), CFE_SUCCESS); UtAssert_INT32_EQ(FM_GlobalData.ChildQueue[0].CommandCode, FM_DELETE_ALL_FILES_CC); } @@ -678,14 +524,7 @@ void Test_FM_DeleteAllFilesCmd_DirNoExist(void) UT_SetDefaultReturnValue(UT_KEY(FM_VerifyDirExists), false); UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), true); - bool Result = FM_DeleteAllFilesCmd(&UT_CmdBuf.Buf); - - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); - - /* Assert */ - UtAssert_True(Result == false, "FM_DeleteAllFilesCmd returned false"); - - UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 0); + UtAssert_INT32_EQ(FM_DeleteAllFilesCmd(&UT_CmdBuf.DeleteAllFilesCmd), CFE_STATUS_INCORRECT_STATE); UtAssert_INT32_EQ(FM_GlobalData.ChildQueue[0].CommandCode, 0); } @@ -702,14 +541,7 @@ void Test_FM_DeleteAllFilesCmd_NoChildTask(void) UT_SetDefaultReturnValue(UT_KEY(FM_VerifyDirExists), true); UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), false); - bool Result = FM_DeleteAllFilesCmd(&UT_CmdBuf.Buf); - - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); - - /* Assert */ - UtAssert_True(Result == false, "FM_DeleteAllFilesCmd returned false"); - - UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 0); + UtAssert_INT32_EQ(FM_DeleteAllFilesCmd(&UT_CmdBuf.DeleteAllFilesCmd), CFE_STATUS_INCORRECT_STATE); UtAssert_INT32_EQ(FM_GlobalData.ChildQueue[0].CommandCode, 0); } @@ -737,14 +569,7 @@ void Test_FM_DecompressFileCmd_Success(void) UT_SetDefaultReturnValue(UT_KEY(FM_VerifyFileNoExist), true); UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), true); - bool Result = FM_DecompressFileCmd(&UT_CmdBuf.Buf); - - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); - - /* Assert */ - UtAssert_True(Result == true, "FM_DecompressFileCmd returned true"); - - UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 0); + UtAssert_INT32_EQ(FM_DecompressFileCmd(&UT_CmdBuf.DecompressFileCmd), CFE_SUCCESS); UtAssert_INT32_EQ(FM_GlobalData.ChildQueue[0].CommandCode, FM_DECOMPRESS_FILE_CC); } @@ -757,14 +582,7 @@ void Test_FM_DecompressFileCmd_SourceFileOpen(void) UT_SetDefaultReturnValue(UT_KEY(FM_VerifyFileNoExist), true); UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), true); - bool Result = FM_DecompressFileCmd(&UT_CmdBuf.Buf); - - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); - - /* Assert */ - UtAssert_True(Result == false, "FM_DecompressFileCmd returned false"); - - UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 0); + UtAssert_INT32_EQ(FM_DecompressFileCmd(&UT_CmdBuf.DecompressFileCmd), CFE_STATUS_INCORRECT_STATE); UtAssert_INT32_EQ(FM_GlobalData.ChildQueue[0].CommandCode, 0); } @@ -777,14 +595,7 @@ void Test_FM_DecompressFileCmd_TargetFileExists(void) UT_SetDefaultReturnValue(UT_KEY(FM_VerifyFileNoExist), false); UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), true); - bool Result = FM_DecompressFileCmd(&UT_CmdBuf.Buf); - - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); - - /* Assert */ - UtAssert_True(Result == false, "FM_DecompressFileCmd returned false"); - - UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 0); + UtAssert_INT32_EQ(FM_DecompressFileCmd(&UT_CmdBuf.DecompressFileCmd), CFE_STATUS_INCORRECT_STATE); UtAssert_INT32_EQ(FM_GlobalData.ChildQueue[0].CommandCode, 0); } @@ -797,14 +608,7 @@ void Test_FM_DecompressFileCmd_NoChildTask(void) UT_SetDefaultReturnValue(UT_KEY(FM_VerifyFileNoExist), true); UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), false); - bool Result = FM_DecompressFileCmd(&UT_CmdBuf.Buf); - - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); - - /* Assert */ - UtAssert_True(Result == false, "FM_DecompressFileCmd returned false"); - - UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 0); + UtAssert_INT32_EQ(FM_DecompressFileCmd(&UT_CmdBuf.DecompressFileCmd), CFE_STATUS_INCORRECT_STATE); UtAssert_INT32_EQ(FM_GlobalData.ChildQueue[0].CommandCode, 0); } @@ -843,14 +647,7 @@ void Test_FM_ConcatFilesCmd_Success(void) UT_SetDefaultReturnValue(UT_KEY(FM_VerifyFileNoExist), true); UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), true); - bool Result = FM_ConcatFilesCmd(&UT_CmdBuf.Buf); - - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); - - /* Assert */ - UtAssert_True(Result == true, "FM_ConcatFilesCmd returned true"); - - UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 0); + UtAssert_INT32_EQ(FM_ConcatFilesCmd(&UT_CmdBuf.ConcatFilesCmd), CFE_SUCCESS); UtAssert_INT32_EQ(FM_GlobalData.ChildQueue[0].CommandCode, FM_CONCAT_FILES_CC); } @@ -863,13 +660,7 @@ void Test_FM_ConcatFilesCmd_SourceFile1NotClosed(void) UT_SetDefaultReturnValue(UT_KEY(FM_VerifyFileNoExist), true); UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), true); - bool Result = FM_ConcatFilesCmd(&UT_CmdBuf.Buf); - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); - - /* Assert */ - UtAssert_True(Result == false, "FM_ConcatFilesCmd returned false"); - - UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 0); + UtAssert_INT32_EQ(FM_ConcatFilesCmd(&UT_CmdBuf.ConcatFilesCmd), CFE_STATUS_INCORRECT_STATE); UtAssert_INT32_EQ(FM_GlobalData.ChildQueue[0].CommandCode, 0); } @@ -883,13 +674,7 @@ void Test_FM_ConcatFilesCmd_SourceFile2NotClosed(void) UT_SetDefaultReturnValue(UT_KEY(FM_VerifyFileNoExist), true); UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), true); - bool Result = FM_ConcatFilesCmd(&UT_CmdBuf.Buf); - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); - - /* Assert */ - UtAssert_True(Result == false, "FM_ConcatFilesCmd returned false"); - - UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 0); + UtAssert_INT32_EQ(FM_ConcatFilesCmd(&UT_CmdBuf.ConcatFilesCmd), CFE_STATUS_INCORRECT_STATE); UtAssert_INT32_EQ(FM_GlobalData.ChildQueue[0].CommandCode, 0); } @@ -902,13 +687,7 @@ void Test_FM_ConcatFilesCmd_TargetFileExists(void) UT_SetDefaultReturnValue(UT_KEY(FM_VerifyFileNoExist), false); UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), true); - bool Result = FM_ConcatFilesCmd(&UT_CmdBuf.Buf); - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); - - /* Assert */ - UtAssert_True(Result == false, "FM_ConcatFilesCmd returned false"); - - UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 0); + UtAssert_INT32_EQ(FM_ConcatFilesCmd(&UT_CmdBuf.ConcatFilesCmd), CFE_STATUS_INCORRECT_STATE); UtAssert_INT32_EQ(FM_GlobalData.ChildQueue[0].CommandCode, 0); } @@ -921,13 +700,7 @@ void Test_FM_ConcatFilesCmd_NoChildTask(void) UT_SetDefaultReturnValue(UT_KEY(FM_VerifyFileNoExist), true); UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), false); - bool Result = FM_ConcatFilesCmd(&UT_CmdBuf.Buf); - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); - - /* Assert */ - UtAssert_True(Result == false, "FM_ConcatFilesCmd returned false"); - - UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 0); + UtAssert_INT32_EQ(FM_ConcatFilesCmd(&UT_CmdBuf.ConcatFilesCmd), CFE_STATUS_INCORRECT_STATE); UtAssert_INT32_EQ(FM_GlobalData.ChildQueue[0].CommandCode, 0); } @@ -966,14 +739,7 @@ void Test_FM_GetFileInfoCmd_Success(void) UT_SetDefaultReturnValue(UT_KEY(FM_VerifyNameValid), true); UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), true); - bool Result = FM_GetFileInfoCmd(&UT_CmdBuf.Buf); - - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); - - /* Assert */ - UtAssert_True(Result == true, "FM_GetFileInfoCmd returned true"); - - UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 0); + UtAssert_INT32_EQ(FM_GetFileInfoCmd(&UT_CmdBuf.GetFileInfoCmd), CFE_SUCCESS); UtAssert_INT32_EQ(FM_GlobalData.ChildQueue[0].CommandCode, FM_GET_FILE_INFO_CC); } @@ -985,14 +751,7 @@ void Test_FM_GetFileInfoCmd_InvalidName(void) UT_SetDefaultReturnValue(UT_KEY(FM_VerifyNameValid), false); UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), true); - bool Result = FM_GetFileInfoCmd(&UT_CmdBuf.Buf); - - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); - - /* Assert */ - UtAssert_True(Result == false, "FM_GetFileInfoCmd returned false"); - - UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 0); + UtAssert_INT32_EQ(FM_GetFileInfoCmd(&UT_CmdBuf.GetFileInfoCmd), CFE_STATUS_INCORRECT_STATE); UtAssert_INT32_EQ(FM_GlobalData.ChildQueue[0].CommandCode, 0); } @@ -1004,14 +763,7 @@ void Test_FM_GetFileInfoCmd_NoChildTask(void) UT_SetDefaultReturnValue(UT_KEY(FM_VerifyNameValid), true); UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), false); - bool Result = FM_GetFileInfoCmd(&UT_CmdBuf.Buf); - - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); - - /* Assert */ - UtAssert_True(Result == false, "FM_GetFileInfoCmd returned false"); - - UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 0); + UtAssert_INT32_EQ(FM_GetFileInfoCmd(&UT_CmdBuf.GetFileInfoCmd), CFE_STATUS_INCORRECT_STATE); UtAssert_INT32_EQ(FM_GlobalData.ChildQueue[0].CommandCode, 0); } @@ -1036,21 +788,13 @@ void Test_FM_GetOpenFilesCmd_Success(void) char ExpectedEventString[CFE_MISSION_EVS_MAX_MESSAGE_LENGTH]; snprintf(ExpectedEventString, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH, "%%s command"); - bool Result = FM_GetOpenFilesCmd(&UT_CmdBuf.Buf); - - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); - - /* Assert */ - UtAssert_True(Result == true, "FM_GetOpenFilesCmd returned true"); - - UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 1); + UtAssert_INT32_EQ(FM_GetOpenFilesCmd(&UT_CmdBuf.GetOpenFilesCmd), CFE_SUCCESS); + UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, FM_GET_OPEN_FILES_CMD_EID); - UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventType, CFE_EVS_EventType_DEBUG); strCmpResult = strncmp(ExpectedEventString, context_CFE_EVS_SendEvent[0].Spec, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH); - UtAssert_True(strCmpResult == 0, "Event string matched expected result, '%s'", context_CFE_EVS_SendEvent[0].Spec); } @@ -1076,14 +820,7 @@ void Test_FM_CreateDirectoryCmd_Success(void) UT_SetDefaultReturnValue(UT_KEY(FM_VerifyDirNoExist), true); UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), true); - bool Result = FM_CreateDirectoryCmd(&UT_CmdBuf.Buf); - - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); - - /* Assert */ - UtAssert_True(Result == true, "FM_CreateDirectoryCmd returned true"); - - UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 0); + UtAssert_INT32_EQ(FM_CreateDirectoryCmd(&UT_CmdBuf.CreateDirectoryCmd), CFE_SUCCESS); UtAssert_INT32_EQ(FM_GlobalData.ChildQueue[0].CommandCode, FM_CREATE_DIRECTORY_CC); } @@ -1095,14 +832,7 @@ void Test_FM_CreateDirectoryCmd_DirExists(void) UT_SetDefaultReturnValue(UT_KEY(FM_VerifyDirNoExist), false); UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), true); - bool Result = FM_CreateDirectoryCmd(&UT_CmdBuf.Buf); - - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); - - /* Assert */ - UtAssert_True(Result == false, "FM_CreateDirectoryCmd returned false"); - - UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 0); + UtAssert_INT32_EQ(FM_CreateDirectoryCmd(&UT_CmdBuf.CreateDirectoryCmd), CFE_STATUS_INCORRECT_STATE); UtAssert_INT32_EQ(FM_GlobalData.ChildQueue[0].CommandCode, 0); } @@ -1114,14 +844,7 @@ void Test_FM_CreateDirectoryCmd_NoChildTask(void) UT_SetDefaultReturnValue(UT_KEY(FM_VerifyDirNoExist), true); UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), false); - bool Result = FM_CreateDirectoryCmd(&UT_CmdBuf.Buf); - - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); - - /* Assert */ - UtAssert_True(Result == false, "FM_CreateDirectoryCmd returned false"); - - UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 0); + UtAssert_INT32_EQ(FM_CreateDirectoryCmd(&UT_CmdBuf.CreateDirectoryCmd), CFE_STATUS_INCORRECT_STATE); UtAssert_INT32_EQ(FM_GlobalData.ChildQueue[0].CommandCode, 0); } @@ -1154,14 +877,7 @@ void Test_FM_DeleteDirectoryCmd_Success(void) UT_SetDefaultReturnValue(UT_KEY(FM_VerifyDirExists), true); UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), true); - bool Result = FM_DeleteDirectoryCmd(&UT_CmdBuf.Buf); - - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); - - /* Assert */ - UtAssert_True(Result == true, "FM_DeleteDirectoryCmd returned true"); - - UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 0); + UtAssert_INT32_EQ(FM_DeleteDirectoryCmd(&UT_CmdBuf.DeleteDirectoryCmd), CFE_SUCCESS); UtAssert_INT32_EQ(FM_GlobalData.ChildQueue[0].CommandCode, FM_DELETE_DIRECTORY_CC); } @@ -1173,14 +889,7 @@ void Test_FM_DeleteDirectoryCmd_DirNoExist(void) UT_SetDefaultReturnValue(UT_KEY(FM_VerifyDirExists), false); UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), true); - bool Result = FM_DeleteDirectoryCmd(&UT_CmdBuf.Buf); - - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); - - /* Assert */ - UtAssert_True(Result == false, "FM_DeleteDirectoryCmd returned false"); - - UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 0); + UtAssert_INT32_EQ(FM_DeleteDirectoryCmd(&UT_CmdBuf.DeleteDirectoryCmd), CFE_STATUS_INCORRECT_STATE); UtAssert_INT32_EQ(FM_GlobalData.ChildQueue[0].CommandCode, 0); } @@ -1192,14 +901,7 @@ void Test_FM_DeleteDirectoryCmd_NoChildTask(void) UT_SetDefaultReturnValue(UT_KEY(FM_VerifyDirExists), true); UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), false); - bool Result = FM_DeleteDirectoryCmd(&UT_CmdBuf.Buf); - - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); - - /* Assert */ - UtAssert_True(Result == false, "FM_DeleteDirectoryCmd returned false"); - - UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 0); + UtAssert_INT32_EQ(FM_DeleteDirectoryCmd(&UT_CmdBuf.DeleteDirectoryCmd), CFE_STATUS_INCORRECT_STATE); UtAssert_INT32_EQ(FM_GlobalData.ChildQueue[0].CommandCode, 0); } @@ -1234,14 +936,7 @@ void Test_FM_GetDirListFileCmd_Success(void) UT_SetDefaultReturnValue(UT_KEY(FM_VerifyFileNotOpen), true); UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), true); - bool Result = FM_GetDirListFileCmd(&UT_CmdBuf.Buf); - - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); - - /* Assert */ - UtAssert_True(Result == true, "FM_GetDirListFileCmd returned true"); - - UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 0); + UtAssert_INT32_EQ(FM_GetDirListFileCmd(&UT_CmdBuf.GetDirListFileCmd), CFE_SUCCESS); UtAssert_INT32_EQ(FM_GlobalData.ChildQueue[0].CommandCode, FM_GET_DIR_LIST_FILE_CC); } @@ -1260,14 +955,7 @@ void Test_FM_GetDirListFileCmd_SuccessDefaultPath(void) UT_SetDefaultReturnValue(UT_KEY(FM_VerifyFileNotOpen), true); UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), true); - bool Result = FM_GetDirListFileCmd(&UT_CmdBuf.Buf); - - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); - - /* Assert */ - UtAssert_True(Result == true, "FM_GetDirListFileCmd returned true"); - - UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 0); + UtAssert_INT32_EQ(FM_GetDirListFileCmd(&UT_CmdBuf.GetDirListFileCmd), CFE_SUCCESS); UtAssert_INT32_EQ(FM_GlobalData.ChildQueue[0].CommandCode, FM_GET_DIR_LIST_FILE_CC); } @@ -1280,14 +968,7 @@ void Test_FM_GetDirListFileCmd_SourceNotExist(void) UT_SetDefaultReturnValue(UT_KEY(FM_VerifyFileNotOpen), true); UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), true); - bool Result = FM_GetDirListFileCmd(&UT_CmdBuf.Buf); - - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); - - /* Assert */ - UtAssert_True(Result == false, "FM_GetDirListFileCmd returned false"); - - UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 0); + UtAssert_INT32_EQ(FM_GetDirListFileCmd(&UT_CmdBuf.GetDirListFileCmd), CFE_STATUS_INCORRECT_STATE); UtAssert_INT32_EQ(FM_GlobalData.ChildQueue[0].CommandCode, 0); } @@ -1307,14 +988,7 @@ void Test_FM_GetDirListFileCmd_TargetFileOpen(void) UT_SetDefaultReturnValue(UT_KEY(FM_VerifyFileNotOpen), false); UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), true); - bool Result = FM_GetDirListFileCmd(&UT_CmdBuf.Buf); - - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); - - /* Assert */ - UtAssert_True(Result == false, "FM_GetDirListFileCmd returned false"); - - UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 0); + UtAssert_INT32_EQ(FM_GetDirListFileCmd(&UT_CmdBuf.GetDirListFileCmd), CFE_STATUS_INCORRECT_STATE); UtAssert_INT32_EQ(FM_GlobalData.ChildQueue[0].CommandCode, 0); } @@ -1334,14 +1008,7 @@ void Test_FM_GetDirListFileCmd_NoChildTask(void) UT_SetDefaultReturnValue(UT_KEY(FM_VerifyFileNotOpen), true); UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), false); - bool Result = FM_GetDirListFileCmd(&UT_CmdBuf.Buf); - - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); - - /* Assert */ - UtAssert_True(Result == false, "FM_GetDirListFileCmd returned false"); - - UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 0); + UtAssert_INT32_EQ(FM_GetDirListFileCmd(&UT_CmdBuf.GetDirListFileCmd), CFE_STATUS_INCORRECT_STATE); UtAssert_INT32_EQ(FM_GlobalData.ChildQueue[0].CommandCode, 0); } @@ -1380,14 +1047,7 @@ void Test_FM_GetDirListPktCmd_Success(void) UT_SetDefaultReturnValue(UT_KEY(FM_VerifyDirExists), true); UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), true); - bool Result = FM_GetDirListPktCmd(&UT_CmdBuf.Buf); - - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); - - /* Assert */ - UtAssert_True(Result == true, "FM_GetDirListPktCmd returned true"); - - UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 0); + UtAssert_INT32_EQ(FM_GetDirListPktCmd(&UT_CmdBuf.GetDirListPktCmd), CFE_SUCCESS); UtAssert_INT32_EQ(FM_GlobalData.ChildQueue[0].CommandCode, FM_GET_DIR_LIST_PKT_CC); } @@ -1399,14 +1059,7 @@ void Test_FM_GetDirListPktCmd_SourceNotExist(void) UT_SetDefaultReturnValue(UT_KEY(FM_VerifyDirExists), false); UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), true); - bool Result = FM_GetDirListPktCmd(&UT_CmdBuf.Buf); - - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); - - /* Assert */ - UtAssert_True(Result == false, "FM_GetDirListPktCmd returned false"); - - UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 0); + UtAssert_INT32_EQ(FM_GetDirListPktCmd(&UT_CmdBuf.GetDirListPktCmd), CFE_STATUS_INCORRECT_STATE); UtAssert_INT32_EQ(FM_GlobalData.ChildQueue[0].CommandCode, 0); } @@ -1418,14 +1071,7 @@ void Test_FM_GetDirListPktCmd_NoChildTask(void) UT_SetDefaultReturnValue(UT_KEY(FM_VerifyDirExists), true); UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), false); - bool Result = FM_GetDirListPktCmd(&UT_CmdBuf.Buf); - - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); - - /* Assert */ - UtAssert_True(Result == false, "FM_GetDirListPktCmd returned false"); - - UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 0); + UtAssert_INT32_EQ(FM_GetDirListPktCmd(&UT_CmdBuf.GetDirListPktCmd), CFE_STATUS_INCORRECT_STATE); UtAssert_INT32_EQ(FM_GlobalData.ChildQueue[0].CommandCode, 0); } @@ -1487,21 +1133,16 @@ void Test_FM_MonitorFilesystemSpaceCmd_Success(void) UT_SetDefaultReturnValue(UT_KEY(FM_VerifyDirExists), true); UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), true); - UtAssert_BOOL_TRUE(FM_MonitorFilesystemSpaceCmd(&UT_CmdBuf.Buf)); + UtAssert_INT32_EQ(FM_MonitorFilesystemSpaceCmd(&UT_CmdBuf.MonitorFilesystemSpaceCmd), CFE_SUCCESS); - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); + UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, FM_MONITOR_FILESYSTEM_SPACE_CMD_EID); - UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventType, CFE_EVS_EventType_DEBUG); strCmpResult = strncmp(ExpectedEventString, context_CFE_EVS_SendEvent[0].Spec, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH); - UtAssert_True(strCmpResult == 0, "Event string matched expected result, '%s'", context_CFE_EVS_SendEvent[0].Spec); - uint8 call_count_CFE_SB_TransmitMsg = UT_GetStubCount(UT_KEY(CFE_SB_TransmitMsg)); - - UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 1); - UtAssert_INT32_EQ(call_count_CFE_SB_TransmitMsg, 1); + UtAssert_STUB_COUNT(CFE_SB_TransmitMsg, 1); ReportPtr = &FM_GlobalData.MonitorReportPkt.Payload; UtAssert_UINT32_EQ(ReportPtr->FileSys[0].Bytes, 2000); @@ -1521,21 +1162,16 @@ void Test_FM_MonitorFilesystemSpaceCmd_NullFreeSpaceTable(void) FM_GlobalData.MonitorTablePtr = NULL; - UtAssert_BOOL_FALSE(FM_MonitorFilesystemSpaceCmd(&UT_CmdBuf.Buf)); + UtAssert_INT32_EQ(FM_MonitorFilesystemSpaceCmd(&UT_CmdBuf.MonitorFilesystemSpaceCmd), CFE_STATUS_INCORRECT_STATE); - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); - uint8 call_count_CFE_SB_TransmitMsg = UT_GetStubCount(UT_KEY(CFE_SB_TransmitMsg)); + UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); + UtAssert_STUB_COUNT(CFE_SB_TransmitMsg, 0); - UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 1); UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, FM_GET_FREE_SPACE_TBL_ERR_EID); - UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventType, CFE_EVS_EventType_ERROR); strCmpResult = strncmp(ExpectedEventString, context_CFE_EVS_SendEvent[0].Spec, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH); - UtAssert_True(strCmpResult == 0, "Event string matched expected result, '%s'", context_CFE_EVS_SendEvent[0].Spec); - - UtAssert_INT32_EQ(call_count_CFE_SB_TransmitMsg, 0); } void Test_FM_MonitorFilesystemSpaceCmd_ImplCallFails(void) @@ -1561,22 +1197,17 @@ void Test_FM_MonitorFilesystemSpaceCmd_ImplCallFails(void) UT_SetDefaultReturnValue(UT_KEY(FM_GetVolumeFreeSpace), CFE_STATUS_EXTERNAL_RESOURCE_FAIL); /* Assert */ - UtAssert_BOOL_FALSE(FM_MonitorFilesystemSpaceCmd(&UT_CmdBuf.Buf)); - - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); + UtAssert_INT32_EQ(FM_MonitorFilesystemSpaceCmd(&UT_CmdBuf.MonitorFilesystemSpaceCmd), CFE_STATUS_INCORRECT_STATE); + UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, FM_MONITOR_FILESYSTEM_SPACE_CMD_EID); - UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventType, CFE_EVS_EventType_DEBUG); strCmpResult = strncmp(ExpectedEventString2, context_CFE_EVS_SendEvent[0].Spec, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH); - UtAssert_True(strCmpResult == 0, "Event string matched expected result, '%s'", context_CFE_EVS_SendEvent[0].Spec); - uint8 call_count_CFE_SB_TransmitMsg = UT_GetStubCount(UT_KEY(CFE_SB_TransmitMsg)); + UtAssert_STUB_COUNT(CFE_SB_TransmitMsg, 1); - UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 1); - UtAssert_INT32_EQ(call_count_CFE_SB_TransmitMsg, 1); ReportPtr = &FM_GlobalData.MonitorReportPkt.Payload; UtAssert_ZERO(ReportPtr->FileSys[0].Blocks); UtAssert_ZERO(ReportPtr->FileSys[0].Bytes); @@ -1603,22 +1234,17 @@ void Test_FM_MonitorFilesystemSpaceCmd_NotImpl(void) FM_GlobalData.MonitorTablePtr = &DummyTable; /* Assert */ - UtAssert_BOOL_FALSE(FM_MonitorFilesystemSpaceCmd(&UT_CmdBuf.Buf)); - - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); + UtAssert_INT32_EQ(FM_MonitorFilesystemSpaceCmd(&UT_CmdBuf.MonitorFilesystemSpaceCmd), CFE_STATUS_INCORRECT_STATE); + UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, FM_MONITOR_FILESYSTEM_SPACE_CMD_EID); - UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventType, CFE_EVS_EventType_DEBUG); strCmpResult = strncmp(ExpectedEventString2, context_CFE_EVS_SendEvent[0].Spec, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH); - UtAssert_True(strCmpResult == 0, "Event string matched expected result, '%s'", context_CFE_EVS_SendEvent[0].Spec); - uint8 call_count_CFE_SB_TransmitMsg = UT_GetStubCount(UT_KEY(CFE_SB_TransmitMsg)); + UtAssert_STUB_COUNT(CFE_SB_TransmitMsg, 1); - UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 1); - UtAssert_INT32_EQ(call_count_CFE_SB_TransmitMsg, 1); ReportPtr = &FM_GlobalData.MonitorReportPkt.Payload; UtAssert_ZERO(ReportPtr->FileSys[0].Blocks); UtAssert_ZERO(ReportPtr->FileSys[0].Bytes); @@ -1663,18 +1289,15 @@ void Test_FM_SetTableStateCmd_Success(void) DummyTable.Entries[0].Type = FM_MonitorTableEntry_Type_VOLUME_FREE_SPACE; FM_GlobalData.MonitorTablePtr = &DummyTable; - UtAssert_BOOL_TRUE(FM_SetTableStateCmd(&UT_CmdBuf.Buf)); + UtAssert_INT32_EQ(FM_SetTableStateCmd(&UT_CmdBuf.SetTableStateCmd), CFE_SUCCESS); - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); + UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, FM_SET_TABLE_STATE_CMD_EID); - UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventType, CFE_EVS_EventType_INFORMATION); strCmpResult = strncmp(ExpectedEventString, context_CFE_EVS_SendEvent[0].Spec, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH); - UtAssert_True(strCmpResult == 0, "Event string matched expected result, '%s'", context_CFE_EVS_SendEvent[0].Spec); - UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 1); UtAssert_INT32_EQ(FM_GlobalData.MonitorTablePtr->Entries[0].Enabled, FM_TABLE_ENTRY_ENABLED); } @@ -1694,20 +1317,12 @@ void Test_FM_SetTableStateCmd_NullFreeSpaceTable(void) FM_GlobalData.MonitorTablePtr = NULL; - bool Result = FM_SetTableStateCmd(&UT_CmdBuf.Buf); - - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); - - /* Assert */ - UtAssert_True(Result == false, "FM_SetTableStateCmd returned false"); - - UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 1); + UtAssert_INT32_EQ(FM_SetTableStateCmd(&UT_CmdBuf.SetTableStateCmd), CFE_STATUS_INCORRECT_STATE); + UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, FM_SET_TABLE_STATE_TBL_ERR_EID); - UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventType, CFE_EVS_EventType_ERROR); strCmpResult = strncmp(ExpectedEventString, context_CFE_EVS_SendEvent[0].Spec, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH); - UtAssert_True(strCmpResult == 0, "Event string matched expected result, '%s'", context_CFE_EVS_SendEvent[0].Spec); } @@ -1731,21 +1346,13 @@ void Test_FM_SetTableStateCmd_TableEntryIndexTooLarge(void) FM_GlobalData.MonitorTablePtr = &DummyTable; - bool Result = FM_SetTableStateCmd(&UT_CmdBuf.Buf); - - /* Assert */ - UtAssert_True(Result == false, "FM_SetTableStateCmd returned false"); - - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); + UtAssert_INT32_EQ(FM_SetTableStateCmd(&UT_CmdBuf.SetTableStateCmd), CFE_STATUS_INCORRECT_STATE); + UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, FM_SET_TABLE_STATE_ARG_IDX_ERR_EID); - UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventType, CFE_EVS_EventType_ERROR); strCmpResult = strncmp(ExpectedEventString, context_CFE_EVS_SendEvent[0].Spec, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH); - UtAssert_True(strCmpResult == 0, "Event string matched expected result, '%s'", context_CFE_EVS_SendEvent[0].Spec); - - UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 1); } void Test_FM_SetTableStateCmd_BadNewState(void) @@ -1768,21 +1375,13 @@ void Test_FM_SetTableStateCmd_BadNewState(void) FM_GlobalData.MonitorTablePtr = &DummyTable; - bool Result = FM_SetTableStateCmd(&UT_CmdBuf.Buf); - - /* Assert */ - UtAssert_True(Result == false, "FM_SetTableStateCmd returned false"); - - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); + UtAssert_INT32_EQ(FM_SetTableStateCmd(&UT_CmdBuf.SetTableStateCmd), CFE_STATUS_INCORRECT_STATE); + UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, FM_SET_TABLE_STATE_ARG_STATE_ERR_EID); - UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventType, CFE_EVS_EventType_ERROR); strCmpResult = strncmp(ExpectedEventString, context_CFE_EVS_SendEvent[0].Spec, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH); - UtAssert_True(strCmpResult == 0, "Event string matched expected result, '%s'", context_CFE_EVS_SendEvent[0].Spec); - - UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 1); } void Test_FM_SetTableStateCmd_BadCurrentState(void) @@ -1805,18 +1404,14 @@ void Test_FM_SetTableStateCmd_BadCurrentState(void) FM_GlobalData.MonitorTablePtr = &DummyTable; - UtAssert_BOOL_FALSE(FM_SetTableStateCmd(&UT_CmdBuf.Buf)); + UtAssert_INT32_EQ(FM_SetTableStateCmd(&UT_CmdBuf.SetTableStateCmd), CFE_STATUS_INCORRECT_STATE); - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); + UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, FM_SET_TABLE_STATE_UNUSED_ERR_EID); - UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventType, CFE_EVS_EventType_ERROR); strCmpResult = strncmp(ExpectedEventString, context_CFE_EVS_SendEvent[0].Spec, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH); - UtAssert_True(strCmpResult == 0, "Event string matched expected result, '%s'", context_CFE_EVS_SendEvent[0].Spec); - - UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 1); } void add_FM_SetTableStateCmd_tests(void) @@ -1851,48 +1446,25 @@ void Test_FM_SetPermissionsCmd_Success(void) UT_SetDefaultReturnValue(UT_KEY(FM_VerifyNameValid), true); UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), true); - bool Result = FM_SetPermissionsCmd(&UT_CmdBuf.Buf); - - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); - - /* Assert */ - UtAssert_True(Result == true, "FM_SetPermissionsCmd returned true"); - - UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 0); + UtAssert_INT32_EQ(FM_SetPermissionsCmd(&UT_CmdBuf.SetPermissionsCmd), CFE_SUCCESS); UtAssert_INT32_EQ(FM_GlobalData.ChildQueue[0].CommandCode, FM_SET_PERMISSIONS_CC); } void Test_FM_SetPermissionsCmd_BadName(void) { - UT_SetDefaultReturnValue(UT_KEY(FM_VerifyNameValid), false); UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), true); - bool Result = FM_SetPermissionsCmd(&UT_CmdBuf.Buf); - - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); - - /* Assert */ - UtAssert_True(Result == false, "FM_SetPermissionsCmd returned false"); - - UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 0); + UtAssert_INT32_EQ(FM_SetPermissionsCmd(&UT_CmdBuf.SetPermissionsCmd), CFE_STATUS_INCORRECT_STATE); UtAssert_INT32_EQ(FM_GlobalData.ChildQueue[0].CommandCode, 0); } void Test_FM_SetPermissionsCmd_NoChildTask(void) { - UT_SetDefaultReturnValue(UT_KEY(FM_VerifyNameValid), false); UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), true); - bool Result = FM_SetPermissionsCmd(&UT_CmdBuf.Buf); - - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); - - /* Assert */ - UtAssert_True(Result == false, "FM_SetPermissionsCmd returned false"); - - UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 0); + UtAssert_INT32_EQ(FM_SetPermissionsCmd(&UT_CmdBuf.SetPermissionsCmd), CFE_STATUS_INCORRECT_STATE); UtAssert_INT32_EQ(FM_GlobalData.ChildQueue[0].CommandCode, 0); } diff --git a/unit-test/fm_dispatch_tests.c b/unit-test/fm_dispatch_tests.c index d813f74..a9ede84 100644 --- a/unit-test/fm_dispatch_tests.c +++ b/unit-test/fm_dispatch_tests.c @@ -46,6 +46,8 @@ #include #include "cfe.h" +#define FM_UT_CMD_STATUS_CHECK -1858 + /********************************************************************************* * TEST CASE FUNCTIONS *********************************************************************************/ @@ -63,7 +65,7 @@ void Test_FM_ProcessCmd_NoopCmdCCReturn(void) UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &fcn_code, sizeof(fcn_code), false); length = sizeof(FM_NoopCmd_t); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false); - UT_SetDefaultReturnValue(UT_KEY(FM_NoopCmd), true); + UT_SetDefaultReturnValue(UT_KEY(FM_NoopCmd), CFE_SUCCESS); /* Act */ UtAssert_VOIDCALL(FM_ProcessCmd(NULL)); @@ -85,7 +87,7 @@ void Test_FM_ProcessCmd_ResetCountersCCReturn(void) UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &fcn_code, sizeof(fcn_code), false); length = sizeof(FM_ResetCountersCmd_t); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false); - UT_SetDefaultReturnValue(UT_KEY(FM_ResetCountersCmd), true); + UT_SetDefaultReturnValue(UT_KEY(FM_ResetCountersCmd), CFE_SUCCESS); /* Act */ UtAssert_VOIDCALL(FM_ProcessCmd(NULL)); @@ -107,7 +109,7 @@ void Test_FM_ProcessCmd_CopyFileCCReturn(void) UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &fcn_code, sizeof(fcn_code), false); length = sizeof(FM_CopyFileCmd_t); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false); - UT_SetDefaultReturnValue(UT_KEY(FM_CopyFileCmd), true); + UT_SetDefaultReturnValue(UT_KEY(FM_CopyFileCmd), CFE_SUCCESS); /* Act */ UtAssert_VOIDCALL(FM_ProcessCmd(NULL)); @@ -129,7 +131,7 @@ void Test_FM_ProcessCmd_MoveFileCCReturn(void) UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &fcn_code, sizeof(fcn_code), false); length = sizeof(FM_MoveFileCmd_t); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false); - UT_SetDefaultReturnValue(UT_KEY(FM_MoveFileCmd), true); + UT_SetDefaultReturnValue(UT_KEY(FM_MoveFileCmd), CFE_SUCCESS); /* Act */ UtAssert_VOIDCALL(FM_ProcessCmd(NULL)); @@ -151,7 +153,7 @@ void Test_FM_ProcessCmd_RenameFileCCReturn(void) UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &fcn_code, sizeof(fcn_code), false); length = sizeof(FM_RenameFileCmd_t); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false); - UT_SetDefaultReturnValue(UT_KEY(FM_RenameFileCmd), true); + UT_SetDefaultReturnValue(UT_KEY(FM_RenameFileCmd), CFE_SUCCESS); /* Act */ UtAssert_VOIDCALL(FM_ProcessCmd(NULL)); @@ -173,7 +175,7 @@ void Test_FM_ProcessCmd_DeleteFileCCReturn(void) UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &fcn_code, sizeof(fcn_code), false); length = sizeof(FM_DeleteFileCmd_t); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false); - UT_SetDefaultReturnValue(UT_KEY(FM_DeleteFileCmd), true); + UT_SetDefaultReturnValue(UT_KEY(FM_DeleteFileCmd), CFE_SUCCESS); /* Act */ UtAssert_VOIDCALL(FM_ProcessCmd(NULL)); @@ -195,7 +197,7 @@ void Test_FM_ProcessCmd_DeleteAllFilesCCReturn(void) UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &fcn_code, sizeof(fcn_code), false); length = sizeof(FM_DeleteAllFilesCmd_t); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false); - UT_SetDefaultReturnValue(UT_KEY(FM_DeleteAllFilesCmd), true); + UT_SetDefaultReturnValue(UT_KEY(FM_DeleteAllFilesCmd), CFE_SUCCESS); /* Act */ UtAssert_VOIDCALL(FM_ProcessCmd(NULL)); @@ -217,7 +219,7 @@ void Test_FM_ProcessCmd_DecompressFileCCReturn(void) UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &fcn_code, sizeof(fcn_code), false); length = sizeof(FM_DecompressFileCmd_t); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false); - UT_SetDefaultReturnValue(UT_KEY(FM_DecompressFileCmd), true); + UT_SetDefaultReturnValue(UT_KEY(FM_DecompressFileCmd), CFE_SUCCESS); /* Act */ UtAssert_VOIDCALL(FM_ProcessCmd(NULL)); @@ -239,7 +241,7 @@ void Test_FM_ProcessCmd_ConcatFilesCCReturn(void) UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &fcn_code, sizeof(fcn_code), false); length = sizeof(FM_ConcatFilesCmd_t); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false); - UT_SetDefaultReturnValue(UT_KEY(FM_ConcatFilesCmd), true); + UT_SetDefaultReturnValue(UT_KEY(FM_ConcatFilesCmd), CFE_SUCCESS); /* Act */ UtAssert_VOIDCALL(FM_ProcessCmd(NULL)); @@ -261,7 +263,7 @@ void Test_FM_ProcessCmd_GetFileInfoCCReturn(void) UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &fcn_code, sizeof(fcn_code), false); length = sizeof(FM_GetFileInfoCmd_t); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false); - UT_SetDefaultReturnValue(UT_KEY(FM_GetFileInfoCmd), true); + UT_SetDefaultReturnValue(UT_KEY(FM_GetFileInfoCmd), CFE_SUCCESS); /* Act */ UtAssert_VOIDCALL(FM_ProcessCmd(NULL)); @@ -283,7 +285,7 @@ void Test_FM_ProcessCmd_GetOpenFilesCCReturn(void) UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &fcn_code, sizeof(fcn_code), false); length = sizeof(FM_GetOpenFilesCmd_t); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false); - UT_SetDefaultReturnValue(UT_KEY(FM_GetOpenFilesCmd), true); + UT_SetDefaultReturnValue(UT_KEY(FM_GetOpenFilesCmd), CFE_SUCCESS); /* Act */ UtAssert_VOIDCALL(FM_ProcessCmd(NULL)); @@ -305,7 +307,7 @@ void Test_FM_ProcessCmd_CreateDirectoryCCReturn(void) UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &fcn_code, sizeof(fcn_code), false); length = sizeof(FM_CreateDirectoryCmd_t); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false); - UT_SetDefaultReturnValue(UT_KEY(FM_CreateDirectoryCmd), true); + UT_SetDefaultReturnValue(UT_KEY(FM_CreateDirectoryCmd), CFE_SUCCESS); /* Act */ UtAssert_VOIDCALL(FM_ProcessCmd(NULL)); @@ -327,7 +329,7 @@ void Test_FM_ProcessCmd_DeleteDirectoryCCReturn(void) UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &fcn_code, sizeof(fcn_code), false); length = sizeof(FM_DeleteDirectoryCmd_t); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false); - UT_SetDefaultReturnValue(UT_KEY(FM_DeleteDirectoryCmd), true); + UT_SetDefaultReturnValue(UT_KEY(FM_DeleteDirectoryCmd), CFE_SUCCESS); /* Act */ UtAssert_VOIDCALL(FM_ProcessCmd(NULL)); @@ -349,7 +351,7 @@ void Test_FM_ProcessCmd_GetDirListFileCCReturn(void) UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &fcn_code, sizeof(fcn_code), false); length = sizeof(FM_GetDirListFileCmd_t); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false); - UT_SetDefaultReturnValue(UT_KEY(FM_GetDirListFileCmd), true); + UT_SetDefaultReturnValue(UT_KEY(FM_GetDirListFileCmd), CFE_SUCCESS); /* Act */ UtAssert_VOIDCALL(FM_ProcessCmd(NULL)); @@ -371,7 +373,7 @@ void Test_FM_ProcessCmd_GetDirListPktCCReturn(void) UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &fcn_code, sizeof(fcn_code), false); length = sizeof(FM_GetDirListPktCmd_t); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false); - UT_SetDefaultReturnValue(UT_KEY(FM_GetDirListPktCmd), true); + UT_SetDefaultReturnValue(UT_KEY(FM_GetDirListPktCmd), CFE_SUCCESS); /* Act */ UtAssert_VOIDCALL(FM_ProcessCmd(NULL)); @@ -393,7 +395,7 @@ void Test_FM_ProcessCmd_MonitorFilesystemSpaceCCReturn(void) UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &fcn_code, sizeof(fcn_code), false); length = sizeof(FM_MonitorFilesystemSpaceCmd_t); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false); - UT_SetDefaultReturnValue(UT_KEY(FM_MonitorFilesystemSpaceCmd), true); + UT_SetDefaultReturnValue(UT_KEY(FM_MonitorFilesystemSpaceCmd), CFE_SUCCESS); /* Act */ UtAssert_VOIDCALL(FM_ProcessCmd(NULL)); @@ -415,7 +417,7 @@ void Test_FM_ProcessCmd_SetTableStateCCReturn(void) UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &fcn_code, sizeof(fcn_code), false); length = sizeof(FM_SetTableStateCmd_t); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false); - UT_SetDefaultReturnValue(UT_KEY(FM_SetTableStateCmd), true); + UT_SetDefaultReturnValue(UT_KEY(FM_SetTableStateCmd), CFE_SUCCESS); /* Act */ UtAssert_VOIDCALL(FM_ProcessCmd(NULL)); @@ -437,7 +439,7 @@ void Test_FM_ProcessCmd_SetPermissionsCCReturn(void) UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &fcn_code, sizeof(fcn_code), false); length = sizeof(FM_SetPermissionsCmd_t); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false); - UT_SetDefaultReturnValue(UT_KEY(FM_SetPermissionsCmd), true); + UT_SetDefaultReturnValue(UT_KEY(FM_SetPermissionsCmd), CFE_SUCCESS); /* Act */ UtAssert_VOIDCALL(FM_ProcessCmd(NULL)); @@ -632,270 +634,270 @@ void Test_FM_NoopVerifyDispatch(void) { size_t length; - UT_SetDefaultReturnValue(UT_KEY(FM_NoopCmd), true); + UT_SetDefaultReturnValue(UT_KEY(FM_NoopCmd), FM_UT_CMD_STATUS_CHECK); length = 1; /* bad size for any message */ UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false); - UtAssert_BOOL_FALSE(FM_NoopVerifyDispatch(&UT_CmdBuf.Buf)); + UtAssert_INT32_EQ(FM_NoopVerifyDispatch(&UT_CmdBuf.Buf), CFE_STATUS_WRONG_MSG_LENGTH); length = sizeof(FM_NoopCmd_t); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false); - UtAssert_BOOL_TRUE(FM_NoopVerifyDispatch(&UT_CmdBuf.Buf)); + UtAssert_INT32_EQ(FM_NoopVerifyDispatch(&UT_CmdBuf.Buf), FM_UT_CMD_STATUS_CHECK); } void Test_FM_ResetCountersVerifyDispatch(void) { size_t length; - UT_SetDefaultReturnValue(UT_KEY(FM_ResetCountersCmd), true); + UT_SetDefaultReturnValue(UT_KEY(FM_ResetCountersCmd), FM_UT_CMD_STATUS_CHECK); length = 1; /* bad size for any message */ UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false); - UtAssert_BOOL_FALSE(FM_ResetCountersVerifyDispatch(&UT_CmdBuf.Buf)); + UtAssert_INT32_EQ(FM_ResetCountersVerifyDispatch(&UT_CmdBuf.Buf), CFE_STATUS_WRONG_MSG_LENGTH); length = sizeof(FM_ResetCountersCmd_t); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false); - UtAssert_BOOL_TRUE(FM_ResetCountersVerifyDispatch(&UT_CmdBuf.Buf)); + UtAssert_INT32_EQ(FM_ResetCountersVerifyDispatch(&UT_CmdBuf.Buf), FM_UT_CMD_STATUS_CHECK); } void Test_FM_CopyFileVerifyDispatch(void) { size_t length; - UT_SetDefaultReturnValue(UT_KEY(FM_CopyFileCmd), true); + UT_SetDefaultReturnValue(UT_KEY(FM_CopyFileCmd), FM_UT_CMD_STATUS_CHECK); length = 1; /* bad size for any message */ UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false); - UtAssert_BOOL_FALSE(FM_CopyFileVerifyDispatch(&UT_CmdBuf.Buf)); + UtAssert_INT32_EQ(FM_CopyFileVerifyDispatch(&UT_CmdBuf.Buf), CFE_STATUS_WRONG_MSG_LENGTH); length = sizeof(FM_CopyFileCmd_t); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false); - UtAssert_BOOL_TRUE(FM_CopyFileVerifyDispatch(&UT_CmdBuf.Buf)); + UtAssert_INT32_EQ(FM_CopyFileVerifyDispatch(&UT_CmdBuf.Buf), FM_UT_CMD_STATUS_CHECK); } void Test_FM_MoveFileVerifyDispatch(void) { size_t length; - UT_SetDefaultReturnValue(UT_KEY(FM_MoveFileCmd), true); + UT_SetDefaultReturnValue(UT_KEY(FM_MoveFileCmd), FM_UT_CMD_STATUS_CHECK); length = 1; /* bad size for any message */ UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false); - UtAssert_BOOL_FALSE(FM_MoveFileVerifyDispatch(&UT_CmdBuf.Buf)); + UtAssert_INT32_EQ(FM_MoveFileVerifyDispatch(&UT_CmdBuf.Buf), CFE_STATUS_WRONG_MSG_LENGTH); length = sizeof(FM_MoveFileCmd_t); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false); - UtAssert_BOOL_TRUE(FM_MoveFileVerifyDispatch(&UT_CmdBuf.Buf)); + UtAssert_INT32_EQ(FM_MoveFileVerifyDispatch(&UT_CmdBuf.Buf), FM_UT_CMD_STATUS_CHECK); } void Test_FM_RenameFileVerifyDispatch(void) { size_t length; - UT_SetDefaultReturnValue(UT_KEY(FM_RenameFileCmd), true); + UT_SetDefaultReturnValue(UT_KEY(FM_RenameFileCmd), FM_UT_CMD_STATUS_CHECK); length = 1; /* bad size for any message */ UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false); - UtAssert_BOOL_FALSE(FM_RenameFileVerifyDispatch(&UT_CmdBuf.Buf)); + UtAssert_INT32_EQ(FM_RenameFileVerifyDispatch(&UT_CmdBuf.Buf), CFE_STATUS_WRONG_MSG_LENGTH); length = sizeof(FM_RenameFileCmd_t); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false); - UtAssert_BOOL_TRUE(FM_RenameFileVerifyDispatch(&UT_CmdBuf.Buf)); + UtAssert_INT32_EQ(FM_RenameFileVerifyDispatch(&UT_CmdBuf.Buf), FM_UT_CMD_STATUS_CHECK); } void Test_FM_DeleteFileVerifyDispatch(void) { size_t length; - UT_SetDefaultReturnValue(UT_KEY(FM_DeleteFileCmd), true); + UT_SetDefaultReturnValue(UT_KEY(FM_DeleteFileCmd), FM_UT_CMD_STATUS_CHECK); length = 1; /* bad size for any message */ UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false); - UtAssert_BOOL_FALSE(FM_DeleteFileVerifyDispatch(&UT_CmdBuf.Buf)); + UtAssert_INT32_EQ(FM_DeleteFileVerifyDispatch(&UT_CmdBuf.Buf), CFE_STATUS_WRONG_MSG_LENGTH); length = sizeof(FM_DeleteFileCmd_t); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false); - UtAssert_BOOL_TRUE(FM_DeleteFileVerifyDispatch(&UT_CmdBuf.Buf)); + UtAssert_INT32_EQ(FM_DeleteFileVerifyDispatch(&UT_CmdBuf.Buf), FM_UT_CMD_STATUS_CHECK); } void Test_FM_DeleteAllFilesVerifyDispatch(void) { size_t length; - UT_SetDefaultReturnValue(UT_KEY(FM_DeleteAllFilesCmd), true); + UT_SetDefaultReturnValue(UT_KEY(FM_DeleteAllFilesCmd), FM_UT_CMD_STATUS_CHECK); length = 1; /* bad size for any message */ UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false); - UtAssert_BOOL_FALSE(FM_DeleteAllFilesVerifyDispatch(&UT_CmdBuf.Buf)); + UtAssert_INT32_EQ(FM_DeleteAllFilesVerifyDispatch(&UT_CmdBuf.Buf), CFE_STATUS_WRONG_MSG_LENGTH); length = sizeof(FM_DeleteAllFilesCmd_t); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false); - UtAssert_BOOL_TRUE(FM_DeleteAllFilesVerifyDispatch(&UT_CmdBuf.Buf)); + UtAssert_INT32_EQ(FM_DeleteAllFilesVerifyDispatch(&UT_CmdBuf.Buf), FM_UT_CMD_STATUS_CHECK); } void Test_FM_DecompressFileVerifyDispatch(void) { size_t length; - UT_SetDefaultReturnValue(UT_KEY(FM_DecompressFileCmd), true); + UT_SetDefaultReturnValue(UT_KEY(FM_DecompressFileCmd), FM_UT_CMD_STATUS_CHECK); length = 1; /* bad size for any message */ UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false); - UtAssert_BOOL_FALSE(FM_DecompressFileVerifyDispatch(&UT_CmdBuf.Buf)); + UtAssert_INT32_EQ(FM_DecompressFileVerifyDispatch(&UT_CmdBuf.Buf), CFE_STATUS_WRONG_MSG_LENGTH); length = sizeof(FM_DecompressFileCmd_t); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false); - UtAssert_BOOL_TRUE(FM_DecompressFileVerifyDispatch(&UT_CmdBuf.Buf)); + UtAssert_INT32_EQ(FM_DecompressFileVerifyDispatch(&UT_CmdBuf.Buf), FM_UT_CMD_STATUS_CHECK); } void Test_FM_ConcatFilesVerifyDispatch(void) { size_t length; - UT_SetDefaultReturnValue(UT_KEY(FM_ConcatFilesCmd), true); + UT_SetDefaultReturnValue(UT_KEY(FM_ConcatFilesCmd), FM_UT_CMD_STATUS_CHECK); length = 1; /* bad size for any message */ UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false); - UtAssert_BOOL_FALSE(FM_ConcatFilesVerifyDispatch(&UT_CmdBuf.Buf)); + UtAssert_INT32_EQ(FM_ConcatFilesVerifyDispatch(&UT_CmdBuf.Buf), CFE_STATUS_WRONG_MSG_LENGTH); length = sizeof(FM_ConcatFilesCmd_t); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false); - UtAssert_BOOL_TRUE(FM_ConcatFilesVerifyDispatch(&UT_CmdBuf.Buf)); + UtAssert_INT32_EQ(FM_ConcatFilesVerifyDispatch(&UT_CmdBuf.Buf), FM_UT_CMD_STATUS_CHECK); } void Test_FM_GetFileInfoVerifyDispatch(void) { size_t length; - UT_SetDefaultReturnValue(UT_KEY(FM_GetFileInfoCmd), true); + UT_SetDefaultReturnValue(UT_KEY(FM_GetFileInfoCmd), FM_UT_CMD_STATUS_CHECK); length = 1; /* bad size for any message */ UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false); - UtAssert_BOOL_FALSE(FM_GetFileInfoVerifyDispatch(&UT_CmdBuf.Buf)); + UtAssert_INT32_EQ(FM_GetFileInfoVerifyDispatch(&UT_CmdBuf.Buf), CFE_STATUS_WRONG_MSG_LENGTH); length = sizeof(FM_GetFileInfoCmd_t); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false); - UtAssert_BOOL_TRUE(FM_GetFileInfoVerifyDispatch(&UT_CmdBuf.Buf)); + UtAssert_INT32_EQ(FM_GetFileInfoVerifyDispatch(&UT_CmdBuf.Buf), FM_UT_CMD_STATUS_CHECK); } void Test_FM_GetOpenFilesVerifyDispatch(void) { size_t length; - UT_SetDefaultReturnValue(UT_KEY(FM_GetOpenFilesCmd), true); + UT_SetDefaultReturnValue(UT_KEY(FM_GetOpenFilesCmd), FM_UT_CMD_STATUS_CHECK); length = 1; /* bad size for any message */ UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false); - UtAssert_BOOL_FALSE(FM_GetOpenFilesVerifyDispatch(&UT_CmdBuf.Buf)); + UtAssert_INT32_EQ(FM_GetOpenFilesVerifyDispatch(&UT_CmdBuf.Buf), CFE_STATUS_WRONG_MSG_LENGTH); length = sizeof(FM_GetOpenFilesCmd_t); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false); - UtAssert_BOOL_TRUE(FM_GetOpenFilesVerifyDispatch(&UT_CmdBuf.Buf)); + UtAssert_INT32_EQ(FM_GetOpenFilesVerifyDispatch(&UT_CmdBuf.Buf), FM_UT_CMD_STATUS_CHECK); } void Test_FM_CreateDirectoryVerifyDispatch(void) { size_t length; - UT_SetDefaultReturnValue(UT_KEY(FM_CreateDirectoryCmd), true); + UT_SetDefaultReturnValue(UT_KEY(FM_CreateDirectoryCmd), FM_UT_CMD_STATUS_CHECK); length = 1; /* bad size for any message */ UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false); - UtAssert_BOOL_FALSE(FM_CreateDirectoryVerifyDispatch(&UT_CmdBuf.Buf)); + UtAssert_INT32_EQ(FM_CreateDirectoryVerifyDispatch(&UT_CmdBuf.Buf), CFE_STATUS_WRONG_MSG_LENGTH); length = sizeof(FM_CreateDirectoryCmd_t); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false); - UtAssert_BOOL_TRUE(FM_CreateDirectoryVerifyDispatch(&UT_CmdBuf.Buf)); + UtAssert_INT32_EQ(FM_CreateDirectoryVerifyDispatch(&UT_CmdBuf.Buf), FM_UT_CMD_STATUS_CHECK); } void Test_FM_DeleteDirectoryVerifyDispatch(void) { size_t length; - UT_SetDefaultReturnValue(UT_KEY(FM_DeleteDirectoryCmd), true); + UT_SetDefaultReturnValue(UT_KEY(FM_DeleteDirectoryCmd), FM_UT_CMD_STATUS_CHECK); length = 1; /* bad size for any message */ UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false); - UtAssert_BOOL_FALSE(FM_DeleteDirectoryVerifyDispatch(&UT_CmdBuf.Buf)); + UtAssert_INT32_EQ(FM_DeleteDirectoryVerifyDispatch(&UT_CmdBuf.Buf), CFE_STATUS_WRONG_MSG_LENGTH); length = sizeof(FM_DeleteDirectoryCmd_t); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false); - UtAssert_BOOL_TRUE(FM_DeleteDirectoryVerifyDispatch(&UT_CmdBuf.Buf)); + UtAssert_INT32_EQ(FM_DeleteDirectoryVerifyDispatch(&UT_CmdBuf.Buf), FM_UT_CMD_STATUS_CHECK); } void Test_FM_GetDirListFileVerifyDispatch(void) { size_t length; - UT_SetDefaultReturnValue(UT_KEY(FM_GetDirListFileCmd), true); + UT_SetDefaultReturnValue(UT_KEY(FM_GetDirListFileCmd), FM_UT_CMD_STATUS_CHECK); length = 1; /* bad size for any message */ UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false); - UtAssert_BOOL_FALSE(FM_GetDirListFileVerifyDispatch(&UT_CmdBuf.Buf)); + UtAssert_INT32_EQ(FM_GetDirListFileVerifyDispatch(&UT_CmdBuf.Buf), CFE_STATUS_WRONG_MSG_LENGTH); length = sizeof(FM_GetDirListFileCmd_t); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false); - UtAssert_BOOL_TRUE(FM_GetDirListFileVerifyDispatch(&UT_CmdBuf.Buf)); + UtAssert_INT32_EQ(FM_GetDirListFileVerifyDispatch(&UT_CmdBuf.Buf), FM_UT_CMD_STATUS_CHECK); } void Test_FM_GetDirListPktVerifyDispatch(void) { size_t length; - UT_SetDefaultReturnValue(UT_KEY(FM_GetDirListPktCmd), true); + UT_SetDefaultReturnValue(UT_KEY(FM_GetDirListPktCmd), FM_UT_CMD_STATUS_CHECK); length = 1; /* bad size for any message */ UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false); - UtAssert_BOOL_FALSE(FM_GetDirListPktVerifyDispatch(&UT_CmdBuf.Buf)); + UtAssert_INT32_EQ(FM_GetDirListPktVerifyDispatch(&UT_CmdBuf.Buf), CFE_STATUS_WRONG_MSG_LENGTH); length = sizeof(FM_GetDirListPktCmd_t); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false); - UtAssert_BOOL_TRUE(FM_GetDirListPktVerifyDispatch(&UT_CmdBuf.Buf)); + UtAssert_INT32_EQ(FM_GetDirListPktVerifyDispatch(&UT_CmdBuf.Buf), FM_UT_CMD_STATUS_CHECK); } void Test_FM_MonitorFilesystemSpaceVerifyDispatch(void) { size_t length; - UT_SetDefaultReturnValue(UT_KEY(FM_MonitorFilesystemSpaceCmd), true); + UT_SetDefaultReturnValue(UT_KEY(FM_MonitorFilesystemSpaceCmd), FM_UT_CMD_STATUS_CHECK); length = 1; /* bad size for any message */ UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false); - UtAssert_BOOL_FALSE(FM_MonitorFilesystemSpaceVerifyDispatch(&UT_CmdBuf.Buf)); + UtAssert_INT32_EQ(FM_MonitorFilesystemSpaceVerifyDispatch(&UT_CmdBuf.Buf), CFE_STATUS_WRONG_MSG_LENGTH); length = sizeof(FM_MonitorFilesystemSpaceCmd_t); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false); - UtAssert_BOOL_TRUE(FM_MonitorFilesystemSpaceVerifyDispatch(&UT_CmdBuf.Buf)); + UtAssert_INT32_EQ(FM_MonitorFilesystemSpaceVerifyDispatch(&UT_CmdBuf.Buf), FM_UT_CMD_STATUS_CHECK); } void Test_FM_SetTableStateVerifyDispatch(void) { size_t length; - UT_SetDefaultReturnValue(UT_KEY(FM_SetTableStateCmd), true); + UT_SetDefaultReturnValue(UT_KEY(FM_SetTableStateCmd), FM_UT_CMD_STATUS_CHECK); length = 1; /* bad size for any message */ UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false); - UtAssert_BOOL_FALSE(FM_SetTableStateVerifyDispatch(&UT_CmdBuf.Buf)); + UtAssert_INT32_EQ(FM_SetTableStateVerifyDispatch(&UT_CmdBuf.Buf), CFE_STATUS_WRONG_MSG_LENGTH); length = sizeof(FM_SetTableStateCmd_t); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false); - UtAssert_BOOL_TRUE(FM_SetTableStateVerifyDispatch(&UT_CmdBuf.Buf)); + UtAssert_INT32_EQ(FM_SetTableStateVerifyDispatch(&UT_CmdBuf.Buf), FM_UT_CMD_STATUS_CHECK); } void Test_FM_SetPermissionsVerifyDispatch(void) { size_t length; - UT_SetDefaultReturnValue(UT_KEY(FM_SetPermissionsCmd), true); + UT_SetDefaultReturnValue(UT_KEY(FM_SetPermissionsCmd), FM_UT_CMD_STATUS_CHECK); length = 1; /* bad size for any message */ UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false); - UtAssert_BOOL_FALSE(FM_SetPermissionsVerifyDispatch(&UT_CmdBuf.Buf)); + UtAssert_INT32_EQ(FM_SetPermissionsVerifyDispatch(&UT_CmdBuf.Buf), CFE_STATUS_WRONG_MSG_LENGTH); length = sizeof(FM_SetPermissionsCmd_t); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false); - UtAssert_BOOL_TRUE(FM_SetPermissionsVerifyDispatch(&UT_CmdBuf.Buf)); + UtAssert_INT32_EQ(FM_SetPermissionsVerifyDispatch(&UT_CmdBuf.Buf), FM_UT_CMD_STATUS_CHECK); } void Test_FM_SendHkVerifyDispatch(void) diff --git a/unit-test/stubs/fm_app_stubs.c b/unit-test/stubs/fm_app_stubs.c index a0eff3a..b88ad20 100644 --- a/unit-test/stubs/fm_app_stubs.c +++ b/unit-test/stubs/fm_app_stubs.c @@ -56,9 +56,13 @@ void FM_AppMain(void) * Generated stub function for FM_SendHkCmd() * ---------------------------------------------------- */ -void FM_SendHkCmd(const CFE_SB_Buffer_t *BufPtr) +CFE_Status_t FM_SendHkCmd(const FM_SendHkCmd_t *MsgPtr) { - UT_GenStub_AddParam(FM_SendHkCmd, const CFE_SB_Buffer_t *, BufPtr); + UT_GenStub_SetupReturnBuffer(FM_SendHkCmd, CFE_Status_t); + + UT_GenStub_AddParam(FM_SendHkCmd, const FM_SendHkCmd_t *, MsgPtr); UT_GenStub_Execute(FM_SendHkCmd, Basic, NULL); + + return UT_GenStub_GetReturnValue(FM_SendHkCmd, CFE_Status_t); } diff --git a/unit-test/stubs/fm_cmd_utils_stubs.c b/unit-test/stubs/fm_cmd_utils_stubs.c index 6763c38..6b74849 100644 --- a/unit-test/stubs/fm_cmd_utils_stubs.c +++ b/unit-test/stubs/fm_cmd_utils_stubs.c @@ -77,7 +77,7 @@ uint32 FM_GetFilenameState(const char *Filename, size_t BufferSize, bool FileInf UT_GenStub_SetupReturnBuffer(FM_GetFilenameState, uint32); UT_GenStub_AddParam(FM_GetFilenameState, const char *, Filename); - UT_GenStub_AddParam(FM_GetFilenameState, uint32, BufferSize); + UT_GenStub_AddParam(FM_GetFilenameState, size_t, BufferSize); UT_GenStub_AddParam(FM_GetFilenameState, bool, FileInfoCmd); UT_GenStub_Execute(FM_GetFilenameState, Basic, NULL); @@ -157,7 +157,7 @@ bool FM_VerifyDirExists(const char *Directory, size_t BufferSize, uint32 EventID UT_GenStub_SetupReturnBuffer(FM_VerifyDirExists, bool); UT_GenStub_AddParam(FM_VerifyDirExists, const char *, Directory); - UT_GenStub_AddParam(FM_VerifyDirExists, uint32, BufferSize); + UT_GenStub_AddParam(FM_VerifyDirExists, size_t, BufferSize); UT_GenStub_AddParam(FM_VerifyDirExists, uint32, EventID); UT_GenStub_AddParam(FM_VerifyDirExists, const char *, CmdText); @@ -176,7 +176,7 @@ bool FM_VerifyDirNoExist(const char *Name, size_t BufferSize, uint32 EventID, co UT_GenStub_SetupReturnBuffer(FM_VerifyDirNoExist, bool); UT_GenStub_AddParam(FM_VerifyDirNoExist, const char *, Name); - UT_GenStub_AddParam(FM_VerifyDirNoExist, uint32, BufferSize); + UT_GenStub_AddParam(FM_VerifyDirNoExist, size_t, BufferSize); UT_GenStub_AddParam(FM_VerifyDirNoExist, uint32, EventID); UT_GenStub_AddParam(FM_VerifyDirNoExist, const char *, CmdText); @@ -195,7 +195,7 @@ bool FM_VerifyFileClosed(const char *Filename, size_t BufferSize, uint32 EventID UT_GenStub_SetupReturnBuffer(FM_VerifyFileClosed, bool); UT_GenStub_AddParam(FM_VerifyFileClosed, const char *, Filename); - UT_GenStub_AddParam(FM_VerifyFileClosed, uint32, BufferSize); + UT_GenStub_AddParam(FM_VerifyFileClosed, size_t, BufferSize); UT_GenStub_AddParam(FM_VerifyFileClosed, uint32, EventID); UT_GenStub_AddParam(FM_VerifyFileClosed, const char *, CmdText); @@ -214,7 +214,7 @@ bool FM_VerifyFileExists(const char *Filename, size_t BufferSize, uint32 EventID UT_GenStub_SetupReturnBuffer(FM_VerifyFileExists, bool); UT_GenStub_AddParam(FM_VerifyFileExists, const char *, Filename); - UT_GenStub_AddParam(FM_VerifyFileExists, uint32, BufferSize); + UT_GenStub_AddParam(FM_VerifyFileExists, size_t, BufferSize); UT_GenStub_AddParam(FM_VerifyFileExists, uint32, EventID); UT_GenStub_AddParam(FM_VerifyFileExists, const char *, CmdText); @@ -233,7 +233,7 @@ bool FM_VerifyFileNoExist(const char *Filename, size_t BufferSize, uint32 EventI UT_GenStub_SetupReturnBuffer(FM_VerifyFileNoExist, bool); UT_GenStub_AddParam(FM_VerifyFileNoExist, const char *, Filename); - UT_GenStub_AddParam(FM_VerifyFileNoExist, uint32, BufferSize); + UT_GenStub_AddParam(FM_VerifyFileNoExist, size_t, BufferSize); UT_GenStub_AddParam(FM_VerifyFileNoExist, uint32, EventID); UT_GenStub_AddParam(FM_VerifyFileNoExist, const char *, CmdText); @@ -252,7 +252,7 @@ bool FM_VerifyFileNotOpen(const char *Filename, size_t BufferSize, uint32 EventI UT_GenStub_SetupReturnBuffer(FM_VerifyFileNotOpen, bool); UT_GenStub_AddParam(FM_VerifyFileNotOpen, const char *, Filename); - UT_GenStub_AddParam(FM_VerifyFileNotOpen, uint32, BufferSize); + UT_GenStub_AddParam(FM_VerifyFileNotOpen, size_t, BufferSize); UT_GenStub_AddParam(FM_VerifyFileNotOpen, uint32, EventID); UT_GenStub_AddParam(FM_VerifyFileNotOpen, const char *, CmdText); @@ -273,7 +273,7 @@ bool FM_VerifyFileState(FM_File_States State, const char *Filename, size_t Buffe UT_GenStub_AddParam(FM_VerifyFileState, FM_File_States, State); UT_GenStub_AddParam(FM_VerifyFileState, const char *, Filename); - UT_GenStub_AddParam(FM_VerifyFileState, uint32, BufferSize); + UT_GenStub_AddParam(FM_VerifyFileState, size_t, BufferSize); UT_GenStub_AddParam(FM_VerifyFileState, uint32, EventID); UT_GenStub_AddParam(FM_VerifyFileState, const char *, CmdText); @@ -292,7 +292,7 @@ uint32 FM_VerifyNameValid(const char *Name, size_t BufferSize, uint32 EventID, c UT_GenStub_SetupReturnBuffer(FM_VerifyNameValid, uint32); UT_GenStub_AddParam(FM_VerifyNameValid, const char *, Name); - UT_GenStub_AddParam(FM_VerifyNameValid, uint32, BufferSize); + UT_GenStub_AddParam(FM_VerifyNameValid, size_t, BufferSize); UT_GenStub_AddParam(FM_VerifyNameValid, uint32, EventID); UT_GenStub_AddParam(FM_VerifyNameValid, const char *, CmdText); diff --git a/unit-test/stubs/fm_cmds_stubs.c b/unit-test/stubs/fm_cmds_stubs.c index 1699822..14d3758 100644 --- a/unit-test/stubs/fm_cmds_stubs.c +++ b/unit-test/stubs/fm_cmds_stubs.c @@ -31,15 +31,15 @@ * Generated stub function for FM_ConcatFilesCmd() * ---------------------------------------------------- */ -bool FM_ConcatFilesCmd(const CFE_SB_Buffer_t *BufPtr) +CFE_Status_t FM_ConcatFilesCmd(const FM_ConcatFilesCmd_t *MsgPtr) { - UT_GenStub_SetupReturnBuffer(FM_ConcatFilesCmd, bool); + UT_GenStub_SetupReturnBuffer(FM_ConcatFilesCmd, CFE_Status_t); - UT_GenStub_AddParam(FM_ConcatFilesCmd, const CFE_SB_Buffer_t *, BufPtr); + UT_GenStub_AddParam(FM_ConcatFilesCmd, const FM_ConcatFilesCmd_t *, MsgPtr); UT_GenStub_Execute(FM_ConcatFilesCmd, Basic, NULL); - return UT_GenStub_GetReturnValue(FM_ConcatFilesCmd, bool); + return UT_GenStub_GetReturnValue(FM_ConcatFilesCmd, CFE_Status_t); } /* @@ -47,15 +47,15 @@ bool FM_ConcatFilesCmd(const CFE_SB_Buffer_t *BufPtr) * Generated stub function for FM_CopyFileCmd() * ---------------------------------------------------- */ -bool FM_CopyFileCmd(const CFE_SB_Buffer_t *BufPtr) +CFE_Status_t FM_CopyFileCmd(const FM_CopyFileCmd_t *MsgPtr) { - UT_GenStub_SetupReturnBuffer(FM_CopyFileCmd, bool); + UT_GenStub_SetupReturnBuffer(FM_CopyFileCmd, CFE_Status_t); - UT_GenStub_AddParam(FM_CopyFileCmd, const CFE_SB_Buffer_t *, BufPtr); + UT_GenStub_AddParam(FM_CopyFileCmd, const FM_CopyFileCmd_t *, MsgPtr); UT_GenStub_Execute(FM_CopyFileCmd, Basic, NULL); - return UT_GenStub_GetReturnValue(FM_CopyFileCmd, bool); + return UT_GenStub_GetReturnValue(FM_CopyFileCmd, CFE_Status_t); } /* @@ -63,15 +63,15 @@ bool FM_CopyFileCmd(const CFE_SB_Buffer_t *BufPtr) * Generated stub function for FM_CreateDirectoryCmd() * ---------------------------------------------------- */ -bool FM_CreateDirectoryCmd(const CFE_SB_Buffer_t *BufPtr) +CFE_Status_t FM_CreateDirectoryCmd(const FM_CreateDirectoryCmd_t *MsgPtr) { - UT_GenStub_SetupReturnBuffer(FM_CreateDirectoryCmd, bool); + UT_GenStub_SetupReturnBuffer(FM_CreateDirectoryCmd, CFE_Status_t); - UT_GenStub_AddParam(FM_CreateDirectoryCmd, const CFE_SB_Buffer_t *, BufPtr); + UT_GenStub_AddParam(FM_CreateDirectoryCmd, const FM_CreateDirectoryCmd_t *, MsgPtr); UT_GenStub_Execute(FM_CreateDirectoryCmd, Basic, NULL); - return UT_GenStub_GetReturnValue(FM_CreateDirectoryCmd, bool); + return UT_GenStub_GetReturnValue(FM_CreateDirectoryCmd, CFE_Status_t); } /* @@ -79,15 +79,15 @@ bool FM_CreateDirectoryCmd(const CFE_SB_Buffer_t *BufPtr) * Generated stub function for FM_DecompressFileCmd() * ---------------------------------------------------- */ -bool FM_DecompressFileCmd(const CFE_SB_Buffer_t *BufPtr) +CFE_Status_t FM_DecompressFileCmd(const FM_DecompressFileCmd_t *MsgPtr) { - UT_GenStub_SetupReturnBuffer(FM_DecompressFileCmd, bool); + UT_GenStub_SetupReturnBuffer(FM_DecompressFileCmd, CFE_Status_t); - UT_GenStub_AddParam(FM_DecompressFileCmd, const CFE_SB_Buffer_t *, BufPtr); + UT_GenStub_AddParam(FM_DecompressFileCmd, const FM_DecompressFileCmd_t *, MsgPtr); UT_GenStub_Execute(FM_DecompressFileCmd, Basic, NULL); - return UT_GenStub_GetReturnValue(FM_DecompressFileCmd, bool); + return UT_GenStub_GetReturnValue(FM_DecompressFileCmd, CFE_Status_t); } /* @@ -95,15 +95,15 @@ bool FM_DecompressFileCmd(const CFE_SB_Buffer_t *BufPtr) * Generated stub function for FM_DeleteAllFilesCmd() * ---------------------------------------------------- */ -bool FM_DeleteAllFilesCmd(const CFE_SB_Buffer_t *BufPtr) +CFE_Status_t FM_DeleteAllFilesCmd(const FM_DeleteAllFilesCmd_t *MsgPtr) { - UT_GenStub_SetupReturnBuffer(FM_DeleteAllFilesCmd, bool); + UT_GenStub_SetupReturnBuffer(FM_DeleteAllFilesCmd, CFE_Status_t); - UT_GenStub_AddParam(FM_DeleteAllFilesCmd, const CFE_SB_Buffer_t *, BufPtr); + UT_GenStub_AddParam(FM_DeleteAllFilesCmd, const FM_DeleteAllFilesCmd_t *, MsgPtr); UT_GenStub_Execute(FM_DeleteAllFilesCmd, Basic, NULL); - return UT_GenStub_GetReturnValue(FM_DeleteAllFilesCmd, bool); + return UT_GenStub_GetReturnValue(FM_DeleteAllFilesCmd, CFE_Status_t); } /* @@ -111,15 +111,15 @@ bool FM_DeleteAllFilesCmd(const CFE_SB_Buffer_t *BufPtr) * Generated stub function for FM_DeleteDirectoryCmd() * ---------------------------------------------------- */ -bool FM_DeleteDirectoryCmd(const CFE_SB_Buffer_t *BufPtr) +CFE_Status_t FM_DeleteDirectoryCmd(const FM_DeleteDirectoryCmd_t *MsgPtr) { - UT_GenStub_SetupReturnBuffer(FM_DeleteDirectoryCmd, bool); + UT_GenStub_SetupReturnBuffer(FM_DeleteDirectoryCmd, CFE_Status_t); - UT_GenStub_AddParam(FM_DeleteDirectoryCmd, const CFE_SB_Buffer_t *, BufPtr); + UT_GenStub_AddParam(FM_DeleteDirectoryCmd, const FM_DeleteDirectoryCmd_t *, MsgPtr); UT_GenStub_Execute(FM_DeleteDirectoryCmd, Basic, NULL); - return UT_GenStub_GetReturnValue(FM_DeleteDirectoryCmd, bool); + return UT_GenStub_GetReturnValue(FM_DeleteDirectoryCmd, CFE_Status_t); } /* @@ -127,15 +127,15 @@ bool FM_DeleteDirectoryCmd(const CFE_SB_Buffer_t *BufPtr) * Generated stub function for FM_DeleteFileCmd() * ---------------------------------------------------- */ -bool FM_DeleteFileCmd(const CFE_SB_Buffer_t *BufPtr) +CFE_Status_t FM_DeleteFileCmd(const FM_DeleteFileCmd_t *MsgPtr) { - UT_GenStub_SetupReturnBuffer(FM_DeleteFileCmd, bool); + UT_GenStub_SetupReturnBuffer(FM_DeleteFileCmd, CFE_Status_t); - UT_GenStub_AddParam(FM_DeleteFileCmd, const CFE_SB_Buffer_t *, BufPtr); + UT_GenStub_AddParam(FM_DeleteFileCmd, const FM_DeleteFileCmd_t *, MsgPtr); UT_GenStub_Execute(FM_DeleteFileCmd, Basic, NULL); - return UT_GenStub_GetReturnValue(FM_DeleteFileCmd, bool); + return UT_GenStub_GetReturnValue(FM_DeleteFileCmd, CFE_Status_t); } /* @@ -143,15 +143,15 @@ bool FM_DeleteFileCmd(const CFE_SB_Buffer_t *BufPtr) * Generated stub function for FM_GetDirListFileCmd() * ---------------------------------------------------- */ -bool FM_GetDirListFileCmd(const CFE_SB_Buffer_t *BufPtr) +CFE_Status_t FM_GetDirListFileCmd(const FM_GetDirListFileCmd_t *MsgPtr) { - UT_GenStub_SetupReturnBuffer(FM_GetDirListFileCmd, bool); + UT_GenStub_SetupReturnBuffer(FM_GetDirListFileCmd, CFE_Status_t); - UT_GenStub_AddParam(FM_GetDirListFileCmd, const CFE_SB_Buffer_t *, BufPtr); + UT_GenStub_AddParam(FM_GetDirListFileCmd, const FM_GetDirListFileCmd_t *, MsgPtr); UT_GenStub_Execute(FM_GetDirListFileCmd, Basic, NULL); - return UT_GenStub_GetReturnValue(FM_GetDirListFileCmd, bool); + return UT_GenStub_GetReturnValue(FM_GetDirListFileCmd, CFE_Status_t); } /* @@ -159,15 +159,15 @@ bool FM_GetDirListFileCmd(const CFE_SB_Buffer_t *BufPtr) * Generated stub function for FM_GetDirListPktCmd() * ---------------------------------------------------- */ -bool FM_GetDirListPktCmd(const CFE_SB_Buffer_t *BufPtr) +CFE_Status_t FM_GetDirListPktCmd(const FM_GetDirListPktCmd_t *MsgPtr) { - UT_GenStub_SetupReturnBuffer(FM_GetDirListPktCmd, bool); + UT_GenStub_SetupReturnBuffer(FM_GetDirListPktCmd, CFE_Status_t); - UT_GenStub_AddParam(FM_GetDirListPktCmd, const CFE_SB_Buffer_t *, BufPtr); + UT_GenStub_AddParam(FM_GetDirListPktCmd, const FM_GetDirListPktCmd_t *, MsgPtr); UT_GenStub_Execute(FM_GetDirListPktCmd, Basic, NULL); - return UT_GenStub_GetReturnValue(FM_GetDirListPktCmd, bool); + return UT_GenStub_GetReturnValue(FM_GetDirListPktCmd, CFE_Status_t); } /* @@ -175,15 +175,15 @@ bool FM_GetDirListPktCmd(const CFE_SB_Buffer_t *BufPtr) * Generated stub function for FM_GetFileInfoCmd() * ---------------------------------------------------- */ -bool FM_GetFileInfoCmd(const CFE_SB_Buffer_t *BufPtr) +CFE_Status_t FM_GetFileInfoCmd(const FM_GetFileInfoCmd_t *MsgPtr) { - UT_GenStub_SetupReturnBuffer(FM_GetFileInfoCmd, bool); + UT_GenStub_SetupReturnBuffer(FM_GetFileInfoCmd, CFE_Status_t); - UT_GenStub_AddParam(FM_GetFileInfoCmd, const CFE_SB_Buffer_t *, BufPtr); + UT_GenStub_AddParam(FM_GetFileInfoCmd, const FM_GetFileInfoCmd_t *, MsgPtr); UT_GenStub_Execute(FM_GetFileInfoCmd, Basic, NULL); - return UT_GenStub_GetReturnValue(FM_GetFileInfoCmd, bool); + return UT_GenStub_GetReturnValue(FM_GetFileInfoCmd, CFE_Status_t); } /* @@ -191,15 +191,15 @@ bool FM_GetFileInfoCmd(const CFE_SB_Buffer_t *BufPtr) * Generated stub function for FM_GetOpenFilesCmd() * ---------------------------------------------------- */ -bool FM_GetOpenFilesCmd(const CFE_SB_Buffer_t *BufPtr) +CFE_Status_t FM_GetOpenFilesCmd(const FM_GetOpenFilesCmd_t *MsgPtr) { - UT_GenStub_SetupReturnBuffer(FM_GetOpenFilesCmd, bool); + UT_GenStub_SetupReturnBuffer(FM_GetOpenFilesCmd, CFE_Status_t); - UT_GenStub_AddParam(FM_GetOpenFilesCmd, const CFE_SB_Buffer_t *, BufPtr); + UT_GenStub_AddParam(FM_GetOpenFilesCmd, const FM_GetOpenFilesCmd_t *, MsgPtr); UT_GenStub_Execute(FM_GetOpenFilesCmd, Basic, NULL); - return UT_GenStub_GetReturnValue(FM_GetOpenFilesCmd, bool); + return UT_GenStub_GetReturnValue(FM_GetOpenFilesCmd, CFE_Status_t); } /* @@ -207,15 +207,15 @@ bool FM_GetOpenFilesCmd(const CFE_SB_Buffer_t *BufPtr) * Generated stub function for FM_MonitorFilesystemSpaceCmd() * ---------------------------------------------------- */ -bool FM_MonitorFilesystemSpaceCmd(const CFE_SB_Buffer_t *BufPtr) +CFE_Status_t FM_MonitorFilesystemSpaceCmd(const FM_MonitorFilesystemSpaceCmd_t *MsgPtr) { - UT_GenStub_SetupReturnBuffer(FM_MonitorFilesystemSpaceCmd, bool); + UT_GenStub_SetupReturnBuffer(FM_MonitorFilesystemSpaceCmd, CFE_Status_t); - UT_GenStub_AddParam(FM_MonitorFilesystemSpaceCmd, const CFE_SB_Buffer_t *, BufPtr); + UT_GenStub_AddParam(FM_MonitorFilesystemSpaceCmd, const FM_MonitorFilesystemSpaceCmd_t *, MsgPtr); UT_GenStub_Execute(FM_MonitorFilesystemSpaceCmd, Basic, NULL); - return UT_GenStub_GetReturnValue(FM_MonitorFilesystemSpaceCmd, bool); + return UT_GenStub_GetReturnValue(FM_MonitorFilesystemSpaceCmd, CFE_Status_t); } /* @@ -223,15 +223,15 @@ bool FM_MonitorFilesystemSpaceCmd(const CFE_SB_Buffer_t *BufPtr) * Generated stub function for FM_MoveFileCmd() * ---------------------------------------------------- */ -bool FM_MoveFileCmd(const CFE_SB_Buffer_t *BufPtr) +CFE_Status_t FM_MoveFileCmd(const FM_MoveFileCmd_t *MsgPtr) { - UT_GenStub_SetupReturnBuffer(FM_MoveFileCmd, bool); + UT_GenStub_SetupReturnBuffer(FM_MoveFileCmd, CFE_Status_t); - UT_GenStub_AddParam(FM_MoveFileCmd, const CFE_SB_Buffer_t *, BufPtr); + UT_GenStub_AddParam(FM_MoveFileCmd, const FM_MoveFileCmd_t *, MsgPtr); UT_GenStub_Execute(FM_MoveFileCmd, Basic, NULL); - return UT_GenStub_GetReturnValue(FM_MoveFileCmd, bool); + return UT_GenStub_GetReturnValue(FM_MoveFileCmd, CFE_Status_t); } /* @@ -239,15 +239,15 @@ bool FM_MoveFileCmd(const CFE_SB_Buffer_t *BufPtr) * Generated stub function for FM_NoopCmd() * ---------------------------------------------------- */ -bool FM_NoopCmd(const CFE_SB_Buffer_t *BufPtr) +CFE_Status_t FM_NoopCmd(const FM_NoopCmd_t *MsgPtr) { - UT_GenStub_SetupReturnBuffer(FM_NoopCmd, bool); + UT_GenStub_SetupReturnBuffer(FM_NoopCmd, CFE_Status_t); - UT_GenStub_AddParam(FM_NoopCmd, const CFE_SB_Buffer_t *, BufPtr); + UT_GenStub_AddParam(FM_NoopCmd, const FM_NoopCmd_t *, MsgPtr); UT_GenStub_Execute(FM_NoopCmd, Basic, NULL); - return UT_GenStub_GetReturnValue(FM_NoopCmd, bool); + return UT_GenStub_GetReturnValue(FM_NoopCmd, CFE_Status_t); } /* @@ -255,15 +255,15 @@ bool FM_NoopCmd(const CFE_SB_Buffer_t *BufPtr) * Generated stub function for FM_RenameFileCmd() * ---------------------------------------------------- */ -bool FM_RenameFileCmd(const CFE_SB_Buffer_t *BufPtr) +CFE_Status_t FM_RenameFileCmd(const FM_RenameFileCmd_t *MsgPtr) { - UT_GenStub_SetupReturnBuffer(FM_RenameFileCmd, bool); + UT_GenStub_SetupReturnBuffer(FM_RenameFileCmd, CFE_Status_t); - UT_GenStub_AddParam(FM_RenameFileCmd, const CFE_SB_Buffer_t *, BufPtr); + UT_GenStub_AddParam(FM_RenameFileCmd, const FM_RenameFileCmd_t *, MsgPtr); UT_GenStub_Execute(FM_RenameFileCmd, Basic, NULL); - return UT_GenStub_GetReturnValue(FM_RenameFileCmd, bool); + return UT_GenStub_GetReturnValue(FM_RenameFileCmd, CFE_Status_t); } /* @@ -271,15 +271,15 @@ bool FM_RenameFileCmd(const CFE_SB_Buffer_t *BufPtr) * Generated stub function for FM_ResetCountersCmd() * ---------------------------------------------------- */ -bool FM_ResetCountersCmd(const CFE_SB_Buffer_t *BufPtr) +CFE_Status_t FM_ResetCountersCmd(const FM_ResetCountersCmd_t *MsgPtr) { - UT_GenStub_SetupReturnBuffer(FM_ResetCountersCmd, bool); + UT_GenStub_SetupReturnBuffer(FM_ResetCountersCmd, CFE_Status_t); - UT_GenStub_AddParam(FM_ResetCountersCmd, const CFE_SB_Buffer_t *, BufPtr); + UT_GenStub_AddParam(FM_ResetCountersCmd, const FM_ResetCountersCmd_t *, MsgPtr); UT_GenStub_Execute(FM_ResetCountersCmd, Basic, NULL); - return UT_GenStub_GetReturnValue(FM_ResetCountersCmd, bool); + return UT_GenStub_GetReturnValue(FM_ResetCountersCmd, CFE_Status_t); } /* @@ -287,15 +287,15 @@ bool FM_ResetCountersCmd(const CFE_SB_Buffer_t *BufPtr) * Generated stub function for FM_SetPermissionsCmd() * ---------------------------------------------------- */ -bool FM_SetPermissionsCmd(const CFE_SB_Buffer_t *BufPtr) +CFE_Status_t FM_SetPermissionsCmd(const FM_SetPermissionsCmd_t *MsgPtr) { - UT_GenStub_SetupReturnBuffer(FM_SetPermissionsCmd, bool); + UT_GenStub_SetupReturnBuffer(FM_SetPermissionsCmd, CFE_Status_t); - UT_GenStub_AddParam(FM_SetPermissionsCmd, const CFE_SB_Buffer_t *, BufPtr); + UT_GenStub_AddParam(FM_SetPermissionsCmd, const FM_SetPermissionsCmd_t *, MsgPtr); UT_GenStub_Execute(FM_SetPermissionsCmd, Basic, NULL); - return UT_GenStub_GetReturnValue(FM_SetPermissionsCmd, bool); + return UT_GenStub_GetReturnValue(FM_SetPermissionsCmd, CFE_Status_t); } /* @@ -303,13 +303,13 @@ bool FM_SetPermissionsCmd(const CFE_SB_Buffer_t *BufPtr) * Generated stub function for FM_SetTableStateCmd() * ---------------------------------------------------- */ -bool FM_SetTableStateCmd(const CFE_SB_Buffer_t *BufPtr) +CFE_Status_t FM_SetTableStateCmd(const FM_SetTableStateCmd_t *MsgPtr) { - UT_GenStub_SetupReturnBuffer(FM_SetTableStateCmd, bool); + UT_GenStub_SetupReturnBuffer(FM_SetTableStateCmd, CFE_Status_t); - UT_GenStub_AddParam(FM_SetTableStateCmd, const CFE_SB_Buffer_t *, BufPtr); + UT_GenStub_AddParam(FM_SetTableStateCmd, const FM_SetTableStateCmd_t *, MsgPtr); UT_GenStub_Execute(FM_SetTableStateCmd, Basic, NULL); - return UT_GenStub_GetReturnValue(FM_SetTableStateCmd, bool); + return UT_GenStub_GetReturnValue(FM_SetTableStateCmd, CFE_Status_t); } diff --git a/unit-test/stubs/fm_dispatch_stubs.c b/unit-test/stubs/fm_dispatch_stubs.c index 1927dca..5bff950 100644 --- a/unit-test/stubs/fm_dispatch_stubs.c +++ b/unit-test/stubs/fm_dispatch_stubs.c @@ -26,6 +26,182 @@ #include "fm_dispatch.h" #include "utgenstub.h" +/* + * ---------------------------------------------------- + * Generated stub function for FM_ConcatFilesVerifyDispatch() + * ---------------------------------------------------- + */ +CFE_Status_t FM_ConcatFilesVerifyDispatch(const CFE_SB_Buffer_t *BufPtr) +{ + UT_GenStub_SetupReturnBuffer(FM_ConcatFilesVerifyDispatch, CFE_Status_t); + + UT_GenStub_AddParam(FM_ConcatFilesVerifyDispatch, const CFE_SB_Buffer_t *, BufPtr); + + UT_GenStub_Execute(FM_ConcatFilesVerifyDispatch, Basic, NULL); + + return UT_GenStub_GetReturnValue(FM_ConcatFilesVerifyDispatch, CFE_Status_t); +} + +/* + * ---------------------------------------------------- + * Generated stub function for FM_CopyFileVerifyDispatch() + * ---------------------------------------------------- + */ +CFE_Status_t FM_CopyFileVerifyDispatch(const CFE_SB_Buffer_t *BufPtr) +{ + UT_GenStub_SetupReturnBuffer(FM_CopyFileVerifyDispatch, CFE_Status_t); + + UT_GenStub_AddParam(FM_CopyFileVerifyDispatch, const CFE_SB_Buffer_t *, BufPtr); + + UT_GenStub_Execute(FM_CopyFileVerifyDispatch, Basic, NULL); + + return UT_GenStub_GetReturnValue(FM_CopyFileVerifyDispatch, CFE_Status_t); +} + +/* + * ---------------------------------------------------- + * Generated stub function for FM_CreateDirectoryVerifyDispatch() + * ---------------------------------------------------- + */ +CFE_Status_t FM_CreateDirectoryVerifyDispatch(const CFE_SB_Buffer_t *BufPtr) +{ + UT_GenStub_SetupReturnBuffer(FM_CreateDirectoryVerifyDispatch, CFE_Status_t); + + UT_GenStub_AddParam(FM_CreateDirectoryVerifyDispatch, const CFE_SB_Buffer_t *, BufPtr); + + UT_GenStub_Execute(FM_CreateDirectoryVerifyDispatch, Basic, NULL); + + return UT_GenStub_GetReturnValue(FM_CreateDirectoryVerifyDispatch, CFE_Status_t); +} + +/* + * ---------------------------------------------------- + * Generated stub function for FM_DecompressFileVerifyDispatch() + * ---------------------------------------------------- + */ +CFE_Status_t FM_DecompressFileVerifyDispatch(const CFE_SB_Buffer_t *BufPtr) +{ + UT_GenStub_SetupReturnBuffer(FM_DecompressFileVerifyDispatch, CFE_Status_t); + + UT_GenStub_AddParam(FM_DecompressFileVerifyDispatch, const CFE_SB_Buffer_t *, BufPtr); + + UT_GenStub_Execute(FM_DecompressFileVerifyDispatch, Basic, NULL); + + return UT_GenStub_GetReturnValue(FM_DecompressFileVerifyDispatch, CFE_Status_t); +} + +/* + * ---------------------------------------------------- + * Generated stub function for FM_DeleteAllFilesVerifyDispatch() + * ---------------------------------------------------- + */ +CFE_Status_t FM_DeleteAllFilesVerifyDispatch(const CFE_SB_Buffer_t *BufPtr) +{ + UT_GenStub_SetupReturnBuffer(FM_DeleteAllFilesVerifyDispatch, CFE_Status_t); + + UT_GenStub_AddParam(FM_DeleteAllFilesVerifyDispatch, const CFE_SB_Buffer_t *, BufPtr); + + UT_GenStub_Execute(FM_DeleteAllFilesVerifyDispatch, Basic, NULL); + + return UT_GenStub_GetReturnValue(FM_DeleteAllFilesVerifyDispatch, CFE_Status_t); +} + +/* + * ---------------------------------------------------- + * Generated stub function for FM_DeleteDirectoryVerifyDispatch() + * ---------------------------------------------------- + */ +CFE_Status_t FM_DeleteDirectoryVerifyDispatch(const CFE_SB_Buffer_t *BufPtr) +{ + UT_GenStub_SetupReturnBuffer(FM_DeleteDirectoryVerifyDispatch, CFE_Status_t); + + UT_GenStub_AddParam(FM_DeleteDirectoryVerifyDispatch, const CFE_SB_Buffer_t *, BufPtr); + + UT_GenStub_Execute(FM_DeleteDirectoryVerifyDispatch, Basic, NULL); + + return UT_GenStub_GetReturnValue(FM_DeleteDirectoryVerifyDispatch, CFE_Status_t); +} + +/* + * ---------------------------------------------------- + * Generated stub function for FM_DeleteFileVerifyDispatch() + * ---------------------------------------------------- + */ +CFE_Status_t FM_DeleteFileVerifyDispatch(const CFE_SB_Buffer_t *BufPtr) +{ + UT_GenStub_SetupReturnBuffer(FM_DeleteFileVerifyDispatch, CFE_Status_t); + + UT_GenStub_AddParam(FM_DeleteFileVerifyDispatch, const CFE_SB_Buffer_t *, BufPtr); + + UT_GenStub_Execute(FM_DeleteFileVerifyDispatch, Basic, NULL); + + return UT_GenStub_GetReturnValue(FM_DeleteFileVerifyDispatch, CFE_Status_t); +} + +/* + * ---------------------------------------------------- + * Generated stub function for FM_GetDirListFileVerifyDispatch() + * ---------------------------------------------------- + */ +CFE_Status_t FM_GetDirListFileVerifyDispatch(const CFE_SB_Buffer_t *BufPtr) +{ + UT_GenStub_SetupReturnBuffer(FM_GetDirListFileVerifyDispatch, CFE_Status_t); + + UT_GenStub_AddParam(FM_GetDirListFileVerifyDispatch, const CFE_SB_Buffer_t *, BufPtr); + + UT_GenStub_Execute(FM_GetDirListFileVerifyDispatch, Basic, NULL); + + return UT_GenStub_GetReturnValue(FM_GetDirListFileVerifyDispatch, CFE_Status_t); +} + +/* + * ---------------------------------------------------- + * Generated stub function for FM_GetDirListPktVerifyDispatch() + * ---------------------------------------------------- + */ +CFE_Status_t FM_GetDirListPktVerifyDispatch(const CFE_SB_Buffer_t *BufPtr) +{ + UT_GenStub_SetupReturnBuffer(FM_GetDirListPktVerifyDispatch, CFE_Status_t); + + UT_GenStub_AddParam(FM_GetDirListPktVerifyDispatch, const CFE_SB_Buffer_t *, BufPtr); + + UT_GenStub_Execute(FM_GetDirListPktVerifyDispatch, Basic, NULL); + + return UT_GenStub_GetReturnValue(FM_GetDirListPktVerifyDispatch, CFE_Status_t); +} + +/* + * ---------------------------------------------------- + * Generated stub function for FM_GetFileInfoVerifyDispatch() + * ---------------------------------------------------- + */ +CFE_Status_t FM_GetFileInfoVerifyDispatch(const CFE_SB_Buffer_t *BufPtr) +{ + UT_GenStub_SetupReturnBuffer(FM_GetFileInfoVerifyDispatch, CFE_Status_t); + + UT_GenStub_AddParam(FM_GetFileInfoVerifyDispatch, const CFE_SB_Buffer_t *, BufPtr); + + UT_GenStub_Execute(FM_GetFileInfoVerifyDispatch, Basic, NULL); + + return UT_GenStub_GetReturnValue(FM_GetFileInfoVerifyDispatch, CFE_Status_t); +} + +/* + * ---------------------------------------------------- + * Generated stub function for FM_GetOpenFilesVerifyDispatch() + * ---------------------------------------------------- + */ +CFE_Status_t FM_GetOpenFilesVerifyDispatch(const CFE_SB_Buffer_t *BufPtr) +{ + UT_GenStub_SetupReturnBuffer(FM_GetOpenFilesVerifyDispatch, CFE_Status_t); + + UT_GenStub_AddParam(FM_GetOpenFilesVerifyDispatch, const CFE_SB_Buffer_t *, BufPtr); + + UT_GenStub_Execute(FM_GetOpenFilesVerifyDispatch, Basic, NULL); + + return UT_GenStub_GetReturnValue(FM_GetOpenFilesVerifyDispatch, CFE_Status_t); +} + /* * ---------------------------------------------------- * Generated stub function for FM_IsValidCmdPktLength() @@ -45,6 +221,54 @@ bool FM_IsValidCmdPktLength(const CFE_MSG_Message_t *MsgPtr, size_t ExpectedLeng return UT_GenStub_GetReturnValue(FM_IsValidCmdPktLength, bool); } +/* + * ---------------------------------------------------- + * Generated stub function for FM_MonitorFilesystemSpaceVerifyDispatch() + * ---------------------------------------------------- + */ +CFE_Status_t FM_MonitorFilesystemSpaceVerifyDispatch(const CFE_SB_Buffer_t *BufPtr) +{ + UT_GenStub_SetupReturnBuffer(FM_MonitorFilesystemSpaceVerifyDispatch, CFE_Status_t); + + UT_GenStub_AddParam(FM_MonitorFilesystemSpaceVerifyDispatch, const CFE_SB_Buffer_t *, BufPtr); + + UT_GenStub_Execute(FM_MonitorFilesystemSpaceVerifyDispatch, Basic, NULL); + + return UT_GenStub_GetReturnValue(FM_MonitorFilesystemSpaceVerifyDispatch, CFE_Status_t); +} + +/* + * ---------------------------------------------------- + * Generated stub function for FM_MoveFileVerifyDispatch() + * ---------------------------------------------------- + */ +CFE_Status_t FM_MoveFileVerifyDispatch(const CFE_SB_Buffer_t *BufPtr) +{ + UT_GenStub_SetupReturnBuffer(FM_MoveFileVerifyDispatch, CFE_Status_t); + + UT_GenStub_AddParam(FM_MoveFileVerifyDispatch, const CFE_SB_Buffer_t *, BufPtr); + + UT_GenStub_Execute(FM_MoveFileVerifyDispatch, Basic, NULL); + + return UT_GenStub_GetReturnValue(FM_MoveFileVerifyDispatch, CFE_Status_t); +} + +/* + * ---------------------------------------------------- + * Generated stub function for FM_NoopVerifyDispatch() + * ---------------------------------------------------- + */ +CFE_Status_t FM_NoopVerifyDispatch(const CFE_SB_Buffer_t *BufPtr) +{ + UT_GenStub_SetupReturnBuffer(FM_NoopVerifyDispatch, CFE_Status_t); + + UT_GenStub_AddParam(FM_NoopVerifyDispatch, const CFE_SB_Buffer_t *, BufPtr); + + UT_GenStub_Execute(FM_NoopVerifyDispatch, Basic, NULL); + + return UT_GenStub_GetReturnValue(FM_NoopVerifyDispatch, CFE_Status_t); +} + /* * ---------------------------------------------------- * Generated stub function for FM_ProcessCmd() @@ -68,3 +292,83 @@ void FM_ProcessPkt(const CFE_SB_Buffer_t *BufPtr) UT_GenStub_Execute(FM_ProcessPkt, Basic, NULL); } + +/* + * ---------------------------------------------------- + * Generated stub function for FM_RenameFileVerifyDispatch() + * ---------------------------------------------------- + */ +CFE_Status_t FM_RenameFileVerifyDispatch(const CFE_SB_Buffer_t *BufPtr) +{ + UT_GenStub_SetupReturnBuffer(FM_RenameFileVerifyDispatch, CFE_Status_t); + + UT_GenStub_AddParam(FM_RenameFileVerifyDispatch, const CFE_SB_Buffer_t *, BufPtr); + + UT_GenStub_Execute(FM_RenameFileVerifyDispatch, Basic, NULL); + + return UT_GenStub_GetReturnValue(FM_RenameFileVerifyDispatch, CFE_Status_t); +} + +/* + * ---------------------------------------------------- + * Generated stub function for FM_ResetCountersVerifyDispatch() + * ---------------------------------------------------- + */ +CFE_Status_t FM_ResetCountersVerifyDispatch(const CFE_SB_Buffer_t *BufPtr) +{ + UT_GenStub_SetupReturnBuffer(FM_ResetCountersVerifyDispatch, CFE_Status_t); + + UT_GenStub_AddParam(FM_ResetCountersVerifyDispatch, const CFE_SB_Buffer_t *, BufPtr); + + UT_GenStub_Execute(FM_ResetCountersVerifyDispatch, Basic, NULL); + + return UT_GenStub_GetReturnValue(FM_ResetCountersVerifyDispatch, CFE_Status_t); +} + +/* + * ---------------------------------------------------- + * Generated stub function for FM_SendHkVerifyDispatch() + * ---------------------------------------------------- + */ +CFE_Status_t FM_SendHkVerifyDispatch(const CFE_SB_Buffer_t *BufPtr) +{ + UT_GenStub_SetupReturnBuffer(FM_SendHkVerifyDispatch, CFE_Status_t); + + UT_GenStub_AddParam(FM_SendHkVerifyDispatch, const CFE_SB_Buffer_t *, BufPtr); + + UT_GenStub_Execute(FM_SendHkVerifyDispatch, Basic, NULL); + + return UT_GenStub_GetReturnValue(FM_SendHkVerifyDispatch, CFE_Status_t); +} + +/* + * ---------------------------------------------------- + * Generated stub function for FM_SetPermissionsVerifyDispatch() + * ---------------------------------------------------- + */ +CFE_Status_t FM_SetPermissionsVerifyDispatch(const CFE_SB_Buffer_t *BufPtr) +{ + UT_GenStub_SetupReturnBuffer(FM_SetPermissionsVerifyDispatch, CFE_Status_t); + + UT_GenStub_AddParam(FM_SetPermissionsVerifyDispatch, const CFE_SB_Buffer_t *, BufPtr); + + UT_GenStub_Execute(FM_SetPermissionsVerifyDispatch, Basic, NULL); + + return UT_GenStub_GetReturnValue(FM_SetPermissionsVerifyDispatch, CFE_Status_t); +} + +/* + * ---------------------------------------------------- + * Generated stub function for FM_SetTableStateVerifyDispatch() + * ---------------------------------------------------- + */ +CFE_Status_t FM_SetTableStateVerifyDispatch(const CFE_SB_Buffer_t *BufPtr) +{ + UT_GenStub_SetupReturnBuffer(FM_SetTableStateVerifyDispatch, CFE_Status_t); + + UT_GenStub_AddParam(FM_SetTableStateVerifyDispatch, const CFE_SB_Buffer_t *, BufPtr); + + UT_GenStub_Execute(FM_SetTableStateVerifyDispatch, Basic, NULL); + + return UT_GenStub_GetReturnValue(FM_SetTableStateVerifyDispatch, CFE_Status_t); +} diff --git a/unit-test/utilities/fm_test_utils.h b/unit-test/utilities/fm_test_utils.h index eed6ff8..463a306 100644 --- a/unit-test/utilities/fm_test_utils.h +++ b/unit-test/utilities/fm_test_utils.h @@ -57,7 +57,7 @@ typedef union FM_DeleteDirectoryCmd_t DeleteDirectoryCmd; FM_GetDirListFileCmd_t GetDirListFileCmd; FM_GetDirListPktCmd_t GetDirListPktCmd; - FM_MonitorFilesystemSpaceCmd_t GetFreeSpaceCmd; + FM_MonitorFilesystemSpaceCmd_t MonitorFilesystemSpaceCmd; FM_SetTableStateCmd_t SetTableStateCmd; FM_SetPermissionsCmd_t SetPermissionsCmd; } UT_CmdBuf_t;