ctest does not find valgrind
Asked Answered
S

2

7

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?

Stripteaser answered 21/10, 2014 at 23:28 Comment(0)
D
12

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.

Despain answered 22/10, 2014 at 18:18 Comment(0)
T
0

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

Transmittal answered 14/8, 2021 at 3:5 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.