Skip to content

Commit b619a58

Browse files
committed
coverage
1 parent c4e200e commit b619a58

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

.github/workflows/build.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,7 @@ jobs:
120120
cd build
121121
lcov --keep-going --ignore-errors mismatch --directory . --capture --output-file coverage.info
122122
lcov --ignore-errors mismatch --remove coverage.info '*/test/*' -o coverage.info
123-
cd ..
124-
gcovr -e test -e examples --sonarqube -u -o coverage.xml --exclude-throw-branches \
123+
gcovr --root .. -e '../test' -e '../examples' --sonarqube -o coverage.xml --exclude-throw-branches \
125124
--gcov-ignore-parse-errors --exclude-unreachable-branches
126125
127126
- name: Upload coverage to Codecov
@@ -141,7 +140,7 @@ jobs:
141140
-Dsonar.projectKey=simgrid_dtlmod
142141
-Dsonar.organization=simgrid
143142
-Dsonar.cfamily.compile-commands=build/compile_commands.json
144-
-Dsonar.coverageReportPaths=coverage.xml
143+
-Dsonar.coverageReportPaths=build/coverage.xml
145144
146145
- name: Build and deploy documentation
147146
if: github.ref == 'refs/heads/main' && env.TOKEN_GITHUB != ''

CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,12 @@ set_target_properties(dtlmod PROPERTIES
217217
LINKER_LANGUAGE CXX
218218
PUBLIC_HEADER "${HEADER_FILES}")
219219

220+
# Enable coverage for Debug builds
221+
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
222+
target_compile_options(dtlmod PRIVATE -g -O0 --coverage)
223+
target_link_options(dtlmod PRIVATE --coverage)
224+
endif()
225+
220226
target_include_directories(dtlmod
221227
PUBLIC
222228
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/include>

0 commit comments

Comments
 (0)