[Cmake-commits] CMake branch, next, updated. v3.5.0-rc1-116-ga629eb2
Zack Galbreath
zack.galbreath at kitware.com
Wed Feb 10 10:13:05 EST 2016
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".
The branch, next has been updated
via a629eb2813e0c05d32079431389d80aadecb0818 (commit)
via 062045b8b6887cd8a59c384dfca23b83747568b5 (commit)
from 77582d137e5bc84b4969f0870a3bf8f17fb071c9 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a629eb2813e0c05d32079431389d80aadecb0818
commit a629eb2813e0c05d32079431389d80aadecb0818
Merge: 77582d1 062045b
Author: Zack Galbreath <zack.galbreath at kitware.com>
AuthorDate: Wed Feb 10 10:13:04 2016 -0500
Commit: CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Wed Feb 10 10:13:04 2016 -0500
Merge topic 'cross_subproject_coverage' into next
062045b8 More options for CTestCoverageCollectGCOV
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=062045b8b6887cd8a59c384dfca23b83747568b5
commit 062045b8b6887cd8a59c384dfca23b83747568b5
Author: Zack Galbreath <zack.galbreath at kitware.com>
AuthorDate: Wed Feb 10 10:02:02 2016 -0500
Commit: Zack Galbreath <zack.galbreath at kitware.com>
CommitDate: Wed Feb 10 10:12:01 2016 -0500
More options for CTestCoverageCollectGCOV
This commit introduces two new options to CTestCoverageCollectGCOV.
When GLOB is set we recursively search in the source & binary
directories for .gcda files. Otherwise the default behavior is to
parse TargetDirectories.txt for a list of locations to search.
When DELETE is set we remove any .gcda file found after it has
been used to generate the corresponding .gcov file. The .gcov
file is also removed after the result tarball has been created.
Together these two new features help support the use case of
computing coverage across subprojects.
diff --git a/Modules/CTestCoverageCollectGCOV.cmake b/Modules/CTestCoverageCollectGCOV.cmake
index ef3aa76..f31e432 100644
--- a/Modules/CTestCoverageCollectGCOV.cmake
+++ b/Modules/CTestCoverageCollectGCOV.cmake
@@ -46,6 +46,13 @@
# is run as ``gcov <options>... -o <gcov-dir> <file>.gcda``.
# If not specified, the default option is just ``-b``.
#
+# ``GLOB``
+# Recursively search for .gcda files in build_dir rather than
+# determining search locations by reading TargetDirectories.txt.
+#
+# ``DELETE``
+# Delete coverage files after they've been packaged into the .tar.
+#
# ``QUIET``
# Suppress non-error messages that otherwise would have been
# printed out by this function.
@@ -64,7 +71,7 @@
# License text for the above reference.)
include(CMakeParseArguments)
function(ctest_coverage_collect_gcov)
- set(options QUIET)
+ set(options QUIET GLOB DELETE)
set(oneValueArgs TARBALL SOURCE BUILD GCOV_COMMAND)
set(multiValueArgs GCOV_OPTIONS)
cmake_parse_arguments(GCOV "${options}" "${oneValueArgs}"
@@ -91,22 +98,32 @@ function(ctest_coverage_collect_gcov)
# run gcov on each gcda file in the binary tree
set(gcda_files)
set(label_files)
- # look for gcda files in the target directories
- # could do a glob from the top of the binary tree but
- # this will be faster and only look where the files will be
- file(STRINGS "${binary_dir}/CMakeFiles/TargetDirectories.txt" target_dirs
- ENCODING UTF-8)
- foreach(target_dir ${target_dirs})
- file(GLOB_RECURSE gfiles RELATIVE ${binary_dir} "${target_dir}/*.gcda")
- list(LENGTH gfiles len)
- # if we have gcda files then also grab the labels file for that target
- if(${len} GREATER 0)
- file(GLOB_RECURSE lfiles RELATIVE ${binary_dir}
- "${target_dir}/Labels.json")
- list(APPEND gcda_files ${gfiles})
- list(APPEND label_files ${lfiles})
- endif()
- endforeach()
+ if (GCOV_GLOB)
+ file(GLOB_RECURSE gfiles RELATIVE ${binary_dir} "*.gcda")
+ list(LENGTH gfiles len)
+ # if we have gcda files then also grab the labels file for that target
+ if(${len} GREATER 0)
+ file(GLOB_RECURSE lfiles RELATIVE ${binary_dir} "Labels.json")
+ list(APPEND gcda_files ${gfiles})
+ list(APPEND label_files ${lfiles})
+ endif()
+ else()
+ # look for gcda files in the target directories
+ # this will be faster and only look where the files will be
+ file(STRINGS "${binary_dir}/CMakeFiles/TargetDirectories.txt" target_dirs
+ ENCODING UTF-8)
+ foreach(target_dir ${target_dirs})
+ file(GLOB_RECURSE gfiles RELATIVE ${binary_dir} "${target_dir}/*.gcda")
+ list(LENGTH gfiles len)
+ # if we have gcda files then also grab the labels file for that target
+ if(${len} GREATER 0)
+ file(GLOB_RECURSE lfiles RELATIVE ${binary_dir}
+ "${target_dir}/Labels.json")
+ list(APPEND gcda_files ${gfiles})
+ list(APPEND label_files ${lfiles})
+ endif()
+ endforeach()
+ endif()
# return early if no coverage files were found
list(LENGTH gcda_files len)
if(len EQUAL 0)
@@ -134,6 +151,11 @@ function(ctest_coverage_collect_gcov)
OUTPUT_VARIABLE out
RESULT_VARIABLE res
WORKING_DIRECTORY ${coverage_dir})
+
+ if (GCOV_DELETE)
+ file(REMOVE ${gcda_file})
+ endif()
+
endforeach()
if(NOT "${res}" EQUAL 0)
if (NOT GCOV_QUIET)
@@ -201,4 +223,12 @@ ${label_files}
"--format=gnutar"
--files-from=${coverage_dir}/coverage_file_list.txt
WORKING_DIRECTORY ${binary_dir})
+
+ if (GCOV_DELETE)
+ string(REPLACE "\n" ";" gcov_files "${gcov_files}")
+ foreach(gcov_file ${gcov_files})
+ file(REMOVE ${binary_dir}/${gcov_file})
+ endforeach()
+ endif()
+
endfunction()
-----------------------------------------------------------------------
Summary of changes:
Modules/CTestCoverageCollectGCOV.cmake | 64 +++++++++++++++++++++++---------
1 file changed, 47 insertions(+), 17 deletions(-)
hooks/post-receive
--
CMake
More information about the Cmake-commits
mailing list