From 9a16fd3c553c2a643e344ef55fe31f57504709e2 Mon Sep 17 00:00:00 2001 From: Van Date: Fri, 23 Jun 2023 15:21:44 -0400 Subject: [PATCH 1/2] Fix #1930, add code coverage for null check Fix #1930, add code coverage for null check in es. Add CFE_ES_GenPoolCreatePoolBlock and CFE_ES_GenPoolRecyclePoolBlock to header file --- modules/es/fsw/src/cfe_es_generic_pool.h | 33 ++++++++++++++++++++++++ modules/es/ut-coverage/es_UT.c | 10 +++++++ 2 files changed, 43 insertions(+) diff --git a/modules/es/fsw/src/cfe_es_generic_pool.h b/modules/es/fsw/src/cfe_es_generic_pool.h index 81fae514b..f564bb593 100644 --- a/modules/es/fsw/src/cfe_es_generic_pool.h +++ b/modules/es/fsw/src/cfe_es_generic_pool.h @@ -158,6 +158,39 @@ int32 CFE_ES_GenPoolInitialize(CFE_ES_GenPoolRecord_t *PoolRecPtr, size_t StartO */ int32 CFE_ES_GenPoolGetBlock(CFE_ES_GenPoolRecord_t *PoolRecPtr, size_t *BlockOffsetPtr, size_t ReqSize); +/*---------------------------------------------------------------------------------------*/ +/** + * \brief Create a new block of the given size. + * + * \note Internal helper routine only, not part of API. + * + * \param[inout] PoolRecPtr Pointer to pool structure + * \param[in] BucketId Bucket ID + * \param[in] NewSize Size of block + * \param[out] BlockOffsetPtr Location to output new block offset + * + * \return #CFE_SUCCESS, or error code #CFE_ES_BUFFER_NOT_IN_POOL #CFE_ES_ERR_MEM_BLOCK_SIZE + * \ref CFEReturnCodes + */ +int32 CFE_ES_GenPoolCreatePoolBlock(CFE_ES_GenPoolRecord_t *PoolRecPtr, uint16 BucketId, size_t NewSize, + size_t *BlockOffsetPtr); + +/*---------------------------------------------------------------------------------------*/ +/** + * \brief Find and re-allocate a previously returned block + * + * \note Internal helper routine only, not part of API. + * + * \param[inout] PoolRecPtr Pointer to pool structure + * \param[in] BucketId Bucket ID + * \param[in] NewSize Size of block + * \param[out] BlockOffsetPtr Location to output new block offset + * + * \return #CFE_SUCCESS, or error code #CFE_ES_BUFFER_NOT_IN_POOL \ref CFEReturnCodes + */ +int32 CFE_ES_GenPoolRecyclePoolBlock(CFE_ES_GenPoolRecord_t *PoolRecPtr, uint16 BucketId, size_t NewSize, + size_t *BlockOffsetPtr); + /*---------------------------------------------------------------------------------------*/ /** * \brief Returns a block to the pool diff --git a/modules/es/ut-coverage/es_UT.c b/modules/es/ut-coverage/es_UT.c index 68ae5b4e4..29d13ff1f 100644 --- a/modules/es/ut-coverage/es_UT.c +++ b/modules/es/ut-coverage/es_UT.c @@ -2457,6 +2457,16 @@ void TestGenericPool(void) /* Reset the structure so it will rebuild */ Pool1.TailPosition = 0; CFE_UtAssert_SUCCESS(CFE_ES_GenPoolRebuild(&Pool1)); + + /* Branch coverage for no buffer in pool */ + ES_ResetUnitTest(); + UtAssert_INT32_EQ(CFE_ES_GenPoolCreatePoolBlock(&Pool1, 0, Pool1.Buckets[0].BlockSize, &Offset1), + CFE_ES_BUFFER_NOT_IN_POOL); + + ES_ResetUnitTest(); + UtAssert_INT32_EQ(CFE_ES_GenPoolRecyclePoolBlock(&Pool1, 0, Pool1.Buckets[0].BlockSize, &Offset1), + CFE_ES_BUFFER_NOT_IN_POOL); + } void TestTask(void) From 605d98c2c4e2085516e92aab005a9594cc7f22dd Mon Sep 17 00:00:00 2001 From: Dylan Date: Mon, 23 Oct 2023 08:21:09 -0400 Subject: [PATCH 2/2] Updating documentation and version numbers for v7.0.0-rc4+dev405 --- CHANGELOG.md | 8 ++++++-- modules/core_api/fsw/inc/cfe_version.h | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 04907629a..588758355 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,14 @@ # Changelog -## Development Build:v7.0.0-rc4+dev401 +## Development Build: v7.0.0-rc4+dev405 +- add code coverage for null check +- See + +## Development Build: v7.0.0-rc4+dev401 - minor reorg of message headers - See -## Development Build:v7.0.0-rc4+dev395 +## Development Build: v7.0.0-rc4+dev395 - Adds an empty string or null pointer check for pipe creation - crc calculation refactor - See and diff --git a/modules/core_api/fsw/inc/cfe_version.h b/modules/core_api/fsw/inc/cfe_version.h index abafa7542..584b8d417 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 401 /**< @brief Development: Number of development git commits since CFE_BUILD_BASELINE */ +#define CFE_BUILD_NUMBER 405 /**< @brief Development: Number of development git commits since CFE_BUILD_BASELINE */ #define CFE_BUILD_BASELINE "v7.0.0-rc4" /**< @brief Development: Reference git tag for build number */ /* See \ref cfsversions for definitions */