<div dir="rtl"><div dir="ltr">Seems this commit broke a builder, <a href="http://bb.pgr.jp/builders/ninja-x64-msvc-RA-centos6">http://bb.pgr.jp/builders/ninja-x64-msvc-RA-centos6</a></div><div dir="ltr"><br></div><div dir="ltr"><a href="http://bb.pgr.jp/builders/ninja-x64-msvc-RA-centos6/builds/26133">http://bb.pgr.jp/builders/ninja-x64-msvc-RA-centos6/builds/26133</a><br></div><div dir="ltr"><a href="http://bb.pgr.jp/builders/ninja-x64-msvc-RA-centos6/builds/26134">http://bb.pgr.jp/builders/ninja-x64-msvc-RA-centos6/builds/26134</a><br></div><div dir="ltr"><br></div><div dir="ltr"><pre style="color:rgb(0,0,0);word-wrap:break-word;white-space:pre-wrap">******************** TEST 'Clang-Unit :: ASTMatchers/ASTMatchersTests/DeclarationMatcher.MatchClass' FAILED ********************
Note: Google Test filter = DeclarationMatcher.MatchClass
[==========] Running 1 test from 1 test case.
[----------] Global test environment set-up.
[----------] 1 test from DeclarationMatcher
[ RUN      ] DeclarationMatcher.MatchClass
/home/bb/ninja-x64-msvc-RA-centos6/llvm-project/clang/unittests/ASTMatchers/ASTMatchersNodeTest.cpp:91: Failure
Value of: matches("", ClassMatcher)
  Actual: false (Could not find match in "")
Expected: true
[  FAILED  ] DeclarationMatcher.MatchClass (20 ms)
[----------] 1 test from DeclarationMatcher (20 ms total)

[----------] Global test environment tear-down
[==========] 1 test from 1 test case ran. (20 ms total)
[  PASSED  ] 0 tests.
[  FAILED  ] 1 test, listed below:
[  FAILED  ] DeclarationMatcher.MatchClass

 1 FAILED TEST

********************</pre><pre style="color:rgb(0,0,0);word-wrap:break-word;white-space:pre-wrap"><br></pre></div></div><div class="gmail_extra"><br><div class="gmail_quote"><div dir="ltr">2016-06-30 21:12 GMT+03:00 Justin Lebar via cfe-commits <span dir="ltr"><<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a>></span>:</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: jlebar<br>
Date: Thu Jun 30 13:12:25 2016<br>
New Revision: 274257<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=274257&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=274257&view=rev</a><br>
Log:<br>
Don't instantiate a full host toolchain in ASTMatchersTest.<br>
<br>
Summary:<br>
This test was stat()'ing large swaths of /usr/lib hundreds of times, as<br>
every invocation of matchesConditionally*() created a new Linux<br>
toolchain.<br>
<br>
In addition to being slow, perf indicated this was causing substantial<br>
contention in the kernel.<br>
<br>
Something is...interesting in the kernel, as without this patch I<br>
sometimes see ~11m spent in the kernel, and sometimes ~5m.  This<br>
corresponds to bimodal ninja check-clang times of ~30s and ~20s.<br>
<br>
It's not clear to me exactly what causes the bimodality.  In any case,<br>
this change makes this test run in 2.5s, down from 17s, and it seems to<br>
cause us to get the 20s ninja check-clang time unconditionally.<br>
<br>
Reviewers: chandlerc<br>
<br>
Subscribers: cfe-commits, klimek<br>
<br>
Differential Revision: <a href="http://reviews.llvm.org/D21810" rel="noreferrer" target="_blank">http://reviews.llvm.org/D21810</a><br>
<br>
Modified:<br>
    cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.h<br>
