<div dir="ltr"><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, May 19, 2014 at 12:03 PM, Reid Kleckner <span dir="ltr"><<a href="mailto:rnk@google.com" target="_blank">rnk@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 dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div class="">On Mon, May 19, 2014 at 5:10 AM, Timur Iskhodzhanov <span dir="ltr"><<a href="mailto:timurrrr@google.com" target="_blank">timurrrr@google.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">2014-05-15 11:00 GMT+04:00 Reid Kleckner <<a href="mailto:rnk@google.com" target="_blank">rnk@google.com</a>>:<br>

<div>> Maybe we should just run these tests with the gcc driver frontend.<br>
<br>
</div>So the problem with that is a combination of the following factors:<br>
a) The ASan lit tests use RUN lines like "%clangxx_asan %s -o %t"<br>
  [e.g. see test/asan/TestCases/stack-buffer-overflow.cc]<br>
<br>
b) The clang-cl driver doesn't support "-o"<br>
<br>
c) By default, %clangxx_asan is COMPILER_RT_TEST_COMPILER<br>
<br>
d) We have to use clang-cl to build ASan gtest-based tests as gtest<br>
itself uses exceptions.<br>
  Currently clang doesn't support exception, thus clang-cl falls back.<br></blockquote><div><br></div></div><div>Try using -DGTEST_HAS_SEH=0, this should compile out any use of __try.  I use that to self-host.</div><div>
<br>
</div><div>It's my fault for not documenting this more widely, but it's not really clean yet.</div><div class=""><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


e) COMPILER_RT_TEST_COMPILER is apparently used to build gtest-based tests<br>
  [see cmake/Modules/CompilerRTCompile.cmake]<br>
<br>
<br>
Looks like making any of (a-c,e) false fixes the problems.<br>
<br>
Possible solutions are (at least):<br>
A) Use a %exe_out macro in asan lit tests.<br>
  This implies a big (yet trivial) diff and a small-but-annoying<br>
maintenance burden for new tests.<br>
<br>
B) Add "-o" support to clang-cl, this is being discussed here.<br>
<br>
C) We can un-override %clangxx_asan to be clang rather than clang-cl on Windows<br></blockquote><div><br></div></div><div>That could work.</div><div class=""><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


  Or we could use a wrapper for clang-cl which replaces "-o" with<br>
"-Fo" when lit tests are run...<br>
  (there's a "android_commands/android_compile.py" wrapper around anyways)<br></blockquote><div><br></div></div><div>No wrapper please, a macro would be better.</div><div class=""><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


E) We could set COMPILER_RT_TEST_COMPILER to clang (rather than<br>
clang-cl) and override it for gtest-based tests.<br>
<br>
Opinions?<br></blockquote></div></div></div></div></blockquote><div><br></div><div>I'm fine with using clang instead of clang-cl for lit tests. Option E sounds slightly better.</div></div><br clear="all"><div><br></div>
-- <br><div dir="ltr"><div>Alexey Samsonov, Mountain View, CA</div></div>
</div></div>