[Cmake-commits] CMake branch, next, updated. v3.5.1-758-ge929420
Zack Galbreath
zack.galbreath at kitware.com
Fri Apr 1 08:43:57 EDT 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 e929420e7af7d60aab7306f1af3956b31c30737c (commit)
via 83c6183c1aabd0ac3309d87c8c10678b55c2e489 (commit)
via 332272e29b33e334b01790fa16d2451d69749c5b (commit)
from 58a4efca93fa9255a920a0bfa0890d3858acf656 (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=e929420e7af7d60aab7306f1af3956b31c30737c
commit e929420e7af7d60aab7306f1af3956b31c30737c
Merge: 58a4efc 83c6183
Author: Zack Galbreath <zack.galbreath at kitware.com>
AuthorDate: Fri Apr 1 08:43:51 2016 -0400
Commit: CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Fri Apr 1 08:43:51 2016 -0400
Merge topic 'branch_coverage_glob' into next
83c6183c CTestCoverageCollectGCOV: Improve documentation
332272e2 CTestCoverageCollectGCOV: Honor CTEST_EXTRA_COVERAGE_GLOB
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=83c6183c1aabd0ac3309d87c8c10678b55c2e489
commit 83c6183c1aabd0ac3309d87c8c10678b55c2e489
Author: Zack Galbreath <zack.galbreath at kitware.com>
AuthorDate: Thu Mar 31 14:17:03 2016 -0400
Commit: Zack Galbreath <zack.galbreath at kitware.com>
CommitDate: Thu Mar 31 14:17:03 2016 -0400
CTestCoverageCollectGCOV: Improve documentation
Clean up prose and mention support for CTEST_EXTRA_COVERAGE_GLOB.
diff --git a/Modules/CTestCoverageCollectGCOV.cmake b/Modules/CTestCoverageCollectGCOV.cmake
index 493c490..7d387a5 100644
--- a/Modules/CTestCoverageCollectGCOV.cmake
+++ b/Modules/CTestCoverageCollectGCOV.cmake
@@ -2,14 +2,19 @@
# CTestCoverageCollectGCOV
# ------------------------
#
-# This module provides the function ``ctest_coverage_collect_gcov``.
-# The function will run gcov on the .gcda files in a binary tree and then
-# package all of the .gcov files into a tar file with a data.json that
-# contains the source and build directories for CDash to use in parsing
-# the coverage data. In addtion the Labels.json files for targets that
-# have coverage information are also put in the tar file for CDash to
-# asign the correct labels. This file can be sent to a CDash server for
-# display with the
+# This module provides the ``ctest_coverage_collect_gcov`` function.
+#
+# This function runs gcov on all .gcda files found in the binary tree
+# and packages the resulting .gcov files into a tar file.
+# This tarball also contains the following:
+#
+# * *data.json* defines the source and build directories for use by CDash.
+# * *Labels.json* indicates any :prop_sf:`LABELS` that have been set on the
+# source files.
+# * The *uncovered* directory holds any uncovered files found by
+# :variable:`CTEST_EXTRA_COVERAGE_GLOB`.
+#
+# After generating this tar file, it can be sent to CDash for display with the
# :command:`ctest_submit(CDASH_UPLOAD)` command.
#
# .. command:: cdash_coverage_collect_gcov
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=332272e29b33e334b01790fa16d2451d69749c5b
commit 332272e29b33e334b01790fa16d2451d69749c5b
Author: Zack Galbreath <zack.galbreath at kitware.com>
AuthorDate: Wed Mar 30 10:31:25 2016 -0400
Commit: Zack Galbreath <zack.galbreath at kitware.com>
CommitDate: Wed Mar 30 10:54:49 2016 -0400
CTestCoverageCollectGCOV: Honor CTEST_EXTRA_COVERAGE_GLOB
Teach CTestCoverageCollectGCOV to honor the
CTEST_EXTRA_COVERAGE_GLOB variable. When this variable is set,
this module will glob for matching source files that were not
covered and include them in the resulting tar file.
diff --git a/Modules/CTestCoverageCollectGCOV.cmake b/Modules/CTestCoverageCollectGCOV.cmake
index f31e432..493c490 100644
--- a/Modules/CTestCoverageCollectGCOV.cmake
+++ b/Modules/CTestCoverageCollectGCOV.cmake
@@ -172,6 +172,21 @@ function(ctest_coverage_collect_gcov)
set(unfiltered_gcov_files)
file(GLOB_RECURSE unfiltered_gcov_files RELATIVE ${binary_dir} "${coverage_dir}/*.gcov")
+ # if CTEST_EXTRA_COVERAGE_GLOB was specified we search for files
+ # that might be uncovered
+ if (DEFINED CTEST_EXTRA_COVERAGE_GLOB)
+ set(uncovered_files)
+ foreach(search_entry IN LISTS CTEST_EXTRA_COVERAGE_GLOB)
+ if(NOT GCOV_QUIET)
+ message("Add coverage glob: ${search_entry}")
+ endif()
+ file(GLOB_RECURSE matching_files "${source_dir}/${search_entry}")
+ if (matching_files)
+ list(APPEND uncovered_files "${matching_files}")
+ endif()
+ endforeach()
+ endif()
+
set(gcov_files)
foreach(gcov_file ${unfiltered_gcov_files})
file(STRINGS ${binary_dir}/${gcov_file} first_line LIMIT_COUNT 1 ENCODING UTF-8)
@@ -195,20 +210,45 @@ function(ctest_coverage_collect_gcov)
endif()
endforeach()
+ foreach(uncovered_file IN LISTS uncovered_files)
+ if (uncovered_file STREQUAL source_file)
+ list(REMOVE_ITEM uncovered_files "${uncovered_file}")
+ endif()
+ endforeach()
+
if(NOT is_excluded)
list(APPEND gcov_files ${gcov_file})
endif()
endforeach()
+ foreach (uncovered_file ${uncovered_files})
+ # Copy from source to binary dir, preserving any intermediate subdirectories.
+ get_filename_component(filename "${uncovered_file}" NAME)
+ get_filename_component(relative_path "${uncovered_file}" DIRECTORY)
+ string(REPLACE "${source_dir}" "" relative_path "${relative_path}")
+ if (relative_path)
+ # Strip leading slash.
+ string(SUBSTRING "${relative_path}" 1 -1 relative_path)
+ endif()
+ file(COPY ${uncovered_file} DESTINATION ${binary_dir}/uncovered/${relative_path})
+ if(relative_path)
+ list(APPEND uncovered_files_for_tar uncovered/${relative_path}/${filename})
+ else()
+ list(APPEND uncovered_files_for_tar uncovered/${filename})
+ 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
string(REPLACE ";" "\n" gcov_files "${gcov_files}")
string(REPLACE ";" "\n" label_files "${label_files}")
+ string(REPLACE ";" "\n" uncovered_files_for_tar "${uncovered_files_for_tar}")
file(WRITE "${coverage_dir}/coverage_file_list.txt"
"${gcov_files}
${coverage_dir}/data.json
${label_files}
+${uncovered_files_for_tar}
")
if (GCOV_QUIET)
diff --git a/Tests/CTestCoverageCollectGCOV/TestProject/extra/uncovered1.cpp b/Tests/CTestCoverageCollectGCOV/TestProject/extra/uncovered1.cpp
new file mode 100644
index 0000000..e69de29
diff --git a/Tests/CTestCoverageCollectGCOV/TestProject/uncovered2.cpp b/Tests/CTestCoverageCollectGCOV/TestProject/uncovered2.cpp
new file mode 100644
index 0000000..e69de29
diff --git a/Tests/CTestCoverageCollectGCOV/test.cmake.in b/Tests/CTestCoverageCollectGCOV/test.cmake.in
index b2e6d6d..ec32113 100644
--- a/Tests/CTestCoverageCollectGCOV/test.cmake.in
+++ b/Tests/CTestCoverageCollectGCOV/test.cmake.in
@@ -16,6 +16,7 @@ list(APPEND CTEST_CUSTOM_COVERAGE_EXCLUDE
"/3rdparty/"
"/bar/somethingelse"
)
+list(APPEND CTEST_EXTRA_COVERAGE_GLOB "*.cpp")
include(CTestCoverageCollectGCOV)
set(tar_file ${CTEST_BINARY_DIRECTORY}/gcov.tar)
@@ -41,6 +42,8 @@ set(expected_out
Testing/CoverageInfo/data.json
Testing/CoverageInfo/extra.cpp.gcov
Testing/CoverageInfo/main.cpp.gcov
+ uncovered/extra/uncovered1.cpp
+ uncovered/uncovered2.cpp
)
if("${out}" STREQUAL "${expected_out}")
-----------------------------------------------------------------------
Summary of changes:
Modules/CTestCoverageCollectGCOV.cmake | 61 +++++++++++++++++---
.../TestProject/extra/uncovered1.cpp | 0
.../TestProject/uncovered2.cpp | 0
Tests/CTestCoverageCollectGCOV/test.cmake.in | 3 +
4 files changed, 56 insertions(+), 8 deletions(-)
copy Modules/IntelVSImplicitPath/hello.f => Tests/CTestCoverageCollectGCOV/TestProject/extra/uncovered1.cpp (100%)
copy Modules/IntelVSImplicitPath/hello.f => Tests/CTestCoverageCollectGCOV/TestProject/uncovered2.cpp (100%)
hooks/post-receive
--
CMake
More information about the Cmake-commits
mailing list