<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</head>
<body>
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Arial,Helvetica,sans-serif;" dir="ltr">
<p><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;">Hi Chuck</span></p>
<p><br>
</p>
<p><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;">Firstly, t</span><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;">hanks for taking the time to respond.</span></p>
<p><br>
</p>
<p><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;">The sanitizers exit on failure thing makes perfect sense although why it isn't the default behavior mystifies me. Turning it on gets me the effect I am looking for (CTest
 can detect a failure) but what I really want to know and the reason for my original </span><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;">post is:</span></p>
<p><br>
</p>
<p><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;">1) Why do I always get Valgrind when I run memtest? Either that or
</span><span style="color: rgb(33, 33, 33); font-size: 13.3333px;"><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;">"Memory checker (MemoryCheckCommand) not set, or cannot find the specified program.". Looking at the source
 code I _think_ setting </span><span style="color: rgb(33, 33, 33); font-size: 13.3333px;"><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;"> the MEMORYCHECK_TYPE variable to AddressSanitizer should be enough, I shouldn't need
 to set the </span><span style="color: rgb(33, 33, 33); font-size: 12pt; font-family: Calibri, Arial, Helvetica, sans-serif;">MemoryCheckCommand and there isn't one for the sanitizers anyway</span></span></span></p>
<p><span style="color: rgb(33, 33, 33); font-size: 13.3333px;"><span style="color: rgb(33, 33, 33); font-size: 13.3333px;"><span style="color: rgb(33, 33, 33); font-size: 13.3333px;"><br>
</span></span></span></p>
<p><span style="color: rgb(33, 33, 33); font-size: 13.3333px;"><span style="color: rgb(33, 33, 33); font-size: 13.3333px;"><span style="color: rgb(33, 33, 33); font-size: 13.3333px;"><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;">2)
 The documentation hints that CTest should be able to </span><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;">understand the output of the sanitizers, I
</span><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;">ca</span><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;">n't
</span><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;">say</span><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;"> if this true or not with any certainty </span><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;">but
 it doesn't seem to be the case</span></span></span></span></p>
<p><span style="color: rgb(33, 33, 33); font-size: 13.3333px;"><span style="color: rgb(33, 33, 33); font-size: 13.3333px;"><span style="color: rgb(33, 33, 33); font-size: 13.3333px;"><br>
</span></span></span></p>
<p><span style="color: rgb(33, 33, 33); font-size: 13.3333px;"><span style="color: rgb(33, 33, 33); font-size: 13.3333px;"><span style="color: rgb(33, 33, 33); font-size: 12pt; font-family: Calibri, Arial, Helvetica, sans-serif;">Thanks again!</span></span></span></p>
<p><br>
</p>
</div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Chuck Atkins <chuck.atkins@kitware.com><br>
<b>Sent:</b> Thursday, January 5, 2017 11:47:13 AM<br>
<b>To:</b> Karl Robinson<br>
<b>Cc:</b> cmake-developers@cmake.org<br>
<b>Subject:</b> Re: [cmake-developers] Fw: CTest and Address Sanitizer</font>
<div> </div>
</div>
<div>
<div dir="ltr">Hi <span class="gmail-vN gmail-vP gmail-a3q">Karl</span>,<br>
<br>
<div>
<div class="gmail_extra">
<div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<span class="gmail-m_-4331768133316407245gmail-">>> I believe that the AddressSanitizer should normally stop with a non-zero error code right after the first error.<br>
<br>
</span>I have many tests within each executable test application, forcing the application to exit on the first error is not optimal since it means I cannot get an overview of all the issues and triage/fix them in logical order. Instead I have to test/fix/retest
 every time<br>
</blockquote>
<div><br>
<br>
</div>
<div>That's by design and isn't to do with how CMake integrates asan; i.e. it's just how asan works.  The idea being that once you hit a memory corruption then any further results can't be relied on.  From the asan documentation:
<a href="http://clang.llvm.org/docs/AddressSanitizer.html" target="_blank">http://clang.llvm.org/docs/<wbr>AddressSanitizer.html</a><br>
<div style="margin-left:40px"><br>
"If a bug is detected, the program will print an error message to stderr and exit with a non-zero exit code. AddressSanitizer exits on the first detected error. This is by design:<br>
</div>
<div style="margin-left:40px">
<div style="margin-left:40px">
<ul>
<li>This approach allows AddressSanitizer to produce faster and smaller generated code (both by ~5%).</li><li>Fixing bugs becomes unavoidable. AddressSanitizer does not produce false alarms. Once a memory corruption occurs, the program is in an inconsistent state, which could lead to confusing results and potentially misleading subsequent reports.</li></ul>
</div>
</div>
<div style="margin-left:40px">"</div>
<br>
</div>
<div>- Chuck<br>
</div>
<div><br>
<br>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>