CTest: Memcheck with [Address/Thread/Memory]Sanitizer is not working
CMake version: 3.17.0
When CMakeLists.txt defines MEMORYCHECK_TYPE
, MEMORYCHECK_SANITIZER_OPTIONS
for [Address/Thread/Memory] sanitizer, CTest cannot execute tests with error:
Memory checker (MemoryCheckCommand) not set, or cannot find the specified program.
Errors while running CTest
Setting MEMORYCHECK_COMMAND
to dummy app(eg. "/usr/bin/false"
) or empty string(""
) does not solve the problem.
When MEMORYCHECK_COMMAND
is not set
DartConfiguration.tcl
:
# Dynamic analysis (MemCheck)
PurifyCommand:
ValgrindCommand:
ValgrindCommandOptions:
DrMemoryCommand:
DrMemoryCommandOptions:
MemoryCheckType: AddressSanitizer
MemoryCheckSanitizerOptions: verbosity=1:symbolize=1:abort_on_error=1:detect_leaks=1
MemoryCheckCommand: MEMORYCHECK_COMMAND-NOTFOUND
MemoryCheckCommandOptions:
MemoryCheckSuppressionFile:
When MEMORYCHECK_COMMAND
is set to ""
DartConfiguration.tcl
:
# Dynamic analysis (MemCheck)
PurifyCommand:
ValgrindCommand:
ValgrindCommandOptions:
DrMemoryCommand:
DrMemoryCommandOptions:
MemoryCheckType: AddressSanitizer
MemoryCheckSanitizerOptions: verbosity=1:symbolize=1:abort_on_error=1:detect_leaks=1
MemoryCheckCommand:
MemoryCheckCommandOptions:
MemoryCheckSuppressionFile:
When MEMORYCHECK_COMMAND
is set to "/usr/bin/false"
DartConfiguration.tcl
:
# Dynamic analysis (MemCheck)
PurifyCommand:
ValgrindCommand:
ValgrindCommandOptions:
DrMemoryCommand:
DrMemoryCommandOptions:
MemoryCheckType: AddressSanitizer
MemoryCheckSanitizerOptions: verbosity=1:symbolize=1:abort_on_error=1:detect_leaks=1
MemoryCheckCommand: /usr/bin/false
MemoryCheckCommandOptions:
MemoryCheckSuppressionFile:
CMake forum discussion: https://discourse.cmake.org/t/memorycheckcommand-for-ctest-memcheck-with-address-thread-memory-sanitizer/1019
Minimal code reproducing issue: https://bitbucket.org/shaqmz/cmake_sanitizer/src/master/
Edited by Brad King