0

Complementary to this question, how can I pass flags to valgrind from cmake?

# enable valgrind checks
set(CTEST_MEMORYCHECK_TYPE "valgrind")
set(CTEST_MEMORYCHECK_COMMAND_OPTIONS "--leak-check=no")

According to the docs, The lines above should work, but after running cmake . + make I get:

$ ctest -T memcheck | grep "Memory Leak\|Defects"
1/1 MemCheck: #1: test .............................   Defects: 1
Memory Leak - 1

When I inspect the DartConfiguration.tcl file I don't see my flag there:

$ sed -n "79,80p" ./DartConfiguration.tcl 
MemoryCheckCommand: /usr/local/bin/valgrind
MemoryCheckCommandOptions: # <--- nothing here ... 

After manually editing DartConfiguration.tcl everything works fine:

$ sed -i "s/MemoryCheckCommandOptions:/MemoryCheckCommandOptions: --leak-check=no/g" DartConfiguration.tcl
$ ctest -T memcheck | grep "Memory Leak\|Defects"
$ # nothing ( good )
OrenIshShalom
  • 5,974
  • 9
  • 37
  • 87
  • Maybe [this](https://stackoverflow.com/a/60741757/4074081)? – dewaffled Nov 05 '22 at 12:51
  • @dewaffled no, it doesn't work – OrenIshShalom Nov 05 '22 at 15:08
  • I ended up [calling valgrind directly](https://github.com/OrenGitHub/ValgrindCmake/actions/runs/3400653025/jobs/5655222450#step:7:2). When leaks are *not* ignored, [the pipeline breaks](https://github.com/OrenGitHub/ValgrindCmake/actions/runs/3400646191/jobs/5655211581#step:7:2) (like it should) – OrenIshShalom Nov 05 '22 at 15:42

0 Answers0