<br>
Modified: cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.h?rev=274257&r1=274256&r2=274257&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.h?rev=274257&r1=274256&r2=274257&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.h (original)<br>
+++ cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.h Thu Jun 30 13:12:25 2016<br>
@@ -73,12 +73,16 @@ testing::AssertionResult matchesConditio<br>
     return testing::AssertionFailure() << "Could not add dynamic matcher";<br>
   std::unique_ptr<FrontendActionFactory> Factory(<br>
       newFrontendActionFactory(&Finder));<br>
-  // Some tests use typeof, which is a gnu extension.<br>
-  std::vector<std::string> Args;<br>
-  Args.push_back(CompileArg);<br>
-  // Some tests need rtti/exceptions on<br>
-  Args.push_back("-frtti");<br>
-  Args.push_back("-fexceptions");<br>
+  // Some tests need rtti/exceptions on.  Use an unknown-unknown triple so we<br>
+  // don't instantiate the full system toolchain.  On Linux, instantiating the<br>
+  // toolchain involves stat'ing large portions of /usr/lib, and this slows down<br>
+  // not only this test, but all other tests, via contention in the kernel.<br>
+  //<br>
+  // FIXME: This is a hack to work around the fact that there's no way to do the<br>
+  // equivalent of runToolOnCodeWithArgs without instantiating a full Driver.<br>
+  // We should consider having a function, at least for tests, that invokes cc1.<br>
+  std::vector<std::string> Args = {CompileArg, "-frtti", "-fexceptions",<br>
+                                   "-target", "i386-unknown-unknown"};<br>
   if (!runToolOnCodeWithArgs(<br>
           Factory->create(), Code, Args, Filename, "clang-tool",<br>
           std::make_shared<PCHContainerOperations>(), VirtualMappedFiles)) {<br>
@@ -180,13 +184,12 @@ testing::AssertionResult matchesConditio<br>
     return testing::AssertionFailure() << "Could not add dynamic matcher";<br>
   std::unique_ptr<FrontendActionFactory> Factory(<br>
       newFrontendActionFactory(&Finder));<br>
-  // Some tests use typeof, which is a gnu extension.<br>
-  std::vector<std::string> Args;<br>
-  Args.push_back("-xcuda");<br>
-  Args.push_back("-fno-ms-extensions");<br>
-  Args.push_back("--cuda-host-only");<br>
-  Args.push_back("-nocudainc");<br>
-  Args.push_back(CompileArg);<br>
+  // Some tests use typeof, which is a gnu extension.  Using an explicit<br>
+  // unknown-unknown triple is good for a large speedup, because it lets us<br>
+  // avoid constructing a full system triple.<br>
+  std::vector<std::string> Args = {<br>
+      "-xcuda",  "-fno-ms-extensions",      "--cuda-host-only", "-nocudainc",<br>
+      "-target", "nvptx64-unknown-unknown", CompileArg};<br>
   if (!runToolOnCodeWithArgs(Factory->create(),<br>
                              CudaHeader + Code, Args)) {<br>
     return testing::AssertionFailure() << "Parsing error in \"" << Code << "\"";<br>
@@ -230,8 +233,11 @@ matchAndVerifyResultConditionally(const<br>
   Finder.addMatcher(AMatcher, &VerifyVerifiedResult);<br>
   std::unique_ptr<FrontendActionFactory> Factory(<br>
       newFrontendActionFactory(&Finder));<br>
-  // Some tests use typeof, which is a gnu extension.<br>
-  std::vector<std::string> Args(1, "-std=gnu++98");<br>
+  // Some tests use typeof, which is a gnu extension.  Using an explicit<br>
+  // unknown-unknown triple is good for a large speedup, because it lets us<br>
+  // avoid constructing a full system triple.<br>
+  std::vector<std::string> Args = {"-std=gnu++98", "-target",<br>
+                                   "i386-unknown-unknown"};<br>
   if (!runToolOnCodeWithArgs(Factory->create(), Code, Args)) {<br>
     return testing::AssertionFailure() << "Parsing error in \"" << Code << "\"";<br>
   }<br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@lists.llvm.org">cfe-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</a><br>
</blockquote></div><br></div>