Commit Graph

6219 Commits

Author SHA1 Message Date
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
Louis Dionne 7662ad67c5 [libc++] Mark two std::timed_mutex tests as flaky 2020-04-06 12:41:10 -04:00
Louis Dionne 2c1c4777a5 [libc++] Always use -fsyntax-only in .fail.cpp tests
We had a workaround because GCC 5 does not evaluate static assertions
that are dependent on template parameters. This commit removes the
workaround and marks the corresponding tests as unsupported with GCC 5.
This has the benefit of bringing the new and the old test formats closer
without having to carry a workaround for an old compiler in the new
test format.
2020-04-06 11:38:45 -04:00
Louis Dionne 4e52944ef1 [libc++] Make sure we include %{flags} when building with the new format
Otherwise, we're missing some flags like the flags that are used by
sanitizer builds and the 32-bit builds. In the long term, I think it
would be better to have only %{compile_flags} and %{link_flags}, but
for the benefit of adopting the new format by default, I think it's OK
to add %{flags} to it.
2020-04-06 11:24:04 -04:00
Louis Dionne 38e0720474 [libc++] Mark is_scalar test as unsupported in C++11 and C++14
That test requires std::optional. We never noticed that because our
test format was skipping Objective-C++ tests altogether.
2020-04-06 11:23:36 -04:00
Louis Dionne b00a874b7c [libc++] SSH: Fix tarring of dependencies on Windows
On Windows, we must make sure to close the temporary tar file before we
try to scp it.

This is an alternative approach to https://reviews.llvm.org/D77500.
2020-04-06 09:58:08 -04:00
Sergej Jaskiewicz a41cd6bb89 [libc++] [test] Add missing FILE_DEPENDENCIES to align.pass.sh.cpp
Differential Revision: https://reviews.llvm.org/D77541
2020-04-06 09:13:16 -04:00
David Zarzycki 168503773d Revert "[libc++] Enable the new libc++ testing format by default"
This reverts commit 1580c76c4a.

This causes libcxx/selftest/newformat/sh.cpp/substitutions.sh.cpp to
fail with a linker error on Fedora 31 (x86-64) release (no assert)
builds.
2020-04-05 07:16:47 -04:00
Louis Dionne 1580c76c4a [libc++] Enable the new libc++ testing format by default
Both test formats are equivalent, so this *should* not be a problem.
However, I'm taking advantage of the week-end to test this and see if
there are any failures. If so, it should be fine to revert this until
the failures have been addressed.

For the time being, it is still possible to use the old format by passing
`--param=use_old_format=True` when running Lit.
2020-04-04 16:57:16 -04:00
Brian Gesiak 54176d1766 libcxx 'LLVM_USE_SANITIZER=Address;Undefined'
Summary:
Allow users to simultaneously enable address and undefined behavior
sanitizers, in the same manner that LLVM's 'HandleLLVMOptions.cmake'
allows.

Prior to this patch, `cmake -DLLVM_USE_SANITIZER="Address;Undefined"`
would succeed and the build would build most of the LLVM project with
`-fsanitize=address,undefined`, but a warning would be printed by
libcxx's CMake, and the build would use neither sanitizer. This
patch results in no warning being printed, and both sanitizers are used
in building libcxx.

Reviewers: jroelofs, EricWF, ldionne, #libc!

Subscribers: mgorny, dexonsmith, llvm-commits, libcxx-commits

Tags: #libc

Differential Revision: https://reviews.llvm.org/D77466
2020-04-04 16:28:41 -04:00
Eric Fiselier 62f3a9650a [libc++] Attempt to workaround module invalidation bug 2020-04-04 03:18:01 -04:00
Joerg Sonnenberger 98f77828a9 Avoid using std::max_align_t in pre-C++11 mode
Always depend on the compiler to have a correct implementation of
max_align_t in stddef.h and don't provide a fallback. For pre-C++11,
require __STDCPP_NEW_ALIGNMENT__ in <new> as provided by clang in all
standard modes. Adjust test cases to avoid testing or using max_align_t
in pre-C++11 mode and also to better deal with alignof(max_align_t)>16.
Document requirements of the alignment tests around natural alignment of
power-of-two-sized types.

Differential revision: https://reviews.llvm.org/D73245
2020-04-04 01:38:41 +02:00
Louis Dionne ceb58ad61d [libc++] Lit: Add default values for most arguments of test executors 2020-04-03 17:52:41 -04:00
Louis Dionne 5d14c7b6d1 [libc++] NFC: Remove unused CMake option
That option seems to be a remnant that has now been replaced by the
LIBCXXABI_STATICALLY_LINK_UNWINDER_IN_SHARED_LIBRARY setting.

