diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 70b41cf..cb6503c 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -28,9 +28,9 @@ jobs:
- name: Run Coverage
run: |
make -C build/ coverage
- declare -a EXCLUDE=("\*test\*" "\*CMakeCCompilerId\*" "\*mocks\*" "\*vendor/unity\*" "\*_deps\*")
+ declare -a EXCLUDE=("\*_deps\*")
echo ${EXCLUDE[@]} | xargs lcov --rc lcov_branch_coverage=1 -r build/coverage.info -o build/coverage.info
- lcov --rc lcov_branch_coverage=1 --list build/coverage.info
+ lcov --rc lcov_branch_coverage=1 --summary build/coverage.info
- name: Check Coverage
uses: FreeRTOS/CI-CD-Github-Actions/coverage-cop@main
with:
@@ -63,7 +63,7 @@ jobs:
with:
path: ./
formatting:
- runs-on: ubuntu-20.04
+ runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Check formatting
@@ -93,7 +93,10 @@ jobs:
- name: Clone coreJSON
run: git clone https://github.com/FreeRTOS/coreJSON.git --depth 1 --branch v3.2.0
- name: Clone tinycbor
- run: git clone https://github.com/intel/tinycbor.git --depth 1 --branch main
+ run: |
+ git clone https://github.com/intel/tinycbor.git
+ cd tinycbor
+ git checkout 9924cfed3b95ad6de299ae675064430fdb886216
- name: Install Python3
uses: actions/setup-python@v3
with:
diff --git a/docs/doxygen/include/size_table.md b/docs/doxygen/include/size_table.md
index 412adbf..f8eaf88 100644
--- a/docs/doxygen/include/size_table.md
+++ b/docs/doxygen/include/size_table.md
@@ -14,7 +14,7 @@
MQTTFileDownloader_cbor.c |
- 0.8K |
+ 0.7K |
0.6K |
@@ -29,12 +29,12 @@
cborparser.c |
- 2.8K |
- 2.2K |
+ 1.9K |
+ 1.7K |
cborencoder.c |
- 2.0K |
+ 1.7K |
0.7K |
@@ -44,7 +44,7 @@
Total estimates |
- 10.3K |
- 7.6K |
+ 9.0K |
+ 7.1K |
diff --git a/source/MQTTFileDownloader_cbor.c b/source/MQTTFileDownloader_cbor.c
index 758a6a7..f4cadac 100644
--- a/source/MQTTFileDownloader_cbor.c
+++ b/source/MQTTFileDownloader_cbor.c
@@ -71,6 +71,7 @@ bool CBOR_Decode_GetStreamResponseMessage( const uint8_t * messageBuffer,
CborParser parser;
CborValue value, cborMap;
size_t payloadSizeReceived = 0;
+ int variableBuffer = 0;
if( ( fileId == NULL ) || ( blockId == NULL ) || ( blockSize == NULL ) ||
( payload == NULL ) || ( payloadSize == NULL ) ||
@@ -114,7 +115,9 @@ bool CBOR_Decode_GetStreamResponseMessage( const uint8_t * messageBuffer,
if( CborNoError == cborResult )
{
- cborResult = cbor_value_get_int( &value, ( int32_t * ) fileId );
+ variableBuffer = ( int ) *fileId;
+ cborResult = cbor_value_get_int( &value, &variableBuffer );
+ *fileId = ( int32_t ) variableBuffer;
}
/* Find the block ID. */
@@ -132,7 +135,9 @@ bool CBOR_Decode_GetStreamResponseMessage( const uint8_t * messageBuffer,
if( CborNoError == cborResult )
{
- cborResult = cbor_value_get_int( &value, ( int32_t * ) blockId );
+ variableBuffer = ( int ) *blockId;
+ cborResult = cbor_value_get_int( &value, &variableBuffer );
+ *blockId = ( int32_t ) variableBuffer;
}
/* Find the block size. */
@@ -150,7 +155,9 @@ bool CBOR_Decode_GetStreamResponseMessage( const uint8_t * messageBuffer,
if( CborNoError == cborResult )
{
- cborResult = cbor_value_get_int( &value, ( int32_t * ) blockSize );
+ variableBuffer = ( int ) *blockSize;
+ cborResult = cbor_value_get_int( &value, &variableBuffer );
+ *blockSize = ( int32_t ) variableBuffer;
}
/* Find the payload bytes. */
diff --git a/tools/cmock/coverage.cmake b/tools/cmock/coverage.cmake
index 3c03733..40dcee5 100644
--- a/tools/cmock/coverage.cmake
+++ b/tools/cmock/coverage.cmake
@@ -1,22 +1,29 @@
# Taken from amazon-freertos repository
cmake_minimum_required(VERSION 3.13)
set(BINARY_DIR ${CMAKE_BINARY_DIR})
+
# reset coverage counters
execute_process(
- COMMAND lcov --directory ${CMAKE_BINARY_DIR} --base-directory
- ${CMAKE_BINARY_DIR} --zerocounters
+ COMMAND lcov --directory ${CMAKE_BINARY_DIR}
+ --base-directory ${CMAKE_BINARY_DIR}
+ --zerocounters
COMMAND mkdir -p ${CMAKE_BINARY_DIR}/coverage)
-# make the initial/baseline capture a zeroed out files
+
+ # make the initial/baseline capture a zeroed out files
execute_process(
- COMMAND
- lcov --directory ${CMAKE_BINARY_DIR} --base-directory ${CMAKE_BINARY_DIR}
- --initial --capture --rc lcov_branch_coverage=1 --rc
- genhtml_branch_coverage=1
- --output-file=${CMAKE_BINARY_DIR}/base_coverage.info)
-file(GLOB files "${CMAKE_BINARY_DIR}/bin/tests/*")
+ COMMAND lcov --directory ${CMAKE_BINARY_DIR}
+ --base-directory ${CMAKE_BINARY_DIR}
+ --initial
+ --capture
+ --rc lcov_branch_coverage=1
+ --rc genhtml_branch_coverage=1
+ --output-file=${CMAKE_BINARY_DIR}/base_coverage.info
+ --include "*source*")
+file(GLOB files "${CMAKE_BINARY_DIR}/bin/tests/*")
set(REPORT_FILE ${CMAKE_BINARY_DIR}/utest_report.txt)
file(WRITE ${REPORT_FILE} "")
+
# execute all files in bin directory, gathering the output to show it in CI
foreach(testname ${files})
get_filename_component(test ${testname} NAME_WLE)
@@ -34,18 +41,24 @@ execute_process(COMMAND ruby ${CMOCK_DIR}/vendor/unity/auto/parse_output.rb -xml
# capture data after running the tests
execute_process(
- COMMAND
- lcov --capture --rc lcov_branch_coverage=1 --rc genhtml_branch_coverage=1
- --base-directory ${CMAKE_BINARY_DIR} --directory ${CMAKE_BINARY_DIR}
- --output-file ${CMAKE_BINARY_DIR}/second_coverage.info)
+ COMMAND lcov --capture
+ --rc lcov_branch_coverage=1
+ --rc genhtml_branch_coverage=1
+ --base-directory ${CMAKE_BINARY_DIR}
+ --directory ${CMAKE_BINARY_DIR}
+ --output-file ${CMAKE_BINARY_DIR}/second_coverage.info
+ --include "*source*")
# combile baseline results (zeros) with the one after running the tests
execute_process(
- COMMAND
- lcov --base-directory ${CMAKE_BINARY_DIR} --directory ${CMAKE_BINARY_DIR}
- --add-tracefile ${CMAKE_BINARY_DIR}/base_coverage.info --add-tracefile
- ${CMAKE_BINARY_DIR}/second_coverage.info --output-file
- ${CMAKE_BINARY_DIR}/coverage.info --no-external --rc lcov_branch_coverage=1)
+ COMMAND lcov --base-directory ${CMAKE_BINARY_DIR}
+ --directory ${CMAKE_BINARY_DIR}
+ --add-tracefile ${CMAKE_BINARY_DIR}/base_coverage.info
+ --add-tracefile ${CMAKE_BINARY_DIR}/second_coverage.info
+ --output-file ${CMAKE_BINARY_DIR}/coverage.info
+ --no-external
+ --rc lcov_branch_coverage=1)
+
execute_process(
COMMAND
genhtml --rc lcov_branch_coverage=1 --branch-coverage --output-directory
diff --git a/tools/coverity/README.md b/tools/coverity/README.md
index 29d4452..5e08c09 100644
--- a/tools/coverity/README.md
+++ b/tools/coverity/README.md
@@ -9,7 +9,7 @@ For generating the report as outlined below, we have used Coverity version 2023.
## Getting Started
### Prerequisites
-You can run this on a platform supported by Coverity. The list and other details can be found [here](https://sig-docs.synopsys.com/polaris/topics/c_coverity-compatible-platforms.html).
+You can run this on a platform supported by Coverity. The list and other details can be found [here](https://documentation.blackduck.com/bundle/coverity-docs-2024.9/page/deploy-install-guide/topics/supported_platforms_for_coverity_analysis.html).
To compile and run the Coverity target successfully, you must have the following:
1. CMake version >= 3.16.0 (You can check whether you have this by typing `cmake --version`)