Hi

I am trying to use Address Sanitizer (also UndefinedBehaviour and Memory 
Sanitizers) with CTest (CMake 3.5.1).  In my top level cmake file I have

set(MEMORYCHECK_TYPE "AddressSanitizer") 
include (CTest)
enable_testing()
add_test( some_test_case )

Then I run my tests with 

        ctest -T memcheck


Whatever I do I always end up with Valgrind being run, occasionally (depending 
on what I have been messing with) CTest reports "Memory checker 
(MemoryCheckCommand) not set, or cannot find the specified program.")

In both cases my Dart config file looks like this

# Dynamic analysis (MemCheck)
PurifyCommand: 
ValgrindCommand: 
ValgrindCommandOptions: 
MemoryCheckType: AddressSanitizer
MemoryCheckSanitizerOptions: 
MemoryCheckCommand: /usr/bin/valgrind
MemoryCheckCommandOptions: 
MemoryCheckSuppressionFile: 

When I look through the cmake source code it seems that setting the 
MEMORYCHECK_TYPE variable to AddressSanitizer but with no MEMORYCHECK_COMMAND 
specified is correct. Why do  I always end up with Valgrind being selected? Is 
this the correct behavior?

When I run 'ctest -T test' on code built with a sanitizer enabled I can see 
bugs in the code firing the sanitizer and useful output is produced. So I don't 
understand why  Valgrind is required

The reason for trying to do this is that I was hoping that when I run a 
memcheck ctest would see the output from the sanitizers and mark the test case 
as failed. However, neither 'test' nor 'memcheck' detect the sanitizer failure

Any ideas what I might be doing wrong? Better, is there an example of using the 
sanitizers with ctest?

CMake & CTest are great tools but would be even more awesome if I could 
integrate CTest and the sanitizers

Thanks!

     
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers

Reply via email to