<div dir="ltr"><div>Hi Karl,</div><div><br></div><div>Maybe this blog post can be useful to you:</div><a href="https://blog.kitware.com/ctest-cdash-add-support-for-new-dynamic-analysis-tools/">https://blog.kitware.com/ctest-cdash-add-support-for-new-dynamic-analysis-tools/</a><div><br></div><div>I believe that the AddressSanitizer should normally stop with a non-zero error code right after the first error.<br></div><div>You can check the runtime flags to control this behavior:</div><div><a href="https://github.com/google/sanitizers/wiki/AddressSanitizerFlags">https://github.com/google/sanitizers/wiki/AddressSanitizerFlags</a><br></div><div><a href="https://github.com/google/sanitizers/wiki/SanitizerCommonFlags">https://github.com/google/sanitizers/wiki/SanitizerCommonFlags</a><br></div><div><br><div><br></div><div>Best regards,</div><div><br></div><div>Xavier</div><div><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Dec 27, 2016 at 1:05 AM, Karl Robinson <span dir="ltr"><<a href="mailto:debuggery@outlook.com" target="_blank">debuggery@outlook.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi<br>
<br>
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<br>
<br>
set(MEMORYCHECK_TYPE "AddressSanitizer") <br>
include (CTest)<br>
enable_testing()<br>
add_test( some_test_case )<br>
<br>
Then I run my tests with <br>
<br>
        ctest -T memcheck<br>
<br>
<br>
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.")<br>
<br>
In both cases my Dart config file looks like this<br>
<br>
# Dynamic analysis (MemCheck)<br>
PurifyCommand:<br>
ValgrindCommand:<br>
ValgrindCommandOptions:<br>
MemoryCheckType: AddressSanitizer<br>
MemoryCheckSanitizerOptions:<br>
MemoryCheckCommand: /usr/bin/valgrind<br>
MemoryCheckCommandOptions:<br>
MemoryCheckSuppressionFile:<br>
<br>
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?<br>
<br>
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<br>
<br>
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<br>
<br>
Any ideas what I might be doing wrong? Better, is there an example of using the sanitizers with ctest?<br>
<br>
CMake & CTest are great tools but would be even more awesome if I could integrate CTest and the sanitizers<br>
<br>
Thanks!<br>
<br>
<br>
--<br>
<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" rel="noreferrer" target="_blank">http://www.cmake.org/Wiki/<wbr>CMake_FAQ</a><br>
<br>
Kitware offers various services to support the CMake community. For more information on each offering, please visit:<br>
<br>
CMake Support: <a href="http://cmake.org/cmake/help/support.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/<wbr>support.html</a><br>
CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/<wbr>consulting.html</a><br>
CMake Training Courses: <a href="http://cmake.org/cmake/help/training.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/<wbr>training.html</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/<wbr>opensource/opensource.html</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/cmake-developers" rel="noreferrer" target="_blank">http://public.kitware.com/<wbr>mailman/listinfo/cmake-<wbr>developers</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">Dr Xavier BESSERON<br>Research associate<br>FSTC, University of Luxembourg<br>Campus Kirchberg, Office E-007<br>Phone: +352 46 66 44 5418<br><div><a href="http://luxdem.uni.lu/" target="_blank">http://luxdem.uni.lu/</a><br></div><div><br></div></div></div>
</div>