-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- moved configuration files from cpp-pthread into cpp-logger
- Loading branch information
1 parent
b11858f
commit 002f3ed
Showing
7 changed files
with
99 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
option(COVERAGE "Activate coverage") | ||
|
||
if (COVERAGE) | ||
|
||
# Handle coverage with GNU compilers | ||
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") | ||
message(STATUS "Detecting LCOV") | ||
find_program(LCOV lcov) | ||
if ( LCOV ) | ||
|
||
message(STATUS "Detecting LCOV [${LCOV}] - done") | ||
add_custom_target( coverage | ||
COMMAND ${CMAKE_CURRENT_LIST_DIR}/LCOV | ||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} | ||
COMMENT "Coverage report (${CMAKE_CURRENT_LIST_DIR}/LCOV)" | ||
VERBATIM | ||
) | ||
message(STATUS "Added custom build target [coverage]...") | ||
|
||
endif() | ||
|
||
message(STATUS "Setting GCOV --coverage compiler option") | ||
add_compile_options(--coverage) | ||
if (CMAKE_VERSION VERSION_GREATER "3.13.5") | ||
message(STATUS "Setting GCOV --coverage linker option") | ||
add_link_options(--coverage) | ||
else () | ||
message(STATUS "Setting GCOV --coverage option in linker related variables CMAKE_EXE_LINKER_FLAGS and CMAKE_SHARED_LINKER_FLAGS") | ||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --coverage") | ||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} --coverage") | ||
endif () | ||
endif () | ||
endif () |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/usr/bin/env sh | ||
|
||
# author: herbert koelman | ||
# | ||
# This shell script makes sure to handle only files that have produced coverage data. It comes with the | ||
# SonarConfig.cmake module | ||
# | ||
|
||
for source_gcda_file in $(find ./ -type f -name "*.gcda") | ||
do | ||
source_file=`basename $source_gcda_file .gcda` | ||
source_dir=`dirname $source_gcda_file` | ||
source_gcno_file=$source_dir/$source_file.gcno | ||
|
||
echo "Handling file [$source_gcno_file]------------------------" | ||
[ -f $source_gcno_file ] && gcov -m $source_gcno_file | ||
echo "Done -----------------------------------------------------" | ||
echo | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#8/usr/bin/env bash | ||
|
||
initialize_coverage_file="" | ||
|
||
for directory in $(find ./ -type f -name "*.gcda" -exec dirname {} \; | sort -u) | ||
do | ||
echo "Handling directory [$directory]" | ||
|
||
if [ "${initialize_coverage_file}" == "" ] | ||
then | ||
echo "Initializing [coverage.info] file" | ||
lcov --quiet --directory $directory --capture --output-file coverage.info | ||
initialize_coverage_file="`date`" | ||
else | ||
coverage_info=$(mktemp --suffix=.coverage) | ||
lcov --quiet --directory $directory --capture --output-file $coverage_info | ||
echo "Adding tracefile [$coverage_info] to [coverage.info]" | ||
lcov --quiet --add-tracefile $coverage_info --add-tracefile coverage.info --output-file coverage.info | ||
fi | ||
done | ||
lcov --quiet --remove coverage.info '/usr/*' --output-file coverage.info | ||
lcov --quiet --remove coverage.info '*/googletest/*' --output-file coverage.info | ||
lcov --list coverage.info |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters