summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2015-04-06 12:58:21 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2015-04-06 12:58:21 (GMT)
commitdfbde6fa991e60853a9f7ad165c4b8c8416a9ba4 (patch)
treed870b221de8bba67d7342ce4287349f4feb7bcf1 /Modules
parent89ee57f6c79858bf350a5afce2ef588348dacb1c (diff)
parent9a544f2d987df940625465129a5f00bea01ad4eb (diff)
downloadCMake-dfbde6fa991e60853a9f7ad165c4b8c8416a9ba4.zip
CMake-dfbde6fa991e60853a9f7ad165c4b8c8416a9ba4.tar.gz
CMake-dfbde6fa991e60853a9f7ad165c4b8c8416a9ba4.tar.bz2
Merge topic 'gcov-module-coverage-exclude'
9a544f2d CTestCoverageCollectGCOV: Support CTEST_CUSTOM_COVERAGE_EXCLUDE
Diffstat (limited to 'Modules')
-rw-r--r--Modules/CTestCoverageCollectGCOV.cmake31
1 files changed, 30 insertions, 1 deletions
diff --git a/Modules/CTestCoverageCollectGCOV.cmake b/Modules/CTestCoverageCollectGCOV.cmake
index 4519627..8659a69 100644
--- a/Modules/CTestCoverageCollectGCOV.cmake
+++ b/Modules/CTestCoverageCollectGCOV.cmake
@@ -147,8 +147,37 @@ function(ctest_coverage_collect_gcov)
\"Binary\": \"${binary_dir}\"
}")
# collect the gcov files
+ set(unfiltered_gcov_files)
+ file(GLOB_RECURSE unfiltered_gcov_files RELATIVE ${binary_dir} "${coverage_dir}/*.gcov")
+
set(gcov_files)
- file(GLOB_RECURSE gcov_files RELATIVE ${binary_dir} "${coverage_dir}/*.gcov")
+ foreach(gcov_file ${unfiltered_gcov_files})
+ file(STRINGS ${binary_dir}/${gcov_file} first_line LIMIT_COUNT 1 ENCODING UTF-8)
+
+ set(is_excluded false)
+ if(first_line MATCHES "^ -: 0:Source:(.*)$")
+ set(source_file ${CMAKE_MATCH_1})
+ elseif(NOT GCOV_QUIET)
+ message(STATUS "Could not determine source file corresponding to: ${gcov_file}")
+ endif()
+
+ foreach(exclude_entry ${CTEST_CUSTOM_COVERAGE_EXCLUDE})
+ if(source_file MATCHES "${exclude_entry}")
+ set(is_excluded true)
+
+ if(NOT GCOV_QUIET)
+ message("Excluding coverage for: ${source_file} which matches ${exclude_entry}")
+ endif()
+
+ break()
+ endif()
+ endforeach()
+
+ if(NOT is_excluded)
+ list(APPEND gcov_files ${gcov_file})
+ endif()
+ endforeach()
+
# tar up the coverage info with the same date so that the md5
# sum will be the same for the tar file independent of file time
# stamps