Skip to content

Commit 90d21a3

Browse files
committed
Switched to grcov for coverage reports
1 parent 0690146 commit 90d21a3

File tree

4 files changed

+11
-10
lines changed

4 files changed

+11
-10
lines changed

.github/workflows/build.yml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
with:
3838
max-size: "2000M"
3939
- name: Install deps
40-
run: sudo apt -y install git make ninja-build pkg-config gcc g++ ccache cmake libyaml-cpp-dev llvm-18 clang-18 libclang-18-dev libclang-cpp18-dev clang-format-18 lcov zlib1g-dev libunwind-dev libdw-dev gnustep-back-common libgnustep-base-dev gnustep-make
40+
run: sudo apt -y install git make grcov ninja-build pkg-config gcc g++ ccache cmake libyaml-cpp-dev llvm-18 clang-18 libclang-18-dev libclang-cpp18-dev clang-format-18 lcov zlib1g-dev libunwind-dev libdw-dev gnustep-back-common libgnustep-base-dev gnustep-make
4141
- name: Check code formatting
4242
run: |
4343
make check-formatting
@@ -46,15 +46,13 @@ jobs:
4646
CC=/usr/bin/clang-18 CXX=/usr/bin/clang++-18 LLVM_VERSION=18 NUMPROC=2 CMAKE_GENERATOR=Ninja CODE_COVERAGE=ON LLVM_VERSION=18 ENABLE_CXX_MODULES_TEST_CASES=ON ENABLE_CUDA_TEST_CASES=OFF ENABLE_OBJECTIVE_C_TEST_CASES=ON FETCH_LIBOBJC2=ON CLANG_UML_ENABLE_BACKTRACE=ON make test
4747
- name: Run coverage
4848
run: |
49-
lcov -c -d debug -o coverage.info
50-
lcov -r coverage.info -o coverage-src.info "$PWD/src/main.cc" "$PWD/src/common/generators/generators.cc"
51-
lcov -e coverage-src.info -o coverage-src.info "$PWD/src/*"
52-
lcov -l coverage-src.info
49+
grcov --llvm --binary-path debug --output-path coverage.info -t lcov --keep-only 'src/*' --source-dir . --ignore src/main.cc --ignore src/common/generators/generators.cc .
50+
lcov --ignore-errors inconsistent -l coverage.info
5351
- name: Upload coverage
5452
uses: codecov/codecov-action@v3
5553
with:
56-
files: coverage-src.info
54+
files: coverage.info
5755
disable_search: true
5856
name: clang-uml
5957
token: ${{ secrets.CODECOV_TOKEN }}
60-
fail_ci_if_error: false
58+
fail_ci_if_error: false

CMakeLists.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,9 @@ message(STATUS "clang-uml version: "
6666
#
6767
option(CODE_COVERAGE "" OFF)
6868
if(CODE_COVERAGE)
69-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage -fno-inline")
70-
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lgcov --coverage")
69+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O0 -g --coverage -fno-inline")
70+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 -g --coverage -fno-inline")
71+
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lgcov")
7172
endif(CODE_COVERAGE)
7273

7374
#

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ test_release: release
136136
CTEST_OUTPUT_ON_FAILURE=1 ctest --test-dir release
137137

138138
coverage_report: test
139-
lcov -c -d debug -o coverage.info
139+
lcov -c -d debug -o coverage.info --no-external --gcov-tool util/clang_gcov.sh
140140
lcov -r coverage.info -o coverage-src.info "${PWD}/src/main.cc" "${PWD}/src/common/generators/generators.cc"
141141
lcov -e coverage-src.info -o coverage-src.info "${PWD}/src/*"
142142
lcov -l coverage-src.info

util/clang_gcov.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/bash
2+
exec llvm-cov-18 gcov "$@"

0 commit comments

Comments
 (0)