This is an archive of the discontinued LLVM Phabricator instance.

[lldb] [test] Fix finding LLDB tools when building stand-alone
ClosedPublic

Authored by mgorny on Feb 15 2017, 4:57 AM.

Details

Summary

Use both LLDB- and LLVM-specific tool/library directories when LLDB is
being built stand-alone. This ensures that the freshly-built tools
(and libraries) are used correctly.

Without this patch, the test suite uses LLVM_TOOLS_DIR and LLVM_LIBS_DIR
to locate lldb, and set PATH and LD_LIBRARY_PATH. When doing
a stand-alone build, these variables represent the installed LLVM.
As a result, tests either fail due to missing lldb executable
or use an earlier installed LLDB version rather than the one being
built.

To solve this, additional LLDB_TOOLS_DIR and LLDB_LIBS_DIR variables
are added and populated using LLVM_*_OUTPUT_INTDIR. Those variables
contain directories used to output built executables and libraries.
In stand-alone builds, they represent the build-tree directories
used by LLDB. In integrated builds, they have the same values as
LLVM_*_DIR and therefore using them does not harm.

The new variables are prepended to PATH and LD_LIBRARY_PATH to ensure
that freshly built binaries are preferred over potentially earlier
installed ones. Furthermore, paths used to locate various tools are
updated to match appropriate locations.

Diff Detail

Repository
rL LLVM

Event Timeline

mgorny created this revision.Feb 15 2017, 4:57 AM
labath edited edge metadata.Feb 16 2017, 10:45 AM

It does not seem too controversial, but I am not very confident reviewing lit changes. @beanz, could you take a look at this?

lit/lit.cfg
124 ↗(On Diff #88512)

Wouldn't it be better to use lldb_tools_dir instead of the PATH here? Less chance to pick up the wrong tool accidentally?

mgorny updated this revision to Diff 88771.Feb 16 2017, 1:02 PM
mgorny edited the summary of this revision. (Show Details)
mgorny marked an inline comment as done.

Following @labath's suggestion, I've changed my approach a little. Now I'm using PATH lookup only for CC/CXX, while for remaining tools I'm using either llvm_tools_dir or lldb_tools_dir appropriately.

labath accepted this revision.Feb 17 2017, 5:56 AM

Thanks, I feel more comfortable with this one.

Let's give the others a but more time to chime in. If they don't I guess you can submit this. :)

This revision is now accepted and ready to land.Feb 17 2017, 5:56 AM
This revision was automatically updated to reflect the committed changes.