]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Bugfix: Pick up coverage results also from subprojects
authormaier <maier@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 18 Oct 2013 15:20:03 +0000 (15:20 +0000)
committermaier <maier@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 18 Oct 2013 15:20:03 +0000 (15:20 +0000)
git-svn-id: https://svn.dealii.org/branches/branch_port_the_testsuite@31306 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/CTestConfig.cmake
deal.II/cmake/scripts/run_testsuite.cmake

index 78157805d8e09e3382192a2dc6045a9796cf10e1..3b15eb0a7fa41efc6e277166cd0519b1449b2a0c 100644 (file)
@@ -39,7 +39,7 @@ SET(CTEST_CUSTOM_ERROR_POST_CONTEXT          20)
 
 SET(CTEST_EXTRA_COVERAGE_GLOB
   # These files should have executable lines and therefore coverage:
-  include/**/*.template.h
+  include/**/*.h
   source/**/*.cc
   )
 
index 851126ebaccf3883a8378ca6281e70d8af668276..670baf58c5a4d40efe48cc8eca78c7875a1af701 100644 (file)
@@ -412,6 +412,33 @@ ENDIF()
 MESSAGE("-- COVERAGE:               ${COVERAGE}")
 
 
+MACRO(CREATE_TARGETDIRECTORIES_TXT)
+  #
+  # It gets tricky: Fake a TargetDirectories.txt containing _all_ target
+  # directories (of the main project and all subprojects) so that the
+  # CTEST_COVERAGE() actually picks everything up...
+  #
+  EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E copy
+    ${CTEST_BINARY_DIRECTORY}/CMakeFiles/TargetDirectories.txt
+    ${CTEST_BINARY_DIRECTORY}/CMakeFiles/TargetDirectories.txt.bck
+    )
+  FILE(GLOB _subprojects ${CTEST_BINARY_DIRECTORY}/tests/*)
+  FOREACH(_subproject ${_subprojects})
+    IF(EXISTS ${_subproject}/CMakeFiles/TargetDirectories.txt)
+      FILE(READ ${_subproject}/CMakeFiles/TargetDirectories.txt _var)
+      FILE(APPEND ${CTEST_BINARY_DIRECTORY}/CMakeFiles/TargetDirectories.txt ${_var})
+    ENDIF()
+  ENDFOREACH()
+ENDMACRO()
+
+MACRO(CLEAR_TARGETDIRECTORIES_TXT)
+  EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E rename
+    ${CTEST_BINARY_DIRECTORY}/CMakeFiles/TargetDirectories.txt.bck
+    ${CTEST_BINARY_DIRECTORY}/CMakeFiles/TargetDirectories.txt
+    )
+ENDMACRO()
+
+
 ########################################################################
 #                                                                      #
 #                          Run the testsuite:                          #
@@ -452,8 +479,10 @@ IF("${_res}" STREQUAL "0")
     CTEST_TEST()
 
     IF(COVERAGE)
+      CREATE_TARGETDIRECTORIES_TXT()
       MESSAGE("-- Running CTEST_COVERAGE()")
       CTEST_COVERAGE()
+      CLEAR_TARGETDIRECTORIES_TXT()
     ENDIF(COVERAGE)
 
   ENDIF()
@@ -509,4 +538,4 @@ IF("${_res}" STREQUAL "0")
   MESSAGE("-- Submission successful. Goodbye!")
 ENDIF()
 
-# .oO( This script is freaky 511 lines long... )
+# .oO( This script is freaky 541 lines long... )

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.