Commit Graph

6250 Commits

Author SHA1 Message Date
Louis Dionne 68587af9ad [libc++] Move handling of convenience substitutions outside of config.py
These substitutions are strongly tied to the operation of the test
format, so it makes sense to have them defined by the test format
instead of the Lit configuration. They should be defined regardless
of which configuration is in use.
2020-04-16 17:30:09 -04:00
Dan Albert 75c4408653 Reland: Don't expose unavailable cstdio functions.
Marked unsupported for C++03 and C++11 since this test uses alias
declarations, and at least one C++03 bot was failing with
-Wc++11-extensions.

Change-Id: I8c3a579edd7eb83e0bc74e85d116b68f22400161
2020-04-16 12:51:08 -07:00
Louis Dionne 548d501082 [libc++] NFC: Reindent impossible to read conditional in __config 2020-04-16 15:02:03 -04:00
Louis Dionne 8079f8a7e8 [libc++] Simplify conditional in __config for _LIBCPP_NO_RTTI
We don't support GCC's older than 5.x anymore.
2020-04-16 12:51:30 -04:00
Louis Dionne ebd90232fb [libc++] Support arbitrary .sh.X extensions in the new format
This allows writing all kinds of ShTests, for example .sh.py tests for
testing Python code.
2020-04-16 09:55:03 -04:00
Louis Dionne e98c2733d2 [libc++] Remove the ability to run using the internal Lit shell
The new format requires using an external shell, and as we transition
and we can simplify config.py as we transition to the new format. Also,
frankly, I'd be quite surprised if that setting was still working anyway
because we have several .sh.cpp tests that likely don't work in Lit's
internal shell.
2020-04-15 15:37:41 -04:00
Louis Dionne 3fbc9c7b51 [libc++] Add a new target check-cxx-deps to build dependencies of the test suite
When running the tests through `lit` directly instead of through `check-cxx`,
it is required to manually build the `cxx` (and often `cxx_experimental`)
targets. Instead of having to do that manually, this commit adds a new
target `check-cxx-deps` that does that for you.
2020-04-15 15:11:27 -04:00
Louis Dionne 91f110f50e [libc++] Adjust XFAIL markup for modules tests on single-threaded systems
When building these tests without modules in the whole test suite,
the __config_site macro definitions are not included anymore in the
%{compile_flags}. This causes the _LIBCPP_HAS_NO_THREADS define not
to be picked up, and the test to XPASS on single-threaded systems.

