ITK/Dynamic Analysis Practices

From KitwarePublic
Jump to navigationJump to search

Overview

  • ITK has a policy of ZERO Valgrind errors.
  • The developers community has put a lot of effort in reaching this level of quality and it is up to all contributors to keep the dynamic errors to the zero level.

How to run Valgrind locally

Step 1

  • Use Linux or Mac

Step 2

  • Compile ITK for Debug

Step 3

  • cd into the ITK binary build directory

Step 4

  • Type the "ctest" expression that select the test that you want to check with Valgrind.
  • For example:
         ctest  -R   itkHDF5ImageIOTest   -V   -N
  • This will print to the console the command line instructions needed to run the tests (-V option), but without running the tests (-N option).

Step 5

  • Type the path to this script in the ITK source tree and then put in front of it the expression that you get from step (4)
  • For example:
         ~/src/ITK/Utilities/Maintenance/runValgrind.sh    \
               $HOME/bin/ITK/Debug/bin/ITK-IO-HDF5TestDriver \
               "itkHDF5ImageIOTest"   \
               "$HOME/bin/ITK/Debug/Testing/Temporary"
  • At this point, the test will be run under the control of Valgrind and the combined text output of both the test and the Valgrind analysis will be printed in the console. For convienience, the same output is being copied to a file in the /tmp directory. More precisely to:
       /tmp/itkValgrindReport.txt