r274257 - Don't instantiate a full host toolchain in ASTMatchersTest.
Yaron Keren via cfe-commits
cfe-commits at lists.llvm.org
Thu Jun 30 12:57:51 PDT 2016
Seems this commit broke a builder,
http://bb.pgr.jp/builders/ninja-x64-msvc-RA-centos6
http://bb.pgr.jp/builders/ninja-x64-msvc-RA-centos6/builds/26133
http://bb.pgr.jp/builders/ninja-x64-msvc-RA-centos6/builds/26134
******************** 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
********************
2016-06-30 21:12 GMT+03:00 Justin Lebar via cfe-commits <
cfe-commits at lists.llvm.org>:
> Author: jlebar
> Date: Thu Jun 30 13:12:25 2016
> New Revision: 274257
>
> URL: http://llvm.org/viewvc/llvm-project?rev=274257&view=rev
> Log:
> Don't instantiate a full host toolchain in ASTMatchersTest.
>
> Summary:
> This test was stat()'ing large swaths of /usr/lib hundreds of times, as
> every invocation of matchesConditionally*() created a new Linux
> toolchain.
>
> In addition to being slow, perf indicated this was causing substantial
> contention in the kernel.
>
> Something is...interesting in the kernel, as without this patch I
> sometimes see ~11m spent in the kernel, and sometimes ~5m. This
> corresponds to bimodal ninja check-clang times of ~30s and ~20s.
>
> It's not clear to me exactly what causes the bimodality. In any case,
> this change makes this test run in 2.5s, down from 17s, and it seems to
> cause us to get the 20s ninja check-clang time unconditionally.
>
> Reviewers: chandlerc
>
> Subscribers: cfe-commits, klimek
>
> Differential Revision: http://reviews.llvm.org/D21810
>
> Modified:
> cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.h
>
> Modified: cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.h
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.h?rev=274257&r1=274256&r2=274257&view=diff
>
> ==============================================================================
> --- cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.h (original)
> +++ cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.h Thu Jun 30 13:12:25
> 2016
> @@ -73,12 +73,16 @@ testing::AssertionResult matchesConditio
> return testing::AssertionFailure() << "Could not add dynamic matcher";
> std::unique_ptr<FrontendActionFactory> Factory(
> newFrontendActionFactory(&Finder));
> - // Some tests use typeof, which is a gnu extension.
> - std::vector<std::string> Args;
> - Args.push_back(CompileArg);
> - // Some tests need rtti/exceptions on
> - Args.push_back("-frtti");
> - Args.push_back("-fexceptions");
> + // Some tests need rtti/exceptions on. Use an unknown-unknown triple
> so we
> + // don't instantiate the full system toolchain. On Linux,
> instantiating the
> + // toolchain involves stat'ing large portions of /usr/lib, and this
> slows down
> + // not only this test, but all other tests, via contention in the
> kernel.
> + //
> + // FIXME: This is a hack to work around the fact that there's no way to
> do the
> + // equivalent of runToolOnCodeWithArgs without instantiating a full
> Driver.
> + // We should consider having a function, at least for tests, that
> invokes cc1.
> + std::vector<std::string> Args = {CompileArg, "-frtti", "-fexceptions",
> + "-target", "i386-unknown-unknown"};
> if (!runToolOnCodeWithArgs(
> Factory->create(), Code, Args, Filename, "clang-tool",
> std::make_shared<PCHContainerOperations>(),
> VirtualMappedFiles)) {
> @@ -180,13 +184,12 @@ testing::AssertionResult matchesConditio
> return testing::AssertionFailure() << "Could not add dynamic matcher";
> std::unique_ptr<FrontendActionFactory> Factory(
> newFrontendActionFactory(&Finder));
> - // Some tests use typeof, which is a gnu extension.
> - std::vector<std::string> Args;
> - Args.push_back("-xcuda");
> - Args.push_back("-fno-ms-extensions");
> - Args.push_back("--cuda-host-only");
> - Args.push_back("-nocudainc");
> - Args.push_back(CompileArg);
> + // Some tests use typeof, which is a gnu extension. Using an explicit
> + // unknown-unknown triple is good for a large speedup, because it lets
> us
> + // avoid constructing a full system triple.
> + std::vector<std::string> Args = {
> + "-xcuda", "-fno-ms-extensions", "--cuda-host-only",
> "-nocudainc",
> + "-target", "nvptx64-unknown-unknown", CompileArg};
> if (!runToolOnCodeWithArgs(Factory->create(),
> CudaHeader + Code, Args)) {
> return testing::AssertionFailure() << "Parsing error in \"" << Code
> << "\"";
> @@ -230,8 +233,11 @@ matchAndVerifyResultConditionally(const
> Finder.addMatcher(AMatcher, &VerifyVerifiedResult);
> std::unique_ptr<FrontendActionFactory> Factory(
> newFrontendActionFactory(&Finder));
> - // Some tests use typeof, which is a gnu extension.
> - std::vector<std::string> Args(1, "-std=gnu++98");
> + // Some tests use typeof, which is a gnu extension. Using an explicit
> + // unknown-unknown triple is good for a large speedup, because it lets
> us
> + // avoid constructing a full system triple.
> + std::vector<std::string> Args = {"-std=gnu++98", "-target",
> + "i386-unknown-unknown"};
> if (!runToolOnCodeWithArgs(Factory->create(), Code, Args)) {
> return testing::AssertionFailure() << "Parsing error in \"" << Code
> << "\"";
> }
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160630/7a4c0647/attachment-0001.html>
More information about the cfe-commits
mailing list