[CMake] How to MemCheck with a test driver?

Bill Hoffman bill.hoffman at kitware.com
Thu Dec 15 08:00:17 EST 2011


On 12/15/2011 7:29 AM, Pere Mato Vila wrote:
> I am running all my tests with a 'test driver' implemented as a CMake
script. This is mainly to set the runtime environment and have some
hooks to get hold of the error and output streams. My question is how
can I perform a memory check (with valgrind) in this case. Obviously by
executing 'ctest -D MemoryCheck' does run valgrind on the cmake program
itself and not on my test program. Does anybody has any suggestion?

Use --trace-children=yes  .  That is what we do when testing CMake which 
is called via make.   There are options that I added to valgrind that 
will tell it to stop tracing as well.  So, in our case we tell it not to 
trace gcc and beyond.

-Bill



More information about the CMake mailing list