Fixes PR45347.
2020-04-03 14:45:33 -04:00
Louis Dionne b4b7c989d6 [libc++] Remove support for specifying LIBCXX_CXX_ABI_SYSTEM manually
This was only kept until Chromium fixed their build of libc++, which
they have now done according to
	https://bugs.chromium.org/p/chromium/issues/detail?id=1067216
2020-04-03 14:11:11 -04:00
Louis Dionne aaaa25e23d [libc++] Remove useless nothing_to_do.pass.cpp tests
The testing script used to test libc++ historically did not like directories
without any testing files, so these tests had been added. Since this is
not necessary anymore, we can now remove these files. This has the benefit
that the total number of tests reflects the real number of tests more
closely, and we also skip some unnecessary work (especially relevant when
running tests over SSH).

However, some nothing_to_do.pass.cpp tests actually serve the purpose of
documenting that an area of the Standard doesn't need to be tested, or is
tested elsewhere. These files are not removed by this commit.

Removal done with:

  import os
  import itertools
  for (dirpath, dirnames, filenames) in itertools.chain(os.walk('./libcxx/test'),
                                                        os.walk('./libcxxabi/test')):
      if len(filenames + dirnames) > 1 and \
         any(p == 'nothing_to_do.pass.cpp' for p in filenames):
          os.remove(os.path.join(dirpath, 'nothing_to_do.pass.cpp'))
2020-04-03 13:48:34 -04:00
Louis Dionne 80a2ddf65c [libc++] Add an alternative Lit test format
This new test format is simpler and more flexible. It creates Lit ShTests
on the fly that reuse existing substitutions (like %{cxx}) instead of
having complex logic in Python to run the tests. This has the benefit
that virtually no coding is required to customize how the test suite is
run -- one can achieve pretty much anything by defining the appropriate
substitutions in a simple lit.cfg file.

For example, in order to run the tests on an embedded device after
building with a specific SDK, one can set the %{cxx} and %{compile_flags}
substitutions to use that SDK, and the %{exec} substitution to the ssh.py
script currently used for .sh.cpp tests with a remote executor. Dealing with
the SSHExecutor becomes unnecessary, since all tests are treated like ShTests.

As a side effect of this design, configuration files for the test
suite can be as simple as:

	config.substitutions.append(('%{cxx}', '<path-to-compiler>'))
	config.substitutions.append(('%{compile_flags}', '<flags>'))
	config.substitutions.append(('%{link_flags}', '<flags>'))
	config.substitutions.append(('%{exec}', '<script-to-execute>'))

This should allow storing lit.cfg files for various configurations
directly in the repository instead of relying on complicated logic
in config.py to set up the right flags. I've found numerous problems
in that logic in the past years, and it seems like having simple and
explicit configuration files for the configurations we support is
going to solve most of these problems. Specifically, I am hoping to
store configuration files for testing other Standard Libraries in
the repository.

Improving the interaction with the test suite configuration is still a
work in progress, so for now this test format reuses the substitutions and
available features that are set up by the current config.py.

This new test format should support pretty much everything that the current
test format supports, however it will not be enabled by default at first to
make sure we're satisfied with it. For a short period of time, the new format
will require `--param=use_new_format=True` to be enabled, however it is a very
short term goal to replace the current testing format entirely and to simplify
the configuration accordingly.

Differential Revision: https://reviews.llvm.org/D77338
2020-04-03 11:35:27 -04:00
Louis Dionne 3d94f3060c [libc++] Fix is_pointer support for Objective-C++
This test regressed with 5ade17e0ca, but we never noticed it because
.pass.mm tests were skipped due to a bug in our Lit config. This commit
fixes is_pointer (by essentially reverting tha part of 5ade17e0ca) and
also adds .pass.mm tests to the list of supported test suffixes.

We can explore how to support __is_pointer with Objective-C++ qualifiers
as a follow-up -- the main goal of this commit is to fix the regression
quickly and make sure all tests of the suite are run.
2020-04-03 11:09:59 -04:00
Louis Dionne 937040d181 [libc++] Add REQUIRES for tests that need -fblocks and -fobjc-arc
AppleClang seems to support these extensions by default, but other
compilers don't.
2020-04-03 10:10:35 -04:00
Louis Dionne 90455dbe2e [libc++] NFC: Add documentation for writing tests 2020-04-02 17:14:45 -04:00
Louis Dionne a6a841e0d7 [libc++] Refer to the Filesystem static test env as relative paths
Instead of hardcoding absolute paths on the build-host in the executables,
use relative paths from the current working directory. Also, use
FILE_DEPENDENCIES to mark the static test env as being required by
the relevant tests.

