Skip to content

Updates for clean build with latest ESP-IDF v5.4 #39

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -93,7 +93,7 @@ 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 --depth 1 --branch main
- name: Install Python3
uses: actions/setup-python@v3
with:
Expand Down
13 changes: 10 additions & 3 deletions source/MQTTFileDownloader_cbor.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) ||
Expand Down Expand Up @@ -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. */
Expand All @@ -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. */
Expand All @@ -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. */
Expand Down
49 changes: 31 additions & 18 deletions tools/cmock/coverage.cmake
Original file line number Diff line number Diff line change
@@ -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)
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tools/coverity/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`)
Expand Down
Loading