File: coverage.cmake

package info (click to toggle)
galera-4 26.4.25-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 10,968 kB
  • sloc: cpp: 133,534; ansic: 12,171; sh: 1,446; tcl: 51; makefile: 19
file content (24 lines) | stat: -rw-r--r-- 915 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#
# Copyright (C) 2020 Codership Oy <info@codership.com>
#

# To produce a coverage report, call cmake with -DGALERA_WITH_COVERAGE=ON,
# run
#
#   make
#   make test
#   make ExperimentalCoverage
#   make coverage_report
#
# The coverage report output will be in directory root index.html
#
if (GALERA_WITH_COVERAGE)
  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fprofile-arcs -ftest-coverage")
  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage")
  set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fprofile-arcs -ftest-coverage")
  find_program(GALERA_LCOV_EXE lcov)
  find_program(GALERA_GENHTML_EXE genhtml)
  add_custom_target(coverage_report
    ${GALERA_LCOV_EXE} --base-directory ${CMAKE_CURRENT_SOURCE_DIR} --capture --directory ${CMAKE_CURRENT_BINARY_DIR} --output lcov.info --no-external --quiet
    COMMAND ${GALERA_GENHTML_EXE} --output-directory coverage_report lcov.info)
endif()