<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">+Daniel, Alp</div><div class="gmail_quote"><br></div><div class="gmail_quote">On Wed, May 14, 2014 at 10:00 AM, David Blaikie <span dir="ltr"><<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>></span> wrote:<br>


<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div>On Wed, May 14, 2014 at 9:43 AM, Timur Iskhodzhanov <<a href="mailto:timurrrr@google.com" target="_blank">timurrrr@google.com</a>> wrote:<br>



> Hi,<br>
><br>
> I'm currently enabling ASan lit tests on Windows.<br>
><br>
> One problem I have is that some tests use multiple RUN lines, some of which<br>
> are cross-platform and others are platform- or compiler-specific.<br>
> Is there any magic method to make some of the RUN lines conditional for a<br>
> specific OS?<br></div></div></blockquote><div><br></div><div>In fact, I'd vote for adding this feature to lit :) Having </div><div>  RUN-Windows:</div><div>would be nice. We can parse</div><div>  RUN-<foo>:</div>
<div>lines and use them in the test script only if <foo> is in the list of available features.</div><div>Otherwise we'll have to copy the tests around or do what David suggests, which is fine,</div><div>but makes the tests less readable and less self-contained.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div><div>
><br>
> I think one of the goals here is to have as many tests that are actually<br>
> shared on all the platforms and thus I don't think it's a very good idea to<br>
> e.g. duplicate tests and have platform-specific RUN lines in them.<br>
><br>
> Examples to consider are:<br>
> [all located in projects/compiler/rt/test/asan/TestCases/]<br>
><br>
> 1) sanity_check_pure_c.c has the following run lines:<br>
> // RUN: %clang_asan -O2 %s -o %t<br>
> // RUN: not %run %t 2>&1 | FileCheck %s<br>
> // RUN: %clang_asan -O2 %s -pie -fPIE -o %t<br>
> // RUN: not %run %t 2>&1 | FileCheck %s<br>
><br>
> The first two lines are ok to run on any OS.<br>
> The third run line uses "-pie -fPIE" which doesn't apply on Windows.<br>
> Is there any way to disable the third and fourth RUN lines on Windows only?<br>
><br>
> 2) print-stack-trace.cc has the following run lines:<br>
> // RUN: %clangxx_asan -O0 %s -o %t && %run %t 2>&1 | FileCheck %s<br>
> // RUN: %clangxx_asan -O3 %s -o %t && %run %t 2>&1 | FileCheck %s<br>
><br>
> The test expectations assume a particular stack trace being printed.<br>
> However, on Windows -O3 enables tail call / inlining optimizations that do<br>
> not allow us to completely restore the stack trace from debug information<br>
> (yet?).<br></div></div></blockquote><div><br></div><div>Maybe, it's ok to XFAIL this test on Windows for now.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div>
><br>
> 3) interface_test.cc has the following run lines:<br>
> // RUN: %clang_asan %s -o %t && %run %t<br>
> // RUN: %clang_asan -x c %s -o %t && %run %t<br>
> // RUN: %clang %s -o %t && %run %t<br>
> // RUN: %clang -x c %s -o %t && %run %t<br>
><br>
> the first and third are ok, the second and the fourth assume clang has "-x<br>
> c" available, which is not true on Windows where we use the clang-cl driver.<br>
> The equivalent CL/clang-cl option is "/TC".<br>
> Options are:<br>
> - Copy the test to interface_test.c<br>
<br>
</div></div>You don't need to copy the whole test - you can just write another<br>
file (interface_test_windows.test, or whatever) that, in its RUN line,<br>
references interface_test.c (you might have to move interface_test.c<br>
into an "Inputs" directory, then you would have interface.test and<br>
interface_windows.test that both reference the .c file in Inputs) -<br>
and one of those .test files would have the REQUIRES: blah and have<br>
the RUN lines that aren't portable in it.<br>
<div><br>
> - Use a macro for "-x c" / "/TC"  (sounds like an overkill for just one<br>
> test?)<br></div></blockquote><div><br></div><div>Yes, sounds like an overkill. Is it possible to support "-x" option in clang-cl driver?</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>
<br>
</div>This seems like an annoying thing to deal with - is it particularly<br>
useful to test the clang-cl driver rather than just using the normal<br>
clang gcc-like driver?<br>
<div><br>
> - Conditional RUN line<br>
> ...<br>
><br>
> 4) no_asan_gen_globals.c<br>
> // RUN: %clang_asan %s -o %t.exe<br>
> // RUN: nm %t.exe | FileCheck %s<br>
> -> Could probably use llvm-something.exe instead.<br></div></blockquote><div><br></div><div>Yep, I'd check if llvm-nm can handle this.</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>
><br>
> -----<br>
><br>
> Given that there's just a handful of problematic lit tests, I kinda think we<br>
> can actually duplicate the tests a little, but I'd like to avoid that if<br>
> possible.<br>
><br>
> Any tips?<br>
><br>
> --<br>
> Tim<br>
><br>
</div>> _______________________________________________<br>
> llvm-commits mailing list<br>
> <a href="mailto:llvm-commits@cs.uiuc.edu" target="_blank">llvm-commits@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr"><div>Alexey Samsonov, Mountain View, CA</div></div>
</div></div>