[Cmake-commits] CMake branch, next, updated. v3.2.1-1407-gf7660ff

Nils Gladitz nilsgladitz at gmail.com
Fri Apr 3 06:12:39 EDT 2015


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  f7660ff8ca19f72de10d47698e5389700587148a (commit)
       via  93551ec45ffcb1f00e88a3e47f1c6cdedda783e8 (commit)
       via  3a427288c06f9dd0261b227360be2ec448e9b6f3 (commit)
       via  2cfcdd2b870025d776d0b5c246764f09594bdc34 (commit)
      from  fdf5e062c75d6d55f8e8fa8f3f6dd0efe3663340 (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 -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f7660ff8ca19f72de10d47698e5389700587148a
commit f7660ff8ca19f72de10d47698e5389700587148a
Merge: fdf5e06 93551ec
Author:     Nils Gladitz <nilsgladitz at gmail.com>
AuthorDate: Fri Apr 3 06:12:33 2015 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Fri Apr 3 06:12:33 2015 -0400

    Merge topic 'gcov-module-coverage-exclude' into next
    
    93551ec4 CTestCoverageCollectGCOV: Extended test case for CTEST_CUSTOM_COVERAGE_EXCLUDE
    3a427288 CTestCoverageCollectGCOV: Skip unnecessary loop iterations
    2cfcdd2b CTestCoverageCollectGCOV: Support CTEST_CUSTOM_COVERAGE_EXCLUDE


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=93551ec45ffcb1f00e88a3e47f1c6cdedda783e8
commit 93551ec45ffcb1f00e88a3e47f1c6cdedda783e8
Author:     Nils Gladitz <nilsgladitz at gmail.com>
AuthorDate: Fri Apr 3 11:42:37 2015 +0200
Commit:     Nils Gladitz <nilsgladitz at gmail.com>
CommitDate: Fri Apr 3 11:42:37 2015 +0200

    CTestCoverageCollectGCOV: Extended test case for CTEST_CUSTOM_COVERAGE_EXCLUDE

diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index 5944d08..2a54648 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -2350,7 +2350,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release
     )
   set_tests_properties(CTestCoverageCollectGCOV PROPERTIES
     PASS_REGULAR_EXPRESSION
-    "PASSED with correct output.*Testing/CoverageInfo/echoargs.gcov")
+    "PASSED with correct output.*Testing/CoverageInfo/main.cpp.gcov")
 
   configure_file(
     "${CMake_SOURCE_DIR}/Tests/CTestTestEmptyBinaryDirectory/test.cmake.in"
diff --git a/Tests/CTestCoverageCollectGCOV/TestProject/3rdparty/foo.cpp b/Tests/CTestCoverageCollectGCOV/TestProject/3rdparty/foo.cpp
new file mode 100644
index 0000000..85e6cd8
--- /dev/null
+++ b/Tests/CTestCoverageCollectGCOV/TestProject/3rdparty/foo.cpp
@@ -0,0 +1 @@
+void foo() {}
diff --git a/Tests/CTestCoverageCollectGCOV/TestProject/CMakeLists.txt b/Tests/CTestCoverageCollectGCOV/TestProject/CMakeLists.txt
new file mode 100644
index 0000000..a492fd3
--- /dev/null
+++ b/Tests/CTestCoverageCollectGCOV/TestProject/CMakeLists.txt
@@ -0,0 +1,33 @@
+cmake_minimum_required(VERSION 3.2)
+
+project(TestProject CXX)
+
+include(CTest)
+
+add_executable(myexecutable
+  main.cpp
+  3rdparty/foo.cpp
+  extra/extra.cpp
+)
+
+set_property(SOURCE main.cpp APPEND PROPERTY LABELS SourceLabel)
+set_property(TARGET myexecutable APPEND PROPERTY LABELS TargetLabel)
+
+add_custom_command(TARGET myexecutable
+  POST_BUILD
+  COMMAND ${CMAKE_COMMAND} -
+    -DTARGET=myexecutable
+    "-DSOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}"
+    "-DSOURCES=$<TARGET_PROPERTY:myexecutable,SOURCES>"
+    -P "${CMAKE_CURRENT_SOURCE_DIR}/fake_compile_time_gcno.cmake"
+  VERBATIM
+)
+
+add_test(NAME mytest
+  COMMAND ${CMAKE_COMMAND}
+    "-DMYEXECUTABLE=$<TARGET_FILE:myexecutable>"
+    "-DTARGETDIR=${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/myexecutable.dir"
+    -P "${CMAKE_CURRENT_SOURCE_DIR}/fake_run_time_gcda.cmake"
+)
+
+set_property(TEST mytest APPEND PROPERTY LABELS TestLabel)
diff --git a/Tests/CTestCoverageCollectGCOV/TestProject/extra/extra.cpp b/Tests/CTestCoverageCollectGCOV/TestProject/extra/extra.cpp
new file mode 100644
index 0000000..c3a2c12
--- /dev/null
+++ b/Tests/CTestCoverageCollectGCOV/TestProject/extra/extra.cpp
@@ -0,0 +1 @@
+void extra() {}
diff --git a/Tests/CTestCoverageCollectGCOV/TestProject/fake_compile_time_gcno.cmake b/Tests/CTestCoverageCollectGCOV/TestProject/fake_compile_time_gcno.cmake
new file mode 100644
index 0000000..5c87589
--- /dev/null
+++ b/Tests/CTestCoverageCollectGCOV/TestProject/fake_compile_time_gcno.cmake
@@ -0,0 +1,5 @@
+foreach(source ${SOURCES})
+  file(WRITE "CMakeFiles/${TARGET}.dir/${source}.gcno"
+    "${SOURCE_DIR}/${source}"
+  )
+endforeach()
diff --git a/Tests/CTestCoverageCollectGCOV/TestProject/fake_run_time_gcda.cmake b/Tests/CTestCoverageCollectGCOV/TestProject/fake_run_time_gcda.cmake
new file mode 100644
index 0000000..26ce2bd
--- /dev/null
+++ b/Tests/CTestCoverageCollectGCOV/TestProject/fake_run_time_gcda.cmake
@@ -0,0 +1,12 @@
+execute_process(COMMAND ${MYEXECUTABLE} RESULT_VARIABLE RESULT)
+
+if(NOT RESULT_VARIABLE STREQUAL "0")
+  message("Test failure")
+endif()
+
+file(GLOB_RECURSE gcno_files "${TARGETDIR}/*.gcno")
+
+foreach(gcno_file ${gcno_files})
+  string(REPLACE ".gcno" ".gcda" gcda_file "${gcno_file}")
+  configure_file(${gcno_file} ${gcda_file} COPYONLY)
+endforeach()
diff --git a/Tests/CTestCoverageCollectGCOV/TestProject/main.cpp b/Tests/CTestCoverageCollectGCOV/TestProject/main.cpp
new file mode 100644
index 0000000..237c8ce
--- /dev/null
+++ b/Tests/CTestCoverageCollectGCOV/TestProject/main.cpp
@@ -0,0 +1 @@
+int main() {}
diff --git a/Tests/CTestCoverageCollectGCOV/fakegcov.cmake b/Tests/CTestCoverageCollectGCOV/fakegcov.cmake
index e704f14..c7b563f 100644
--- a/Tests/CTestCoverageCollectGCOV/fakegcov.cmake
+++ b/Tests/CTestCoverageCollectGCOV/fakegcov.cmake
@@ -3,6 +3,12 @@ foreach(I RANGE 0 ${CMAKE_ARGC})
     set(gcda_file "${CMAKE_ARGV${I}}")
   endif()
 endforeach()
-get_filename_component(gcda_file ${gcda_file} NAME_WE)
-file(WRITE "${CMAKE_SOURCE_DIR}/${gcda_file}.gcov"
-"fake gcov file")
+
+get_filename_component(gcda_name ${gcda_file} NAME)
+string(REPLACE ".gcda" ".gcov" gcov_name "${gcda_name}")
+
+file(STRINGS "${gcda_file}" source_file LIMIT_COUNT 1)
+
+file(WRITE "${CMAKE_SOURCE_DIR}/${gcov_name}"
+  "        -:    0:Source:${source_file}"
+)
diff --git a/Tests/CTestCoverageCollectGCOV/test.cmake.in b/Tests/CTestCoverageCollectGCOV/test.cmake.in
index 4bdcb10..c5613fb 100644
--- a/Tests/CTestCoverageCollectGCOV/test.cmake.in
+++ b/Tests/CTestCoverageCollectGCOV/test.cmake.in
@@ -1,16 +1,21 @@
 cmake_minimum_required(VERSION 2.8.12)
-set(CTEST_PROJECT_NAME "SmallAndFast")
-set(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTest/SmallAndFast")
-set(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestCoverageCollectGCOV")
+set(CTEST_PROJECT_NAME "TestProject")
+set(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestCoverageCollectGCOV/TestProject")
+set(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestCoverageCollectGCOV/TestProject")
 set(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@")
+
+ctest_empty_binary_directory(${CTEST_BINARY_DIRECTORY})
+
 ctest_start(Experimental)
 ctest_configure()
 ctest_build()
 ctest_test()
 
-file(WRITE ${CTEST_BINARY_DIRECTORY}/CMakeFiles/echoargs.dir/echoargs.gcda
-"dummy
-")
+list(APPEND CTEST_CUSTOM_COVERAGE_EXCLUDE
+	"/foo/something"
+	"/3rdparty/"
+	"/bar/somethingelse"
+)
 
 include(CTestCoverageCollectGCOV)
 set(tar_file ${CTEST_BINARY_DIRECTORY}/gcov.tar)
@@ -27,9 +32,10 @@ execute_process(COMMAND
       WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR})
 
 set(expected_out
-"Testing/CoverageInfo/echoargs.gcov
+"Testing/CoverageInfo/main.cpp.gcov
+Testing/CoverageInfo/extra.cpp.gcov
 Testing/CoverageInfo/data.json
-CMakeFiles/echoargs.dir/Labels.json
+CMakeFiles/myexecutable.dir/Labels.json
 ")
 
 if("${out}" STREQUAL "${expected_out}")

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3a427288c06f9dd0261b227360be2ec448e9b6f3
commit 3a427288c06f9dd0261b227360be2ec448e9b6f3
Author:     Nils Gladitz <nilsgladitz at gmail.com>
AuthorDate: Thu Apr 2 20:39:42 2015 +0200
Commit:     Nils Gladitz <nilsgladitz at gmail.com>
CommitDate: Thu Apr 2 20:39:42 2015 +0200

    CTestCoverageCollectGCOV: Skip unnecessary loop iterations

diff --git a/Modules/CTestCoverageCollectGCOV.cmake b/Modules/CTestCoverageCollectGCOV.cmake
index 0a74e97..db86751 100644
--- a/Modules/CTestCoverageCollectGCOV.cmake
+++ b/Modules/CTestCoverageCollectGCOV.cmake
@@ -162,12 +162,14 @@ function(ctest_coverage_collect_gcov)
     endif()
 
     foreach(exclude_entry ${CTEST_CUSTOM_COVERAGE_EXCLUDE})
-      if(NOT is_excluded AND source_file MATCHES "${exclude_entry}")
+      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()
 

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2cfcdd2b870025d776d0b5c246764f09594bdc34
commit 2cfcdd2b870025d776d0b5c246764f09594bdc34
Author:     Nils Gladitz <nilsgladitz at gmail.com>
AuthorDate: Thu Apr 2 17:02:08 2015 +0200
Commit:     Nils Gladitz <nilsgladitz at gmail.com>
CommitDate: Thu Apr 2 17:02:08 2015 +0200

    CTestCoverageCollectGCOV: Support CTEST_CUSTOM_COVERAGE_EXCLUDE

diff --git a/Modules/CTestCoverageCollectGCOV.cmake b/Modules/CTestCoverageCollectGCOV.cmake
index 4519627..0a74e97 100644
--- a/Modules/CTestCoverageCollectGCOV.cmake
+++ b/Modules/CTestCoverageCollectGCOV.cmake
@@ -147,8 +147,35 @@ 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)
+
+    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(NOT is_excluded AND source_file MATCHES "${exclude_entry}")
+        set(is_excluded true)
+
+        if(NOT GCOV_QUIET)
+          message("Excluding coverage for: ${source_file} which matches ${exclude_entry}")
+        endif()
+      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

-----------------------------------------------------------------------

Summary of changes:
 Modules/CTestCoverageCollectGCOV.cmake             |   31 +++++++++++++++++-
 Tests/CMakeLists.txt                               |    2 +-
 .../TestProject/3rdparty/foo.cpp                   |    1 +
 .../TestProject/CMakeLists.txt                     |   33 ++++++++++++++++++++
 .../TestProject/extra/extra.cpp                    |    1 +
 .../TestProject/fake_compile_time_gcno.cmake       |    5 +++
 .../TestProject/fake_run_time_gcda.cmake           |   12 +++++++
 .../TestProject/main.cpp}                          |    0
 Tests/CTestCoverageCollectGCOV/fakegcov.cmake      |   12 +++++--
 Tests/CTestCoverageCollectGCOV/test.cmake.in       |   22 ++++++++-----
 10 files changed, 106 insertions(+), 13 deletions(-)
 create mode 100644 Tests/CTestCoverageCollectGCOV/TestProject/3rdparty/foo.cpp
 create mode 100644 Tests/CTestCoverageCollectGCOV/TestProject/CMakeLists.txt
 create mode 100644 Tests/CTestCoverageCollectGCOV/TestProject/extra/extra.cpp
 create mode 100644 Tests/CTestCoverageCollectGCOV/TestProject/fake_compile_time_gcno.cmake
 create mode 100644 Tests/CTestCoverageCollectGCOV/TestProject/fake_run_time_gcda.cmake
 copy Tests/{MissingInstall/mybin.cpp => CTestCoverageCollectGCOV/TestProject/main.cpp} (100%)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list