Reputation: 1332
Calling
ctest -j4 -DCTEST_MEMORYCHECK_COMMAND="/usr/bin/valgrind" -DMemoryCheckCommand="/usr/bin/valgrind" --output-on-failure -T MemCheck
says
Memory checker (MemoryCheckCommand) not set, or cannot find the specified program.
Why doesn't it find valgrind automatically nor when specified manually?
Upvotes: 7
Views: 3853
Reputation: 9320
After install valgrind by "apt-get install valgrind", the error is gone. The Error was "Memory checker (MemoryCheckCommand) not set, or cannot find the specified program. Errors while running CTest"
New result
Processing memory checking output: 1/1 MemCheck: cpp_test Defects: 1 MemCheck log files can be found here: (<#> corresponds to test number) Memory checking results: Memory Leak - 1
The detail log is logged /build/Testing/Temporary# cat MemoryChecker.1.log
Showed detail leaking information
HEAP SUMMARY: in use at exit: 8,000 bytes in 1 blocks total heap usage: 2 allocs, 1 frees, 80,704 bytes allocated
you should start over from cmake .. , cmake --build . and ctest -T memcheck
Upvotes: 0
Reputation: 65831
As described on the CTest Wiki page, CTest reads the location of the memory check command (among other settings) from a file DartConfiguration.tcl
in the build directory. One way to create the dart configuration file is to simply include the CTest CMake module in your CMakeLists.txt:
include (CTest)
The CTest module will find your valgrind installation in /usr/bin
and put a variable MemoryCheckCommand
pointing to it in the DartConfiguration.tcl
file.
Upvotes: 13