From: maier Date: Fri, 18 Oct 2013 15:20:03 +0000 (+0000) Subject: Bugfix: Pick up coverage results also from subprojects X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6bf0965e4ed06f021fdee97047676f4ab02a96a7;p=dealii-svn.git Bugfix: Pick up coverage results also from subprojects git-svn-id: https://svn.dealii.org/branches/branch_port_the_testsuite@31306 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/CTestConfig.cmake b/deal.II/CTestConfig.cmake index 78157805d8..3b15eb0a7f 100644 --- a/deal.II/CTestConfig.cmake +++ b/deal.II/CTestConfig.cmake @@ -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 ) diff --git a/deal.II/cmake/scripts/run_testsuite.cmake b/deal.II/cmake/scripts/run_testsuite.cmake index 851126ebac..670baf58c5 100644 --- a/deal.II/cmake/scripts/run_testsuite.cmake +++ b/deal.II/cmake/scripts/run_testsuite.cmake @@ -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... )