This is an archive of the discontinued LLVM Phabricator instance.

[lld] [cmake] Support running tests in stand-alone builds
ClosedPublic

Authored by mgorny on Jan 15 2017, 3:03 PM.

Details

Summary

Add the CMake bits necessary to run lld tests (and unittests) when
building stand-alone. The code is based on the equivalent code in clang,
and includes:

  1. checking for Python, searching for lit and necessary LLVM test tools

(FileCount and not),

  1. building LLVM test tools (FileCount and not) from LLVM sources if

they are not installed,

  1. building gtest libraries from LLVM sources,
  1. adjusting dependencies so that test targets depend only on those LLVM

targets that are available for a particular variant of stand-alone
build.

With this patch, I am able to successfully run 1002 (+10 unsupported)
lit tests on Gentoo using installed LLVM.

Diff Detail

Event Timeline

mgorny updated this revision to Diff 84506.Jan 15 2017, 3:03 PM
mgorny retitled this revision from to [lld] [cmake] Support running tests in stand-alone builds.
mgorny updated this object.
mgorny added reviewers: compnerd, beanz, Bigcheese, ruiu.
mgorny added a subscriber: llvm-commits.
compnerd accepted this revision.Jan 30 2017, 6:58 PM

LG beyond the few nits.

CMakeLists.txt
67

No spaces around the condition.

110

No space around the condition

test/CMakeLists.txt
29

I think that I would rather see this as:

set(LLD_TEST_DEPS lld)
if(NOT LLD_BUILT_STANDALONE)
  list(APPEND LLD_TEST_DEPS FileCheck not llvm-ar ...)
endif()
This revision is now accepted and ready to land.Jan 30 2017, 6:58 PM
mgorny marked 3 inline comments as done.Jan 31 2017, 6:21 AM
This revision was automatically updated to reflect the committed changes.