This is an archive of the discontinued LLVM Phabricator instance.

[libcxx] Refactoring target_info.py used by lit tests
ClosedPublic

Authored by bcraig on Dec 29 2015, 12:59 PM.

Details

Summary

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.

Diff Detail

Event Timeline

bcraig updated this revision to Diff 43752.Dec 29 2015, 12:59 PM
bcraig retitled this revision from to [libcxx] Refactoring target_info.py used by lit tests.
bcraig updated this object.
bcraig added a subscriber: cfe-commits.
jroelofs edited edge metadata.Dec 29 2015, 1:31 PM

This is awesome!

LGTM with one nit: add a newline between each function definition, and two between each class. It's a little crowded without that.

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.

I think @danalbert and I are the only users of out-of-tree versions of that.

jroelofs accepted this revision.Dec 29 2015, 1:35 PM
jroelofs edited edge metadata.
This revision is now accepted and ready to land.Dec 29 2015, 1:35 PM
bcraig closed this revision.Dec 29 2015, 2:29 PM

Committed as r256588.
Thanks for the quick review!

EricWF edited edge metadata.Dec 29 2015, 4:06 PM

This is NOT correct and it's breaking bots. I don't want to revert it because I really like the change but it needs to be fixed quickly.

@bcraig You removed the logic that tests if a system provides a given locale. We use this information to enable/disable tests. Please add it back.
I put an inline comment next to the original logic.

Example Breakage: http://lab.llvm.org:8011/builders/libcxx-libcxxabi-arm-linux/builds/780

test/libcxx/test/config.py
302

This test is important!

I re-added the feature myself in r256621.

Apologies for the swarm of breakages this caused. Thanks for the late night (for me at least) locale fix EricWF!