This is a stop-gap measure to fix the build bots, however the proper
solution would be to always pass the __config_site defines as compiler
macros, whether we build with modules or not.
2020-04-15 14:28:07 -04:00
Louis Dionne e87c46b162 [libc++] Remove the need for the %{build_module} substitution
Instead of using .sh.cpp tests for the modules tests, use .compile.pass.cpp
and add the -fmodules additional flag.
2020-04-15 13:01:26 -04:00
Louis Dionne 2bed2facdb [libc++] NFC: Remove the %{compile} substitution, which is not used anymore 2020-04-15 12:43:35 -04:00
Louis Dionne 40515b19b0 [libc++] Split up tests for <stdint.h> on AIX and make them AIX-independent
Avoid using <sys/types.h> in those tests so that we can run them on
non-AIX systems (otherwise this test is basically dead-code on all
the build bots I'm aware of). Also, split up the test to allow using
.compile.pass.cpp tests instead of .sh.cpp tests, since that is the
last test referencing the %{compile} substitution explicitly.
2020-04-15 12:43:35 -04:00
Louis Dionne 1a7c6b23fc [libc++] Move some .sh.cpp tests to .compile.pass.cpp
As a fly-by fix, improve/fix the comments explaining the tests. This is
a step towards removing references to the %{compile} substitution.
2020-04-15 12:27:49 -04:00
Louis Dionne 1348b53c63 [libc++] Move aligned allocation tests to .verify.cpp
Instead of being ShTests that use clang-verify (and without the proper
REQUIRES annotation), create .verify.cpp tests instead with the right
REQUIRES annotation.
2020-04-15 12:04:55 -04:00
Louis Dionne 7a6aaf9b23 [libc++] Remove workaround for .fail.cpp tests that don't have clang-verify markup
By renaming .fail.cpp tests that don't need clang-verify to .compile.fail.cpp,
the new test format will not try to compile these tests with clang-verify,
and the old test format will work just the same. However, this allows
removing a workaround that requires parsing each test looking for
clang-verify markup.

After this change, a .fail.cpp test should always have clang-verify markup.
When clang-verify is not supported by the compiler, we will just check that
these tests fail to compile. When clang-verify is supported, these tests
will be compiled with clang-verify whether they have markup or not (so
they should have markup, or they will fail).

This simplifies the test suite and also ensures that all of our .fail.cpp
tests provide clang-verify markup. If it's impossible for a test to have
clang-verify markup, it can be moved to a .compile.fail.cpp test, which
are unconditionally just checked for compilation failure.
2020-04-15 10:53:37 -04:00
Louis Dionne ec442f0996 [libc++] run.py: Create directory hierarchy if it does not exist
This is useful when replaying tests after the fact and the directories
don't exist anymore.
2020-04-14 16:20:58 -04:00
Louis Dionne 509cbc2a8d [libc++] CI: Allow pointing to specific dylib roots during backdeployment testing
This can be useful when the CI jobs don't have internet access.
2020-04-14 15:09:48 -04:00
Louis Dionne 35bbf3bb71 [libc++] Add .verify.cpp tests to the new format
With this patch, .verify.cpp tests explicitly require clang-verify, but
no other test types require clang-verify out of the box. This will allow
making several .fail.cpp tests that don't have any clang-verify markup
to be just .compile.fail.cpp tests, which in turn should allow removing
a long standing workaround that requires parsing tests to detect whether
they have any clang-verify markup in them.
2020-04-14 14:49:51 -04:00
Louis Dionne d58107c3bf [libc++] Remove support for .fail.mm tests
There are no such tests in the libc++ test suite, and I want to move
away from `.fail.cpp` tests (in favour of something else) too, which
require a workaround.
2020-04-14 12:20:23 -04:00
Louis Dionne 80aea8e4a8 [libc++] Simplify how with_system_cxx_lib and availability features are defined
Instead of spamming a bunch of available features that are not actually
used anywhere, only set those that are actually used in the test suite.
In the future, this should probably be based on the target triple only,
with the ability to have wildcards in the triple.
2020-04-14 08:28:05 -04:00
Louis Dionne 025641342b [libc++] NFC: Minor cleanups in config.py
Remove mentions of the ValgrindExecutor, which doesn't exist. That
executor is literally nowhere in the code base, so this is dead code
as far as we're concerned.

Also, inline a one-liner function that was called exactly once.
2020-04-14 08:28:05 -04:00
Louis Dionne 961914eeb9 [libc++] Mark test failing with macos < 10.13 as unsupported 2020-04-13 17:39:05 -04:00
Louis Dionne 9d8c22587b [libc++] NFC: Remove unused Lit features in the test suite
The libc++ test suite currently defines several features that are not
used anywhere in the tests, or that are redundant with other features.
For the purpose of simplifying config.py and to ease the bring up of a
new configuration, this commit removes some of these features:

- rename dylib-has-no-filesystem to c++filesystem-disabled, which exists
- rename apple-darwin to just darwin, which is already set
- remove useless setting of libstdc++, which is already set correctly
- remove libcpp-abi-unstable, which is not used anywhere
- remove the glibc-XXX features, which are not used anywhere
2020-04-13 17:19:00 -04:00
Louis Dionne 4537ba4978 [libc++] NFC: Remove unused method call 2020-04-13 16:59:54 -04:00
Casey Carter 470eb62d7b [libc++][test] Silence "unused variable" warning 2020-04-11 11:40:16 -07:00
Martijn Vels 7ba045a430 Make basic_string::operator=() tail call properly
Summary: We discovered that the compiler may chose not to inline the operator=, which leads to an expensive extra stack frame. This change makes __assign_no_alias always tail called.

Reviewers: EricWF, #libc!

Subscribers: libcxx-commits

Tags: #libc

Differential Revision: https://reviews.llvm.org/D77913
2020-04-10 19:41:46 -04:00
Louis Dionne 7149bb7068 [libc++] NFC: Clean up a lot of old Lit features
The libc++ test suite has a lot of old Lit features used to XFAIL tests
and mark them as UNSUPPORTED. Many of them are to workaround problems on
old compilers or old platforms. As time goes by, it is good to go and
clean those up to simplify the configuration of the test suite, and also
to reflect the testing reality. It's not useful to have markup that gives
the impression that e.g. clang-3.3 is supported, when we don't really
test on it anymore (and hence several new tests probably don't have the
necessary markup on them).
2020-04-10 17:20:29 -04:00
Louis Dionne 13d07bf437 [libc++] NFC: Fix typo in Lit feature (C++14 with a capital C) 2020-04-10 16:12:01 -04:00
Eric Fiselier c6eb584c64 [libc++] Fix recursive instantiation in std::array.
The use of the `&& ...` fold expression in std::array's deduction guides
recursively builds a set of binary operator expressions of depth N where
`N` is the number of elements in the initializer.

This is problematic because arrays may be large, and instantiation
depth is limited.

This patch addresses the issue by flattening the SFINAE using
the existing `__all` type trait.
2020-04-09 17:42:10 -04:00
Louis Dionne 77b46fb326 [libc++/abi] Add scripts for building libc++ and libc++abi on Apple platforms
These scripts allow creating dylibs that are very close to the dylibs
shipped on Apple platforms.
2020-04-09 12:58:54 -04:00
Eric Fiselier bf90b8fc25 [libc++] Fix failing concepts tests 2020-04-08 18:25:07 -04:00
Eric Fiselier 601f763182 [libcxx] Adds [concept.same]
Patch from Christopher Di Bella (cjdb@google.com)
Reviewed as https://reviews.llvm.org/D74291

Adds `std::same_as` to libc++. Since there aren't clang-format rules for
//requires-expressions//, I'll need to disable the formatter in certain areas.
2020-04-08 18:00:13 -04:00
Louis Dionne eceae25f6d [libc++] CI: Always build for both i386 and x86_64 in the back-deployment script 2020-04-08 16:11:20 -04:00
Louis Dionne 82bec93181 [libc++] Update the documentation for running Lit to reflect reality
Our documentation for running LIT is basically wrong, since it doesn't
mention `llvm-lit`, and nothing works without it. Note that this
documentation improvement reflects the current reality outside of
the recent efforts on improving the test suite. My goal is to document
the current way of running the test suite, so that everybody agrees on
how things currently work. As the configuration system for libc++ gets
simplified, we can come back and keep this documentation up to date to
reflect those changes.

Differential Revision: https://reviews.llvm.org/D77673
2020-04-08 15:04:16 -04:00
zoecarver b25ec45809 Fix __is_pointer builtin type trait to work with Objective-C pointer types.
Summary: 5ade17e broke __is_pointer for Objective-C pointer types. This patch fixes the builtin and re-applies the change to type_traits.

Tags: #clang, #libc

Differential Revision: https://reviews.llvm.org/D77519
2020-04-08 10:02:53 -07:00
zoecarver 7a0dc1a9e7 [libc++] Remove std::optional from ObjC is_scalar test.
std::optional requires C++17. Instead of only running the test above
C++14, this commit removes uses of std::optional from the test (it's
already tested in block.objc.pass.mm).
2020-04-08 09:44:49 -07:00
Louis Dionne f3bf25eb66 [libc++] Explicitly specify that we use libc++abi in Apple's cache 2020-04-08 09:04:39 -04:00
Dan Albert 0b43db5202 Reset more globalMemCounters.
Reviewers: EricWF, #libc

Reviewed By: EricWF, #libc

Subscribers: broadwaylamb, libcxx-commits

Tags: #libc

Differential Revision: https://reviews.llvm.org/D77681
2020-04-07 16:40:22 -07:00
Dan Albert 50280c1895 Revert "Don't expose unavailable cstdio functions."
Broke builders that emit different diagnostics. e.g.:

error: 'warning' diagnostics seen but not expected:
  Line 13: alias declarations are a C++11 extension
  Line 20: alias declarations are a C++11 extension

This reverts commit ff87813715.
2020-04-07 15:36:44 -07:00
Dan Albert ff87813715 Don't expose unavailable cstdio functions.
Summary: These aren't available on Android in all configurations.

Reviewers: EricWF, mclow.lists, #libc, ldionne

Reviewed By: EricWF, #libc, ldionne

Subscribers: broadwaylamb, dexonsmith, ldionne, krytarowski, libcxx-commits

Tags: #libc

Differential Revision: https://reviews.llvm.org/D76093
2020-04-07 15:02:30 -07:00
Louis Dionne a092e3833b [libc++] Remove the %{not} substitution
It has never been used, and it actually doesn't really work because it
assumes that the target supports Python. Instead, it's better to just
use `!` since we're running ShTests in system shells anyway.
2020-04-07 17:12:37 -04:00
Louis Dionne 3fefda6e57 [libc++] Run tests in a directory related to %t instead of /tmp
Instead of creating a temporary directory inside /tmp and running the
tests there, use a directory name based on LIT's %t substitution. This
has the benefit of not hitting /tmp so much (which is slow on some
filesystems). It also has the benefit that `ninja -C build clean` will
automatically remove the artifacts even if a test somehow failed to
remove its temporary directory (I've seen this happen when CTRL-C is
received).
2020-04-07 16:09:52 -04:00
Louis Dionne f8b6529218 [libc++] Translate MODULES_DEFINES annotations to ADDITIONAL_COMPILE_FLAGS
This allows both the old and the new testing formats to handle these
tests with modules enabled.

We also include the modules flags in the %{flags} substitution, which
means that .sh.cpp tests in the old format and all tests in the new
format will use modules flags when enabled.
2020-04-07 14:40:49 -04:00
Louis Dionne f75ebe1ab3 [libc++] Support .sh.s tests in the new format
libc++abi has two of these tests.
2020-04-07 09:13:21 -04:00
Louis Dionne 9949cfbd05 [libc++] Make sure the source file appears before link libraries when compiling tests
Otherwise, files don't link when using a GNU linker, which is more
sensitive on the order of the source file relative to the various
linked libraries. See http://c-faq.com/lib/libsearch.html for an
explanation of the problem.
2020-04-07 08:58:40 -04:00
Louis Dionne 276d2b78ce [libc++] 2/N: Enable the new libc++ testing format by default
Both test formats are equivalent, so this *should* not be a problem.
We've fixed a couple of failures uncovered by the first time we tried
making the switch, so this new attempt should go even farther.

If failures are noticed, it should be fine to revert this commit, but
please give a heads up afterwards so we know to address the issues!

Also note that it is still possible to use the old format by passing
`--param=use_old_format=True` when running Lit for the time being.
2020-04-06 18:35:17 -04:00
Louis Dionne bcf14f375e [libc++] Only support std::to_chars availability test when back-deploying 2020-04-06 18:09:34 -04:00
Louis Dionne 46c3876188 [libc++] Add availability markup for the C++20 Synchronization Library on Apple 2020-04-06 18:07:26 -04:00
Dan Albert cbf1904a3e Upstream Bionic definitions of ctype_base/regex.
Summary:
This is a patch that Android has been carrying in its tree for several
years. This patch upstreams the existing ABI.

There's some historical cruft here. __regex_word used to be a part of
regex_traits rather than ctype_base. Bionic also used to use its own
ctype implementation because the libc++ builtin one wasn't available
yet. Bionic's ctype masks were 8 bits wide and already saturated, so a
wider type needed to be used for the regex mask, and the existing
value was already used so Android needed to specify its own.

Since then Android has migrated to the builtin ctype implementation
and this patch probably should have been dropped then. Unfortunately
that was not noticed at the time, so now we need to keep this to
maintain the current ABI.

Reviewers: EricWF, #libc, ldionne

Reviewed By: #libc, ldionne

Subscribers: dexonsmith, ldionne, libcxx-commits

Tags: #libc

Differential Revision: https://reviews.llvm.org/D76171
2020-04-06 13:38:16 -07:00
Louis Dionne 8a42bf24ae [lit] Move the recursiveExpansionLimit setting to TestingConfig
The LitConfig is shared across the whole test suite. However, since
enabling recursive expansion can be a breaking change for some test
suites, it's important to confine the setting to test suites that
enable it explicitly.

Note that other issues were raised with the way recursiveExpansionLimit
operates. However, this commit simply moves the setting to the right
place -- the mechanism by which it works can be improved independently.

Differential Revision: https://reviews.llvm.org/D77415
2020-04-06 13:58:00 -04:00
Louis Dionne 267273563d [libc++] Make sure we execute tests with the current environment
The new libc++ test format doesn't automatically do this (cause it
would be the wrong place to do it).
2020-04-06 13:38:11 -04:00