Given a SSH executor that copies the files to the remote host properly,
the tests can be run on that remote host.
2020-04-02 16:51:37 -04:00
Casey Carter ea3152bb3d [libc++][test] Partially revert msvc_stdlib_force_include.h _Pragma change
... keep the warning suppression, but revert the `__pragma` to `_Pragma` change because `_Pragma` interacts badly with `/Zc:preprocessor`.
2020-04-02 12:59:57 -07:00
Louis Dionne f5c1d4409e [libc++] Try to fix Chromium's build
Chromium's build sets LIBCXX_CXX_ABI_SYSTEM explicitly when building
libc++, which was broken by 61e89737c5 (which stopped listening to
that option). As a workaround, this commit uses the system libc++abi
when LIBCXX_CXX_ABI_SYSTEM is used.

However, we will need to work with Chromium to standardize their build
of libc++, because LIBCXX_CXX_ABI_SYSTEM is not a public facing build
configuration for libc++, and has never been AFAICT.
2020-04-02 13:15:30 -04:00
Louis Dionne 322b53239d [libc++] Attempt to fix the 'runtimes' build
The 'runtimes' build started failing because libc++ stopped using the
in-tree libc++abi when HAVE_CXXABI is set after 61e89737c. This commit
tries to bring back the old behavior when HAVE_CXXABI is set in order
to fix CIs.

However, we really need to sit down and discuss what ways of building
libc++ are supported and formalize them, because having the libc++ build
system branch on basically random variables in some CMake cache somewhere
is not a viable path forward.
2020-04-02 12:14:13 -04:00
Casey Carter 0e3a8a6f34 [libc++][test] Update _LIBCPP_SUPPRESS_DEPRECATED_(PUSH|POP)
... in `msvc_stdlib_force_include.h` to also ignore new MSVC warning C5215 "'%s' a function parameter with volatile qualified type is deprecated in C++20". Since we're touching it, also update from non-standard `__pragma(meow)` to standard `_Pragma("meow")`.
2020-04-02 08:05:57 -07:00
Louis Dionne d5fa8b1120 [libc++] Reimplement the dynamic filesystem helper without using Python
This patch reimplements the dynamic filesystem helper using Posix
functionality instead of relying on Python. The primary reason for
doing this is that it allows running the libc++ test suite on devices
that do not have Python.

Differential Revision: https://reviews.llvm.org/D77140
2020-04-02 10:46:34 -04:00
Raul Tambre bcaa01752f [libc++] Fix linking libc++abi in standalone builds
In standalone builds the cxxabi_shared and cxxabi_static targets don't exist.
We need to link against the library itself.

Differential Revision: https://reviews.llvm.org/D77294
2020-04-02 09:36:33 -04:00
Louis Dionne 61e89737c5 [libc++] Simplify the configuration of the C++ ABI library
This commit removes support for building against the system libc++abi,
which was supported on Apple platforms. This is basically never what we
want to do, since libc++ and libc++abi are coupled and building a trunk
libc++ against an older libc++abi can lead to incompatibilities (and
good luck debugging them!). It might have made some sense to support
that when the monorepo did not exist, however I don't think this is
anything but a footgun nowadays.

Furthermore, based on the newly-made assumption that we're building
against the monorepo libc++abi, we can simplify the search path logic
for finding libc++abi.

This area of our build system has a lot of technical debt accumulated,
and it's surprisingly difficult to change. We've tried different things
and failed several times in the past. I did test this change on our
Docker image for the build bots and on Apple platforms, however it is
possible that this breaks some unknown configuration, in which case it
should be fine to revert this (so we can try again!).
2020-04-02 02:21:15 -04:00
Louis Dionne ff09135fc2 [libc++] Execute tests from the Lit execution root instead of the test tree
Instead of executing tests from within the libc++ test suite, we execute
them from the Lit execution directory. However, since some tests have
file dependencies, we must copy those dependencies to the execution
directory where they are executed.

This has the major benefit that if a test modifies a file (whether it
is wanted or not), other tests will not see those modifications. This
is good because current tests assume that input data is never modified,
however this could be an incorrect assumption if some test does not
behave properly.
2020-04-01 22:17:03 -04:00
Louis Dionne df88d80337 [libc++] Add missing FILE_DEPENDENCIES markup 2020-04-01 22:17:03 -04:00
zoecarver e6a39f00e8 [libcxx] Stop using builtin type traits for is_floating_point and is_arithmetic.
Based on an issue brought up in https://reviews.llvm.org/D67900, this commit reverts the changes to is_floating_point and  is_arithmetic made in D67900.

After D67900 landed, __float128 behaved differently in those two type traits, causing compiler errors in numeric limits (and possibly others).
2020-04-01 16:57:08 -07:00
Louis Dionne 92e563bc05 [libc++] SSH: Create a tarball of dependencies and scp that instead
The benefit of doing this is that we can now handle directories that
contain symlinks and other arbitrary things, such as the static_test_env
required by filesystem tests.

As a fly-by fix, we also accumulate several commands to perform over SSH
and execute them at once instead of SSHing several times. This should be
faster on average.
2020-04-01 16:38:21 -04:00