From 935df5d7d09f05082b6245ee04d37a2b62495ddf Mon Sep 17 00:00:00 2001 From: Matthias Maier Date: Fri, 18 Oct 2013 15:20:03 +0000 Subject: [PATCH] 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 --- deal.II/CTestConfig.cmake | 2 +- deal.II/cmake/scripts/run_testsuite.cmake | 31 ++++++++++++++++++++++- 2 files changed, 31 insertions(+), 2 deletions(-) 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... ) -- 2.39.5