]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Allow to run the testsuite with valgrind 6035/head
authorDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Sun, 11 Mar 2018 16:02:40 +0000 (17:02 +0100)
committerDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Sun, 11 Mar 2018 16:03:51 +0000 (17:03 +0100)
doc/developers/testsuite.html
doc/news/changes/minor/20180311DanielArndt [new file with mode: 0644]
tests/run_testsuite.cmake

index 7d8c6255707970fe0800e19cae2ce8311f024127..b9938d31f9dc8e921bb09c659b1168d00a8b1840 100644 (file)
@@ -292,6 +292,33 @@ xx: ===============================    OUTPUT END   ============================
     </p>
 
 
+    <a name="memcheck"></a>
+     <h3>Running with valgrind</h3>
+
+     <p>
+       The testsuite can also be run using <a href="http://valgrind.org/">valgrind</a>
+       to check for <i>memory corruption</i> in the library.
+     </p>
+
+     <p>
+       You can do so by invoking
+ <pre>
+ ctest -DMEMORYCHECK=ON <...> -S ../tests/run_testsuite.cmake
+ </pre>
+       when running the testsuite, or directly by
+ <pre>
+ ctest <...> -S ../tests/run_memorycheck.cmake
+ </pre>
+     </p>
+
+     <p>
+       At the end of all of this, results will be shown in a separate section
+       "Dynamic Analysis" at the
+       <a href="http://cdash.kyomu.43-1.org/index.php?project=deal.II&display=project"
+       target="_top">deal.II cdash site</a>.
+     </p>
+
+
     <a name="coverage"></a>
     <h3>Generating coverage information</h3>
 
diff --git a/doc/news/changes/minor/20180311DanielArndt b/doc/news/changes/minor/20180311DanielArndt
new file mode 100644 (file)
index 0000000..ea1cdba
--- /dev/null
@@ -0,0 +1,4 @@
+New: The testsuite can be run using valgrind via
+'ctest -S ../tests/run_memorycheck.cmake'.
+<br>
+(Daniel Arndt, 2018/03/11)
index 6c1b827fd1fca438a17f5e619dc3d311ba283cfa..d23239128f6b927761a3a6d98d73b01b9ffb55be 100644 (file)
 #     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()

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.