This is an archive of the discontinued LLVM Phabricator instance.

[CMake] Add support for building the llvm test-suite as part of an LLVM build using clang and lld
ClosedPublic

Authored by beanz on Nov 9 2015, 1:40 PM.

Details

Summary

This patch adds a new CMake module for working with ExternalProjects. This wrapper for ExternalProject supports using just-built tools and can hook up dependencies properly so that projects get cleared out.

The example usage here is for the llvm test-suite. In this example, the test-suite is setup as dependent on clang and lld if they are in-tree. If the clang or lld binaries change the test-suite is re-configured, cleaned, and rebuilt.

This cleanup and abstraction wrapping ExternalProject can be extended and applied to other runtime libraries like compiler-rt and libcxx.

Diff Detail

Repository
rL LLVM

Event Timeline

beanz updated this revision to Diff 39747.Nov 9 2015, 1:40 PM
beanz retitled this revision from to [CMake] Add support for building the llvm test-suite as part of an LLVM build using clang and lld.
beanz updated this object.
beanz added reviewers: samsonov, jroelofs, rengolin.
beanz added a subscriber: llvm-commits.
jmolloy requested changes to this revision.Nov 10 2015, 1:26 AM
jmolloy added a reviewer: jmolloy.

Hi Chris,

This is awesome! This is so much better than the approach I was taking for test-suite (recursion, like the cross-compile build does). I have a few comments.

Cheers,

James

cmake/modules/LLVMExternalProjectUtils.cmake
7 ↗(On Diff #39747)

Is there a ninja equivalent, do you know?

45 ↗(On Diff #39747)

It's confusing that this is testing CLANG_IN_TOOLCHAIN before it is set. Is this deliberate? if so it could do with some comments.

77 ↗(On Diff #39747)

Clobbering*

105 ↗(On Diff #39747)

Clobbering*

This revision now requires changes to proceed.Nov 10 2015, 1:26 AM
rengolin edited edge metadata.Nov 10 2015, 1:56 AM

So, one could just:

$ make test-suite

from the main LLVM build tree? That'd be awesome!

Would it be that much harder to add RT and libc++ now?

beanz added a comment.Nov 10 2015, 9:59 AM

So the idea here is make test-suite or ninja test-suite will work, and if clang or lld change it will do a full re-configure, clean, rebuild.

Updates coming shortly to fix issues.

cmake/modules/LLVMExternalProjectUtils.cmake
7 ↗(On Diff #39747)

No, it isn't needed for Ninja. Make fails oddly if two instances try to manipulate the same directory, and this is fixed by invoking make directly from make because the processes will talk to each other.

Ninja has now IPC, and it just doesn't die in odd ways when two instances build on top of each other.

45 ↗(On Diff #39747)

No, this is a bug. Will fix.

77 ↗(On Diff #39747)

Even with spell check on I can't spell.

beanz updated this revision to Diff 39820.Nov 10 2015, 10:06 AM
beanz edited edge metadata.
  • Reworked haandling runtime dependencies to support both compiler-rt and libcxx
  • Fixed spelling
jmolloy accepted this revision.Nov 11 2015, 8:04 AM
jmolloy edited edge metadata.

LGTM!

This revision is now accepted and ready to land.Nov 11 2015, 8:04 AM
This revision was automatically updated to reflect the committed changes.