From: Daniel Arndt Date: Sun, 11 Mar 2018 16:02:40 +0000 (+0100) Subject: Allow to run the testsuite with valgrind X-Git-Tag: v9.0.0-rc1~338^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=86a39d35d1dff6f4ffe85cf81b775d31acc3763f;p=dealii.git Allow to run the testsuite with valgrind --- diff --git a/doc/developers/testsuite.html b/doc/developers/testsuite.html index 7d8c625570..b9938d31f9 100644 --- a/doc/developers/testsuite.html +++ b/doc/developers/testsuite.html @@ -292,6 +292,33 @@ xx: =============================== OUTPUT END ============================

+ +

Running with valgrind

+ +

+ The testsuite can also be run using valgrind + to check for memory corruption in the library. +

+ +

+ You can do so by invoking +

+ ctest -DMEMORYCHECK=ON <...> -S ../tests/run_testsuite.cmake
+ 
+ when running the testsuite, or directly by +
+ ctest <...> -S ../tests/run_memorycheck.cmake
+ 
+

+ +

+ At the end of all of this, results will be shown in a separate section + "Dynamic Analysis" at the + deal.II cdash site. +

+ +

Generating coverage information

diff --git a/doc/news/changes/minor/20180311DanielArndt b/doc/news/changes/minor/20180311DanielArndt new file mode 100644 index 0000000000..ea1cdbaa89 --- /dev/null +++ b/doc/news/changes/minor/20180311DanielArndt @@ -0,0 +1,4 @@ +New: The testsuite can be run using valgrind via +'ctest -S ../tests/run_memorycheck.cmake'. +
+(Daniel Arndt, 2018/03/11) diff --git a/tests/run_testsuite.cmake b/tests/run_testsuite.cmake index 6c1b827fd1..d23239128f 100644 --- a/tests/run_testsuite.cmake +++ b/tests/run_testsuite.cmake @@ -81,6 +81,10 @@ # CTEST_COVERAGE() stage will be run. Test results must go into the # "Experimental" section. # +# MEMORYCHECK +# - If set to ON the CTEST_MEMORYCHECK() stage will be run. +# Test results must go into the "Experimantal" section. +# # MAKEOPTS # - Additional options that will be passed directly to make (or ninja). # @@ -424,6 +428,35 @@ ENDIF() MESSAGE("-- COVERAGE: ${COVERAGE}") +# +# Setup memcheck: +# + +IF(MEMORYCHECK) + IF(NOT TRACK MATCHES "Experimental") + MESSAGE(FATAL_ERROR " +TRACK must be set to \"Experimental\" if Memcheck is enabled via +MEMORYCHECK=TRUE. +" + ) + ENDIF() + + FIND_PROGRAM(MEMORYCHECK_COMMAND NAMES valgrind) + IF(MEMORYCOMMAND MATCHES "-NOTFOUND") + MESSAGE(FATAL_ERROR " +Memcheck enabled but could not find the valgrind executable. Please install +valgrind. +" + ) + ENDIF() + + SET(CTEST_MEMORYCHECK_COMMAND "${MEMORYCHECK_COMMAND}") +ENDIF() + +MESSAGE("-- MEMORYCHECK: ${MEMORYCHECK}") + + + MACRO(CREATE_TARGETDIRECTORIES_TXT) # # It gets tricky: Fake a TargetDirectories.txt containing _all_ target @@ -494,11 +527,16 @@ IF("${_res}" STREQUAL "0") ) ENDIF() - MESSAGE("-- Running CTEST_TESTS()") IF(DEAL_II_MSVC) SET(CTEST_BUILD_CONFIGURATION "${JOB_BUILD_CONFIGURATION}") ENDIF() - CTEST_TEST() + IF(MEMORYCHECK) + MESSAGE("-- Running CTEST_MEMCHECK()") + CTEST_MEMCHECK() + ELSE() + MESSAGE("-- Running CTEST_TESTS()") + CTEST_TEST() + ENDIF(MEMORYCHECK) IF(COVERAGE) CREATE_TARGETDIRECTORIES_TXT()