<div dir="ltr">Hi Duncan,<div><br></div><div>On Fri, Mar 28, 2014 at 8:21 AM, Kostya Serebryany <span dir="ltr"><<a href="mailto:kcc@google.com" target="_blank">kcc@google.com</a>></span> wrote:<br></div><div class="gmail_extra">
<div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">+samsonov</div><div class="">
<div class="h5"><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Mar 28, 2014 at 3:39 AM, Duncan P. N. Exon Smith <span dir="ltr"><<a href="mailto:dexonsmith@apple.com" target="_blank">dexonsmith@apple.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">This patch adds the infrastructure for compiler-rt tests for instrumented profiling.<br>

It also adds a single very simple test.<br>
<br>
I’m a little lost with lit and cmake; could someone who knows better have a look to<br>
make sure I have the right magic?<br>
<br>
I copied and modified the logic from the test/asan/ directory.<br>
<br>
There are two things that don’t (or probably don’t) work.<br>
<br>
 1. You cannot call:<br>
<br>
        $ cd llvm/projects/compiler-rt<br>
        $ path/to/llvm-lit test/profile<br>
<br>
    The other compiler-rt tests seem to have the same defect, and I’m not sure how<br>
    to fix it.<br>
<br>
    Nevertheless, using cmake+ninja, you can call:<br>
<br>
        $ ninja check-profile<br>
<br>
 2. I didn’t do anything with configure+make, since the other tests in compiler-rt<br>
    didn’t have a model I could copy.  So the tests probably aren’t registered<br>
    there.<br>
<br>
Thanks for any pointers!<br>
<span><font color="#888888"><br>
Duncan<br>
<br></font></span></blockquote></div></div></div></div></blockquote><div><br></div><div>Could you please use phabricator (<a href="http://llvm.org/docs/Phabricator.html">http://llvm.org/docs/Phabricator.html</a>) for sending patches?</div>
<div><br></div><div>A few comments:</div><div><br></div><div><div>+</div><div>+# Tests need to run generated executables.</div><div>+if config.host_triple != config.target_triple:</div><div>+  config.unsupported = True</div>
</div><div><br></div><div>This is not needed - if tests target different platform, COMPILER_RT_CAN_EXECUTE_TESTS should be OFF,</div><div>and the test suite wouldn't be added.</div><div><br></div></div><div><br></div>
<div><div>+set(PROFILE_LIT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})</div><div>+</div><div>+set(PROFILE_TESTSUITES)</div><div><br></div><div>^^ Looks like this is not used. Please delete.</div><div><br></div><div>+</div><div>
+set(PROFILE_TEST_DEPS)</div><div>+if(NOT COMPILER_RT_STANDALONE_BUILD)</div><div>+  list(APPEND PROFILE_TEST_DEPS profile)</div><div><br></div><div>You also need to add dependency on clang, and likely clang-headers and llvm-profdata.</div>
<div><br></div><div>+endif()</div></div><div><br></div><div><br></div><div><div>+</div><div>+# Add clang substitutions.</div><div>+config.substitutions.append( ("%clang ", config.clang + " ") )</div><div>
+config.substitutions.append( ("%clang_profgen ", config.clang + " -fprofile-instr-generate ") )</div><div>+config.substitutions.append( ("%clang_profuse=", config.clang + " -fprofile-instr-use=") )</div>
<div><br></div></div><div>I think it would be easier for now to have only %clang substitution and use verbatim flags in lit tests</div><div>(%clang -fprofile-instr-use=%t ...). </div><div><br></div><div><br></div>-- <br><div>
Alexey Samsonov, MSK</div>
</div></div>