[PATCH] D15813: [libcxx] Refactoring target_info.py used by lit tests

Ben Craig via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 29 12:59:22 PST 2015


bcraig created this revision.
bcraig added reviewers: mclow.lists, jroelofs, danalbert, EricWF.
bcraig added a subscriber: cfe-commits.
Herald added a subscriber: emaste.

This patch makes it easier to support running the lit tests for new and
unusual platforms.  It will break existing users that set LIBCXX_TARGET_INFO
to anything other than the default.  I think this is fine, because the old
LIBCXX_TARGET_INFO wasn't terribly useful.

The old way of supporting the different test platforms was to have conditional
code scattered throughout config.py.  New platforms would need to add
conditionals there.  Alternatively, the new platform could set 
no_default_flags to true, and reconstitue almost the entire compile and link
line, including things that don't vary across platforms.

The new way of supporting new platforms is to create a new target info class,
and have make_target_info return an instance of it.  For platforms supported
in-tree, that will be done by modifying make_target_info.  For out-of-tree
platforms, users can set LIBCXX_TARGET_INFO at cmake configure time.

The target info sub-classes can provide fine-grained information back to
config.py.  The hooks that will most commonly be provided will be
add_cxx_compile_flags and add_cxx_link_flags.  These hooks can provide the
platform specific flags, while letting config.py handle all the invariant
flags.

Target info hooks were added for each area that the existing config.py had
platform specific behavior.  config.py is now mostly free of platform specific
conditionals.

This patch was tested on Linux x86_64.  I both targeted Linux x86_64, and an
out-of-tree platform with a custom target_info.  In both cases I was able to
run libcxx and libcxxabi tests.  I do not have access to FreeBSD, Darwin, or
Windows machines that are set up for lit testing.


http://reviews.llvm.org/D15813

Files:
  test/libcxx/test/config.py
  test/libcxx/test/target_info.py

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D15813.43752.patch
Type: text/x-patch
Size: 19806 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20151229/f5dcd93d/attachment-0001.bin>


More information about the cfe-commits mailing list