mirror of
https://github.com/falk-werner/webfused
synced 2024-10-27 20:44:08 +00:00
added code coverage
This commit is contained in:
parent
141c857d4e
commit
1c783e84eb
14
.travis.yml
14
.travis.yml
@ -26,6 +26,13 @@ addons:
|
|||||||
- ninja-build
|
- ninja-build
|
||||||
- libconfig-dev
|
- libconfig-dev
|
||||||
|
|
||||||
|
env:
|
||||||
|
matrix:
|
||||||
|
- BUILD_TYPE=Coverage CHECK_TARGET=check
|
||||||
|
- BUILD_TYPE=Debug CHECK_TARGET=memcheck
|
||||||
|
- BUILD_TPYE=Release CHECK_TARGET=check
|
||||||
|
- BUILD_TYPE=MinSizeRel CHECK_TARGET=check
|
||||||
|
|
||||||
|
|
||||||
before_install:
|
before_install:
|
||||||
- mkdir .deps
|
- mkdir .deps
|
||||||
@ -80,7 +87,10 @@ before_install:
|
|||||||
before_script:
|
before_script:
|
||||||
- mkdir build
|
- mkdir build
|
||||||
- cd build
|
- cd build
|
||||||
- cmake ..
|
- cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE ..
|
||||||
|
|
||||||
script:
|
script:
|
||||||
make
|
make $CHECK_TARGET
|
||||||
|
|
||||||
|
after_success:
|
||||||
|
- bash <(curl -s https://codecov.io/bash)
|
@ -33,6 +33,9 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|||||||
set(C_WARNINGS -Wall -Wextra)
|
set(C_WARNINGS -Wall -Wextra)
|
||||||
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||||
|
|
||||||
|
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
||||||
|
include(coverage)
|
||||||
|
|
||||||
add_library(userdb STATIC
|
add_library(userdb STATIC
|
||||||
src/userdb/userdb.c
|
src/userdb/userdb.c
|
||||||
)
|
)
|
||||||
@ -119,4 +122,28 @@ configure_file(etc/webfused.conf webfused.conf COPYONLY)
|
|||||||
enable_testing()
|
enable_testing()
|
||||||
gtest_discover_tests(alltests TEST_PREFIX alltests:)
|
gtest_discover_tests(alltests TEST_PREFIX alltests:)
|
||||||
|
|
||||||
|
add_custom_target(check
|
||||||
|
./alltests)
|
||||||
|
add_dependencies(check alltests)
|
||||||
|
|
||||||
|
add_custom_target(memcheck
|
||||||
|
valgrind ./alltests)
|
||||||
|
add_dependencies(memcheck alltests)
|
||||||
|
|
||||||
|
add_custom_target(coverage
|
||||||
|
mkdir -p coverage
|
||||||
|
COMMAND lcov --initial --capture --directory . --output-file coverage/lcov.info
|
||||||
|
COMMAND ./alltests
|
||||||
|
COMMAND lcov --capture --directory . --output-file coverage/lcov.info
|
||||||
|
COMMAND lcov --remove coverage/lcov.info '/usr/*' --output-file coverage/lcov.info
|
||||||
|
# COMMAND lcov --remove coverage/lcov.info '*/test/*' --output-file coverage/lcov.info
|
||||||
|
)
|
||||||
|
add_dependencies(coverage alltests)
|
||||||
|
|
||||||
|
add_custom_target(coverage-report
|
||||||
|
COMMAND genhtml -branch-coverage --highlight --legend coverage/lcov.info --output-directory coverage/report
|
||||||
|
)
|
||||||
|
add_dependencies(coverage-report coverage)
|
||||||
|
|
||||||
|
|
||||||
endif(NOT WITHOUT_TESTS)
|
endif(NOT WITHOUT_TESTS)
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
[![Build Status](https://travis-ci.org/falk-werner/webfused.svg?branch=master)](https://travis-ci.org/falk-werner/webfused)
|
[![Build Status](https://travis-ci.org/falk-werner/webfused.svg?branch=master)](https://travis-ci.org/falk-werner/webfused)
|
||||||
|
[![codecov](https://codecov.io/gh/falk-werner/webfused/branch/config_file/graph/badge.svg)](https://codecov.io/gh/falk-werner/webfused)
|
||||||
|
|
||||||
# webfused
|
# webfused
|
||||||
|
|
||||||
|
30
cmake/coverage.cmake
Normal file
30
cmake/coverage.cmake
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
set(CMAKE_C_FLAGS_COVERAGE
|
||||||
|
"${CMAKE_C_FLAGS_DEBUG} -pg --coverage -fprofile-arcs -ftest-coverage"
|
||||||
|
CACHE STRING "Flags used by the C compiler during coverage builds"
|
||||||
|
FORCE
|
||||||
|
)
|
||||||
|
|
||||||
|
set(CMAKE_CXX_FLAGS_COVERAGE
|
||||||
|
"${CMAKE_CXX_FLAGS_DEBUG} -pg --coverage -fprofile-arcs -ftest-coverage"
|
||||||
|
CACHE STRING "Flags used by the C++ compiler during coverage builds."
|
||||||
|
FORCE
|
||||||
|
)
|
||||||
|
|
||||||
|
set(CMAKE_EXE_LINKER_FLAGS_COVERAGE
|
||||||
|
""
|
||||||
|
CACHE STRING "Flags used for linking binaries during coverage builds."
|
||||||
|
FORCE
|
||||||
|
)
|
||||||
|
|
||||||
|
set(CMAKE_SHARED_LINKER_FLAGS_COVERAGE
|
||||||
|
""
|
||||||
|
CACHE STRING "Flags used by the shared libraries linker during coverage builds."
|
||||||
|
FORCE
|
||||||
|
)
|
||||||
|
|
||||||
|
mark_as_advanced(
|
||||||
|
CMAKE_C_FLAGS_COVERAGE
|
||||||
|
CMAKE_CXX_FLAGS_COVERAGE
|
||||||
|
CMAKE_EXE_LINKER_FLAGS_COVERAGE
|
||||||
|
CMAKE_SHARED_LINKER_FLAGS_COVERAGE
|
||||||
|
)
|
Loading…
Reference in New Issue
Block a user