diff options
author | Charles Kerr <charles.kerr@canonical.com> | 2014-01-27 01:24:20 -0600 |
---|---|---|
committer | Charles Kerr <charles.kerr@canonical.com> | 2014-01-27 01:24:20 -0600 |
commit | c1ffb9cd6082acb7aa7e820a7ed852adc7ae648d (patch) | |
tree | 9789615ca80de11f37e3e69e04ab833c56dd606d | |
parent | 7b09a0ff5652bdca7c8d8e046d2af6a696f94147 (diff) | |
download | ayatana-indicator-datetime-c1ffb9cd6082acb7aa7e820a7ed852adc7ae648d.tar.gz ayatana-indicator-datetime-c1ffb9cd6082acb7aa7e820a7ed852adc7ae648d.tar.bz2 ayatana-indicator-datetime-c1ffb9cd6082acb7aa7e820a7ed852adc7ae648d.zip |
re-enable coverage-html reports
-rw-r--r-- | cmake/GCov.cmake | 3 | ||||
-rw-r--r-- | src/CMakeLists.txt | 9 | ||||
-rwxr-xr-x | trim-lcov.py | 53 |
3 files changed, 56 insertions, 9 deletions
diff --git a/cmake/GCov.cmake b/cmake/GCov.cmake index 8df10ee..81c0c40 100644 --- a/cmake/GCov.cmake +++ b/cmake/GCov.cmake @@ -29,7 +29,8 @@ if (CMAKE_BUILD_TYPE MATCHES coverage) WORKING_DIRECTORY ${CMAKE_BINARY_DIR} COMMAND "${CMAKE_CTEST_COMMAND}" --force-new-ctest-process --verbose COMMAND "${LCOV_EXECUTABLE}" --directory ${CMAKE_BINARY_DIR} --capture | ${CMAKE_SOURCE_DIR}/trim-lcov.py > dconf-lcov.info - COMMAND LANG=C "${GENHTML_EXECUTABLE}" --prefix ${CMAKE_BINARY_DIR} --output-directory lcov-html --legend --show-details dconf-lcov.info + COMMAND "${LCOV_EXECUTABLE}" -r dconf-lcov.info /usr/include/\\* -o nosys-lcov.info + COMMAND LANG=C "${GENHTML_EXECUTABLE}" --prefix ${CMAKE_BINARY_DIR} --output-directory lcov-html --legend --show-details nosys-lcov.info COMMAND ${CMAKE_COMMAND} -E echo "" COMMAND ${CMAKE_COMMAND} -E echo "file://${CMAKE_BINARY_DIR}/lcov-html/index.html" COMMAND ${CMAKE_COMMAND} -E echo "") diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a90fcbf..b8c62fd 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,7 +1,7 @@ set (SERVICE_LIB "indicatordatetimeservice") set (SERVICE_EXEC "indicator-datetime-service") -SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -g ${CXX_WARNING_ARGS}") +SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -g ${CXX_WARNING_ARGS} ${GCOV_FLAGS}") add_definitions (-DTIMEZONE_FILE="/etc/timezone" -DG_LOG_DOMAIN="Indicator-Datetime") @@ -33,14 +33,7 @@ add_library (${SERVICE_LIB} STATIC include_directories (${CMAKE_SOURCE_DIR}) link_directories (${SERVICE_DEPS_LIBRARY_DIRS}) - add_executable (${SERVICE_EXEC} main.cpp) target_link_libraries (${SERVICE_EXEC} ${SERVICE_LIB} ${SERVICE_DEPS_LIBRARIES} ${GCOV_LIBS}) install (TARGETS ${SERVICE_EXEC} RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_PKGLIBEXECDIR}) -# common properties -#set_property (TARGET ${SERVICE_LIB} ${SERVICE_EXEC} -# APPEND_STRING PROPERTY COMPILE_FLAGS -# " -g ${CC_WARNING_ARGS} ${GCOV_FLAGS}") - - diff --git a/trim-lcov.py b/trim-lcov.py new file mode 100755 index 0000000..78613d3 --- /dev/null +++ b/trim-lcov.py @@ -0,0 +1,53 @@ +#!/usr/bin/python + +# This script removes branch and/or line coverage data for lines that +# contain a particular substring. +# +# In the interest of "fairness" it removes all branch or coverage data +# when a match is found -- not just negative data. It is therefore +# likely that running this script will actually reduce the total number +# of lines and branches that are marked as covered (in absolute terms). +# +# This script intentionally avoids checking for errors. Any exceptions +# will trigger make to fail. +# +# Author: Ryan Lortie <desrt@desrt.ca> + +import sys + +line_suppress = ['g_assert_not_reached'] +branch_suppress = ['g_assert', 'g_return_if_fail', 'g_clear_object', 'g_clear_pointer', 'g_return_val_if_fail', 'G_DEFINE_TYPE'] + +def check_suppress(suppressions, source, data): + line, _, rest = data.partition(',') + line = int(line) - 1 + + assert line < len(source) + + for suppression in suppressions: + if suppression in source[line]: + return True + + return False + +source = [] +for line in sys.stdin: + line = line[:-1] + + keyword, _, rest = line.partition(':') + + # Source file + if keyword == 'SF': + source = file(rest).readlines() + + # Branch coverage data + elif keyword == 'BRDA': + if check_suppress(branch_suppress, source, rest): + continue + + # Line coverage data + elif keyword == 'DA': + if check_suppress(line_suppress, source, rest): + continue + + print line |