From 870c8780eb2659732813cec380db24a87f9368a7 Mon Sep 17 00:00:00 2001 From: Avi Weiss Date: Sat, 6 May 2023 12:47:45 +1000 Subject: [PATCH 1/3] Fix #1933, Remove unreachable/dead branch in `CFE_ES_RunPerfLogDump()` --- .github/workflows/code-coverage.yml | 4 ++-- modules/es/fsw/src/cfe_es_perf.c | 6 +----- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/.github/workflows/code-coverage.yml b/.github/workflows/code-coverage.yml index 45153fd92..564f9d6a7 100644 --- a/.github/workflows/code-coverage.yml +++ b/.github/workflows/code-coverage.yml @@ -104,8 +104,8 @@ jobs: - name: Confirm Minimum Coverage run: | - missed_branches=52 - missed_lines=18 + missed_branches=50 + missed_lines=17 branch_nums=$(grep -A 3 "Overall coverage rate" lcov_out.txt | grep branches | grep -oP "[0-9]+[0-9]*") line_nums=$(grep -A 3 "Overall coverage rate" lcov_out.txt | grep lines | grep -oP "[0-9]+[0-9]*") diff --git a/modules/es/fsw/src/cfe_es_perf.c b/modules/es/fsw/src/cfe_es_perf.c index c6a86ad76..436f0bdff 100644 --- a/modules/es/fsw/src/cfe_es_perf.c +++ b/modules/es/fsw/src/cfe_es_perf.c @@ -462,11 +462,7 @@ bool CFE_ES_RunPerfLogDump(uint32 ElapsedTime, void *Arg) { CFE_ES_FileWriteByteCntErr(State->DataFileName, BlockSize, Status); - /* skip to cleanup */ - if (State->CurrentState < CFE_ES_PerfDumpState_CLEANUP) - { - State->PendingState = CFE_ES_PerfDumpState_CLEANUP; - } + State->PendingState = CFE_ES_PerfDumpState_CLEANUP; } else { From 777feec3ac9da50ccdabf4541ffb3cc88b752199 Mon Sep 17 00:00:00 2001 From: Joseph Hickey Date: Fri, 2 Feb 2024 13:03:50 -0500 Subject: [PATCH 2/3] Fix #2514, change CFE_MSG_Message from union to struct Having this abstract type as a "struct" makes it match the Command and Telemetry abstract types. Futhermore, it better conveys the intent that this is an abstract object and should not be directly used or accessed in other ways. It may still be implemented as a union underneath (depending on how MSG module chooses to implement) but that is hidden from public API. In the case of the default MSG module implementation, there are just a handful of cases where it is accessed internally as bytes, and those are simple enough to do with a cast. --- modules/core_api/fsw/inc/cfe_msg_api_typedefs.h | 2 +- modules/core_api/ut-stubs/src/cfe_sb_handlers.c | 2 +- modules/core_private/ut-stubs/src/ut_support.c | 6 ++++-- modules/msg/fsw/src/cfe_msg_sechdr_checksum.c | 2 +- modules/msg/option_inc/default_cfe_msg_hdr_pri.h | 5 ++--- modules/msg/option_inc/default_cfe_msg_hdr_priext.h | 5 ++--- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/modules/core_api/fsw/inc/cfe_msg_api_typedefs.h b/modules/core_api/fsw/inc/cfe_msg_api_typedefs.h index e31eee066..b570fe33c 100644 --- a/modules/core_api/fsw/inc/cfe_msg_api_typedefs.h +++ b/modules/core_api/fsw/inc/cfe_msg_api_typedefs.h @@ -99,7 +99,7 @@ typedef enum CFE_MSG_PlaybackFlag /** * \brief cFS generic base message */ -typedef union CFE_MSG_Message CFE_MSG_Message_t; +typedef struct CFE_MSG_Message CFE_MSG_Message_t; /** * \brief cFS command header diff --git a/modules/core_api/ut-stubs/src/cfe_sb_handlers.c b/modules/core_api/ut-stubs/src/cfe_sb_handlers.c index 9551d8778..7d23b2f2b 100644 --- a/modules/core_api/ut-stubs/src/cfe_sb_handlers.c +++ b/modules/core_api/ut-stubs/src/cfe_sb_handlers.c @@ -348,7 +348,7 @@ void UT_DefaultHandler_CFE_SB_GetUserData(void *UserObj, UT_EntryKey_t FuncKey, if (UT_Stub_CopyToLocal(UT_KEY(CFE_SB_GetUserData), &Result, sizeof(Result)) != sizeof(Result)) { BytePtr = (uint8 *)MsgPtr; - if ((MsgPtr->Byte[0] & 0x10) != 0) + if ((*BytePtr & 0x10) != 0) { HdrSize = sizeof(CFE_MSG_CommandHeader_t); } diff --git a/modules/core_private/ut-stubs/src/ut_support.c b/modules/core_private/ut-stubs/src/ut_support.c index 83eea427a..01fbb07c0 100644 --- a/modules/core_private/ut-stubs/src/ut_support.c +++ b/modules/core_private/ut-stubs/src/ut_support.c @@ -342,13 +342,15 @@ int32 UT_SoftwareBusSnapshotHook(void *UserObj, int32 StubRetcode, uint32 CallCo { UT_SoftwareBusSnapshot_Entry_t *Snapshot = UserObj; const CFE_MSG_Message_t * MsgPtr = UT_Hook_GetArgValueByName(Context, "MsgPtr", CFE_MSG_Message_t *); + const uint8_t * BytePtr; if (MsgPtr != NULL && Snapshot != NULL) { ++Snapshot->Count; if (Snapshot->SnapshotSize > 0 && Snapshot->SnapshotBuffer != NULL) { - memcpy(Snapshot->SnapshotBuffer, &MsgPtr->Byte[Snapshot->SnapshotOffset], Snapshot->SnapshotSize); + BytePtr = (const uint8 *)MsgPtr; + memcpy(Snapshot->SnapshotBuffer, &BytePtr[Snapshot->SnapshotOffset], Snapshot->SnapshotSize); } } @@ -535,7 +537,7 @@ uint16 UT_GetNumEventsSent(void) */ void UT_DisplayPkt(CFE_MSG_Message_t *MsgPtr, size_t size) { - uint8 *BytePtr = MsgPtr->Byte; + uint8 *BytePtr = (uint8 *)MsgPtr; size_t i; size_t BufSize = UT_MAX_MESSAGE_LENGTH; char DisplayMsg[UT_MAX_MESSAGE_LENGTH]; diff --git a/modules/msg/fsw/src/cfe_msg_sechdr_checksum.c b/modules/msg/fsw/src/cfe_msg_sechdr_checksum.c index 4aab22f37..88e9f1cb8 100644 --- a/modules/msg/fsw/src/cfe_msg_sechdr_checksum.c +++ b/modules/msg/fsw/src/cfe_msg_sechdr_checksum.c @@ -34,7 +34,7 @@ CFE_MSG_Checksum_t CFE_MSG_ComputeCheckSum(const CFE_MSG_Message_t *MsgPtr) { CFE_MSG_Size_t PktLen = 0; - const uint8 * BytePtr = MsgPtr->Byte; + const uint8 * BytePtr = (const uint8 *)MsgPtr; CFE_MSG_Checksum_t chksum = 0xFF; /* Message already checked, no error case reachable */ diff --git a/modules/msg/option_inc/default_cfe_msg_hdr_pri.h b/modules/msg/option_inc/default_cfe_msg_hdr_pri.h index 5aaaa38c2..0d074c644 100644 --- a/modules/msg/option_inc/default_cfe_msg_hdr_pri.h +++ b/modules/msg/option_inc/default_cfe_msg_hdr_pri.h @@ -89,10 +89,9 @@ typedef struct * * This provides the definition of CFE_MSG_Message_t */ -union CFE_MSG_Message +struct CFE_MSG_Message { - CCSDS_SpacePacket_t CCSDS; /**< \brief CCSDS Header (Pri or Pri + Ext) */ - uint8 Byte[sizeof(CCSDS_SpacePacket_t)]; /**< \brief Byte level access */ + CCSDS_SpacePacket_t CCSDS; /**< \brief CCSDS Header (Pri or Pri + Ext) */ }; /** diff --git a/modules/msg/option_inc/default_cfe_msg_hdr_priext.h b/modules/msg/option_inc/default_cfe_msg_hdr_priext.h index c13cae0e1..3c16fdc1c 100644 --- a/modules/msg/option_inc/default_cfe_msg_hdr_priext.h +++ b/modules/msg/option_inc/default_cfe_msg_hdr_priext.h @@ -96,10 +96,9 @@ typedef struct /** * \brief cFS generic base message */ -union CFE_MSG_Message +struct CFE_MSG_Message { - CCSDS_SpacePacket_t CCSDS; /**< \brief CCSDS Header (Pri or Pri + Ext) */ - uint8 Byte[sizeof(CCSDS_SpacePacket_t)]; /**< \brief Byte level access */ + CCSDS_SpacePacket_t CCSDS; /**< \brief CCSDS Header (Pri or Pri + Ext) */ }; /** From 110fa46e4b922085d8ad060bae8c224abc5a31a9 Mon Sep 17 00:00:00 2001 From: Dylan Date: Fri, 23 Feb 2024 08:06:41 -0500 Subject: [PATCH 3/3] Updating documentation and version numbers for equuleus-rc1+dev96 --- CHANGELOG.md | 5 +++++ modules/core_api/fsw/inc/cfe_version.h | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 65b772882..667306973 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## Development Build: equuleus-rc1+dev96 +- change CFE_MSG_Message from union to struct +- Remove unreachable/dead branch in CFE_ES_RunPerfLogDump() +- See and + ## Development Build: equuleus-rc1+dev90 - EDS XML file updates - add EDS cmake hooks diff --git a/modules/core_api/fsw/inc/cfe_version.h b/modules/core_api/fsw/inc/cfe_version.h index b3a5a72a4..7c727bc7b 100644 --- a/modules/core_api/fsw/inc/cfe_version.h +++ b/modules/core_api/fsw/inc/cfe_version.h @@ -26,7 +26,7 @@ #define CFE_VERSION_H /* Development Build Macro Definitions */ -#define CFE_BUILD_NUMBER 90 /**< @brief Development: Number of development git commits since CFE_BUILD_BASELINE */ +#define CFE_BUILD_NUMBER 96 /**< @brief Development: Number of development git commits since CFE_BUILD_BASELINE */ #define CFE_BUILD_BASELINE "equuleus-rc1" /**< @brief Development: Reference git tag for build number */ #define CFE_BUILD_DEV_CYCLE "equuleus-rc2" /**< @brief Development: Release name for current development cycle */ #define CFE_BUILD_CODENAME "Equuleus" /**< @brief: Development: Code name for the current build */