]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add Coverage support
authorMatthias Maier <tamiko@kyomu.43-1.org>
Thu, 17 Oct 2013 10:47:36 +0000 (10:47 +0000)
committerMatthias Maier <tamiko@kyomu.43-1.org>
Thu, 17 Oct 2013 10:47:36 +0000 (10:47 +0000)
git-svn-id: https://svn.dealii.org/branches/branch_port_the_testsuite@31279 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/cmake/scripts/run_testsuite.cmake
deal.II/cmake/setup_cached_variables.cmake
deal.II/cmake/setup_compiler_flags_gnu.cmake
deal.II/doc/users/Config.sample
deal.II/doc/users/cmake.html

index 6e496b0b556f9da83aebcfbf5fbe7af1c908beff..d9ab676ae2aa7b3762868565565b0e56e616ad04 100644 (file)
 #       # cmake -C ${CONFIG_FILE}). This only has an effect if
 #       CTEST_BINARY_DIRECTORY is empty.
 #
+#   COVERAGE
+#     - If set to TRUE deal.II will be configured with
+#       DEAL_II_SETUP_COVERAGE=TRUE and the CTEST_COVERAGE() stage will
+#       be run. Test results must go into the "Experimental" section
+#
 # Furthermore, the following variables controlling the testsuite can be set
 # and will be automatically handed down to cmake:
 #
@@ -254,6 +259,11 @@ FOREACH(_var ${_variables})
   ENDIF()
 ENDFOREACH()
 
+IF(COVERAGE)
+  LIST(APPEND _options "-DDEAL_II_SETUP_COVERAGE=TRUE")
+  LIST(APPEND _options "-DCMAKE_BUILD_TYPE=Debug")
+ENDIF()
+
 #
 # CTEST_BUILD_NAME:
 #
@@ -371,6 +381,23 @@ SET(CTEST_NOTES_FILES
   ${CTEST_BINARY_DIRECTORY}/include/deal.II/base/config.h
   )
 
+#
+# Setup coverage:
+#
+IF(COVERAGE)
+  FIND_PROGRAM(GCOV_COMMAND NAMES gcov)
+
+  IF(GCOV_COMMAND MATCHES "-NOTFOUND")
+    MESSAGE(FATAL_ERROR "
+TRACK was set to \"Build Tests\" which requires the source directory to be
+under Subversion version control.
+"
+      )
+  ENDIF()
+
+  SET(CTEST_COVERAGE_COMMAND "${GCOV_COMMAND}")
+ENDIF()
+
 
 ########################################################################
 #                                                                      #
@@ -406,6 +433,11 @@ IF("${_res}" STREQUAL "0")
     ENDIF()
 
     CTEST_TEST()
+
+    IF(COVERAGE)
+      CTEST_COVERAGE()
+    ENDIF(COVERAGE)
+
   ENDIF()
 ENDIF()
 
index c2e04fe20dd5c0cc5913c5f17187c8d2a94adb6c..8d476fb437b015c2bcfab15643c405212c218c43 100644 (file)
@@ -35,6 +35,7 @@
 #     CMAKE_BUILD_TYPE
 #     DEAL_II_ALLOW_PLATFORM_INTROSPECTION
 #     DEAL_II_SETUP_DEFAULT_COMPILER_FLAGS
+#     DEAL_II_SETUP_COVERAGE
 #     BUILD_SHARED_LIBS
 #     DEAL_II_PREFER_STATIC_LIBS
 #     DEAL_II_STATIC_EXECUTABLE
@@ -152,6 +153,12 @@ OPTION(DEAL_II_SETUP_DEFAULT_COMPILER_FLAGS
   )
 MARK_AS_ADVANCED(DEAL_II_SETUP_DEFAULT_COMPILER_FLAGS)
 
+OPTION(DEAL_II_SETUP_COVERAGE
+  "Setup debug compiler flags to provide additional test coverage information. Currently only gprof is supported."
+  OFF
+  )
+MARK_AS_ADVANCED(DEAL_II_SETUP_DEFAULT_COMPILER_FLAGS)
+
 SET(BUILD_SHARED_LIBS "ON" CACHE BOOL
   "Build a shared library"
   )
index 14884e265d70bcf72adbd2a9e4b657b0d7a20d36..16dc992969a65fad0ebb4376aed06766b4f40499 100644 (file)
@@ -167,5 +167,14 @@ IF (CMAKE_BUILD_TYPE MATCHES "Debug")
     ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS_DEBUG "-g")
     ENABLE_IF_SUPPORTED(DEAL_II_LINKER_FLAGS_DEBUG "-g")
   ENDIF()
+
+  IF(DEAL_II_SETUP_COVERAGE)
+    #
+    # Enable test coverage
+    #
+    ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS_DEBUG "-ftest-coverage -fprofile-arcs")
+    ENABLE_IF_SUPPORTED(DEAL_II_LINKER_FLAGS_DEBUG "-ftest-coverage -fprofile-arcs")
+  ENDIF()
+
 ENDIF()
 
index 7b4500bf2f3e0a85f76194b6fb2628dc5da6ab7f..06b915700b14fbb9f3343108606d5ee803bb1ecf 100644 (file)
 #   "Configure sensible default CFLAGS and CXXFLAGS depending on platform, compiler and build target."
 #   )
 #
+# SET(DEAL_II_SETUP_COVERAGE OFF CACHE BOOL
+#   "Setup debug compiler flags to provide additional test coverage information. Currently only gprof is supported."
+#   )
+#
 # SET(CMAKE_CXX_COMPILER "" CACHE STRING
 #   "CXX Compiler."
 #   )
index 37fce5e748accec64aef5679ea4133fb6e6358e1..c4df8f5d045007dce9ba8b4e44530e1938e99eb6 100644 (file)
          <code>DEAL_II_SETUP_DEFAULT_COMPILER_FLAGS</code> to
          <code>OFF</code>.  Beware of the fact that certain features
          may still pull in necessary compiler flags.
+
+        <li>
+          You can setup additional debug compiler flags to provide test
+          coverage information by setting
+          <code>DEAL_II_SETUP_COVERAGE</code> to <code>ON</code>.
       </ol>
     </p>
 

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.