Skip to content
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
7 changes: 1 addition & 6 deletions .github/workflows/basic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -298,15 +298,10 @@ jobs:
ctest --test-dir build
if: ${{ matrix.install }}

- name: Coverage
run: |
lcov --ignore-errors mismatch --capture --directory . --no-external --output-file lcov.info
lcov --remove lcov.info --output-file lcov.info '*/tests/*'
if: ${{ matrix.name == 'Coverage' }}
- name: Coveralls
uses: coverallsapp/github-action@master
with:
path-to-lcov: lcov.info
path-to-lcov: cpputest_build/coverage.lcov
github-token: ${{ secrets.GITHUB_TOKEN }}
if: ${{ matrix.name == 'Coverage' }}

Expand Down
1 change: 1 addition & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
},
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_PROJECT_CppUTest_INCLUDE": "${sourceDir}/cmake/lcov.cmake",
"CMAKE_CXX_STANDARD": "11",
"CPPUTEST_EXAMPLES": false
}
Expand Down
6 changes: 6 additions & 0 deletions cmake/CTestCustom.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
set(CTEST_CUSTOM_POST_TEST
"@LCOV@ --capture --directory @CMAKE_BINARY_DIR@ --base-directory @CMAKE_SOURCE_DIR@ --no-external --ignore-errors mismatch,inconsistent --output-file @CMAKE_BINARY_DIR@/coverage.lcov"
"@LCOV@ --remove @CMAKE_BINARY_DIR@/coverage.lcov --output-file @CMAKE_BINARY_DIR@/coverage.lcov */tests/*"
"@CMAKE_COMMAND@ -E rm -rf @CMAKE_BINARY_DIR@/coverage"
"@GENHTML@ @CMAKE_BINARY_DIR@/coverage.lcov --output-directory @CMAKE_BINARY_DIR@/coverage"
)
13 changes: 13 additions & 0 deletions cmake/lcov.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
if(NOT CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
message(FATAL_ERROR
"Coverage requires GCC or Clang (got ${CMAKE_CXX_COMPILER_ID})")
endif()

find_program(LCOV lcov REQUIRED)
find_program(GENHTML genhtml REQUIRED)

configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/CTestCustom.cmake.in"
"${CMAKE_BINARY_DIR}/CTestCustom.cmake"
@ONLY
)
Loading