<div style="font-family: arial, helvetica, sans-serif"><font size="2"><br><br><div class="gmail_quote">On Tue, Jun 26, 2012 at 11:06 AM, Chandler Carruth <span dir="ltr"><<a href="mailto:chandlerc@google.com" target="_blank">chandlerc@google.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On Mon, Jun 25, 2012 at 7:38 AM, Kostya Serebryany <<a href="mailto:kcc@google.com">kcc@google.com</a>> wrote:<br>

><br>
><br>
><br>
> On Mon, Jun 25, 2012 at 5:43 PM, Kostya Serebryany <<a href="mailto:kcc@google.com">kcc@google.com</a>> wrote:<br>
>><br>
>><br>
>><br>
>> On Mon, Jun 25, 2012 at 4:00 PM, Chandler Carruth <<a href="mailto:chandlerc@google.com">chandlerc@google.com</a>> wrote:<br>
>>><br>
>>> Context: I'm trying to implement support for ASan's unittest suite in CMake. This is ... quite challenging.<br>
>>><br>
>>> I think I can get it to work with one significant caveat: it will require manual dependency management. None of the automatic header tracking. I think this is fine in some cases, and not so fine in other cases. Let me explain.<br>

>>><br>
>>> It feels like these tests are really comprised of two distinct collections of tests:<br>
>>><br>
>>> 1) Those that rather directly test the ASan runtime. These do not rely upon the compiler instrumenting the code, and simply exercise the runtime library directly.<br>
>>> 2) Those that expect to be instrumented by the compiler, and exercise the runtime through GoogleTest's death tests on seemingly innocuous code.<br>
>>><br>
>>> For the first bucket, there is no problem. We should be able to handle these easily.<br>
>>><br>
>>> For the second bucket, this can be a bit tricky. It requires compiling the tests with a custom compiler and flags. Let's talk about the options for supporting this case.<br>
>>><br>
>>> A) We could require the host compiler to have support for -faddress-sanitizer, but ensure that the just-built runtime library is used rather than the host compiler's runtime library.<br>
>>> B) We can depend upon the Clang built in the same LLVM/Clang/CompilerRT checkout, and provide a custom compilation strategy to use it to instrument the unittest code.<br>
>>><br>
>>><br>
>>> Option A has fairly obvious problems: it introduces version skew into the equation, and would require a full bootstrap to test new instrumentation. However, it plays very nicely with the build system, requiring no special magic. It also would "Just Work" in the cross-compilation scenario, as much as any unittest would.<br>

>>><br>
>>> Option B avoids any version skew issues, but at the cost of requiring us to implement a "complete" custom compilation strategy for these source files. At the very least, this will not be portable and thus will only be enabled on a few platforms, and it will not get automatic header dependency tracking.<br>

><br>
><br>
> B is highly preferable.<br>
> I.e.:<br>
>   1. Build clang<br>
>   2. Build asan-rt (doesn't not matter with which compiler)<br>
>   3. build asan-rt-tests using clang from #1<br>
> This is what we use now anyway.<br>
> There could of course be dependencies between asan-rt and asan-rt-tests, but even worth, there could be dependencies between the instrumentation module in LLVM and asan-rt-tests.<br>
<br>
</div>Ok... :: sigh :: Have to go and make this hard on me.<br>

<br>
An additional constraint that would make this slightly easier: for the<br>
tests which require instrumentation, could they strictly avoid<br>
including headers outside of the test-helper headers? That is, none of<br>
the libasan headers themselves.<br></blockquote><div><br></div><div>Um, I guess so. AFAIR, it is true even now. I assume, including gtest headers is a</div><div>separate problem?</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<br>
This would make dependency management much much simpler, which seems<br>
important given that it must be done manually.<br>
<div class="HOEnZb"><div class="h5"><br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div>Alexey Samsonov, MSK</div><br>
</font></div>