Skip to content

Commit ccb7d1f

Browse files
committed
Fix test coverage report
1 parent fa1a5b1 commit ccb7d1f

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

.devcontainer/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ RUN apt update && apt upgrade --yes
99

1010
RUN apt install --yes gcc-14 g++-14
1111
RUN apt install --yes clang-format pre-commit
12-
RUN apt install --yes gcovr lcov
12+
RUN apt install --yes lcov
1313

1414
# Choose default gcc and g++ version
1515

tests/CMakeLists.txt

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,17 +68,21 @@ add_test(NAME test.fetch COMMAND ${CMAKE_COMMAND} --build "${PROJECT_BINARY_DIR}
6868

6969
if(TRAITS_TEST_COVERAGE)
7070
find_program(LCOV lcov REQUIRED)
71-
find_program(GCOVR gcovr REQUIRED)
72-
find_program(GENHTML genhtml REQUIRED)
71+
find_program(PYTHON3 python3 REQUIRED)
7372

7473
set(CMAKE_CXX_FLAGS "-O0 -coverage")
7574

7675
add_custom_target(
7776
coverage
78-
COMMAND "${LCOV}" --capture --directory . --exclude '/usr/*' --exclude 'gtest/*' --output-file
79-
coverage.info
80-
COMMAND "${LCOV}" --list coverage.info
81-
COMMAND "${GCOVR}" --cobertura --cobertura-pretty --exclude '/usr/*' --exclude 'gtest/*'
82-
--output coverage.cobertura.xml
77+
COMMAND "${LCOV}" --capture --directory "${CMAKE_BINARY_DIR}" --exclude '/usr/*' --exclude
78+
'/*/gtest/*' --output-file "${CMAKE_BINARY_DIR}/coverage.info"
79+
COMMAND "${LCOV}" --list "${CMAKE_BINARY_DIR}/coverage.info"
80+
COMMAND
81+
wget -O "${CMAKE_BINARY_DIR}/lcov_cobertura.py"
82+
https://raw.github.com/eriwen/lcov-to-cobertura-xml/master/lcov_cobertura/lcov_cobertura.py
83+
COMMAND
84+
"${PYTHON3}" "${CMAKE_BINARY_DIR}/lcov_cobertura.py" "${CMAKE_BINARY_DIR}/coverage.info"
85+
--base-dir "${CMAKE_SOURCE_DIR}" --demangle --output
86+
"${CMAKE_BINARY_DIR}/coverage.cobertura.xml"
8387
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}")
8488
endif()

0 commit comments

Comments
 (0)