Skip to content
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

Fix gcc warnings in core_http_client.c. Update ci.yml. #101

Open
wants to merge 16 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
60 changes: 47 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,34 +8,68 @@ on:
workflow_dispatch:

jobs:
unittest:
unittests-sanitizer:
runs-on: ubuntu-latest
steps:
- name: Clone This Repo
uses: actions/checkout@v2
- name: Build
- name: Build with Sanitizers
run: |
sudo apt-get install -y lcov
paulbartell marked this conversation as resolved.
Show resolved Hide resolved
cmake -S test -B build/ \
sudo apt-get install -y cmake lcov
CFLAGS=" -O0 -Wall -Wextra"
CFLAGS+=" -Werror -Wno-error=pedantic"
paulbartell marked this conversation as resolved.
Show resolved Hide resolved
CFLAGS+=" -D_FORTIFY_SOURCE=2"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a comment about what this configuration and its value does?

CFLAGS+=" -Wformat"
CLFAGS+=" -Wformat-security"
CFLAGS+=" -Warray-bounds"
CFLAGS+=" -fsanitize=address,undefined"
CFLAGS+=" -fsanitize=pointer-compare -fsanitize=pointer-subtract"
CFLAGS+=" -fsanitize-recover=undefined"
CFLAGS+=" -fsanitize-address-use-after-scope"
CFLAGS+=" -fsanitize-undefined-trap-on-error"
CFLAGS_=" -fstack-protector-all"
cmake -S test -B build \
-G "Unix Makefiles" \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_C_FLAGS='--coverage -Wall -Wextra -DNDEBUG'
make -C build/ all
- name: Test
-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \
-DCMAKE_C_FLAGS="${CFLAGS}"
make -C build all
- name: Run Tests with Sanitizers
run: |
cd build/
cd build
make coverage
Copy link
Contributor

@aggarw13 aggarw13 Apr 30, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Minor) What's the purpose of building coverage target instead of just the unit test binaries with the all target when the next step in this job runs test for coverage?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The all target does not run the unit tests, only the coverage target does.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't need the coverage target to build and run the unit tests necessarily. The ctest command takes care of running the unit tests

ctest -E system --output-on-failure
cd ..
- name: Run Coverage
unittests-coverage:
runs-on: ubuntu-latest
steps:
- name: Clone This Repo
uses: actions/checkout@v2
- name: Build Tests for Coverage
paulbartell marked this conversation as resolved.
Show resolved Hide resolved
run: |
make -C build/ coverage
sudo apt-get install -y cmake lcov
CFLAGS=" --coverage -O0 -Wall -Wextra"
paulbartell marked this conversation as resolved.
Show resolved Hide resolved
CFLAGS+=" -Werror -Wno-error=pedantic"
CFLAGS+=" -DNDEBUG"
paulbartell marked this conversation as resolved.
Show resolved Hide resolved
cmake -S test -B build_cov \
-G "Unix Makefiles" \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \
-DCMAKE_C_FLAGS="${CFLAGS}"
make -C build_cov all
- name: Run Tests for Coverage
run: |
cd build_cov
make coverage
ctest -E system --output-on-failure
cd ..
declare -a EXCLUDE=("\*test\*" "\*CMakeCCompilerId\*" "\*mocks\*" "\*3rdparty\*")
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
echo ${EXCLUDE[@]} | xargs lcov --rc lcov_branch_coverage=1 -r build_cov/coverage.info -o build_cov/coverage.info
lcov --rc lcov_branch_coverage=1 --list build_cov/coverage.info
- name: Check Coverage
uses: FreeRTOS/CI-CD-Github-Actions/coverage-cop@main
with:
path: ./build/coverage.info
path: ./build_cov/coverage.info
complexity:
runs-on: ubuntu-latest
steps:
Expand Down
8 changes: 4 additions & 4 deletions docs/doxygen/include/size_table.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
</tr>
<tr>
<td>core_http_client.c</td>
<td><center>3.1K</center></td>
<td><center>2.5K</center></td>
<td><center>3.2K</center></td>
<td><center>2.6K</center></td>
</tr>
<tr>
<td>http_parser.c (third-party utility)</td>
Expand All @@ -19,7 +19,7 @@
</tr>
<tr>
<td><b>Total estimates</b></td>
<td><b><center>18.8K</center></b></td>
<td><b><center>15.5K</center></b></td>
<td><b><center>18.9K</center></b></td>
<td><b><center>15.6K</center></b></td>
</tr>
</table>
4 changes: 3 additions & 1 deletion lexicon.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const
contentlength
convertint
copybrief
copycharsuntilnull
copydoc
corehttp
coverity
Expand Down Expand Up @@ -70,7 +71,7 @@ html
http
httpclient
httpheadernotfound
httpheaderstrncpy
httpheadercpy
httpinsufficientmemory
httpinvalidparameter
httpinvalidresponse
Expand Down Expand Up @@ -128,6 +129,7 @@ loginfo
logwarn
mainpage
malloc
maxlen
memcpy
memmove
methodlen
Expand Down
Loading