Commit Graph

3509 Commits

Author SHA1 Message Date
Mikhail Maltsev 2b89c34784 [libcxx] Adjust trivial_abi tests for C++03 and C++11 testing
This change replaces std::make_unique with manual construction of
std::unique_ptr to make the tests compatible with C++11
(std::make_unique is a C++14 feature).

libc++ supports std::unique_ptr and std::shared_ptr even in C++03 but
with some limitations: unique_ptr_array.pass.cpp and
shared_ptr_arg.pass.cpp fail to compile in C++03 mode and need to be
disabled.

Differential Revision: https://reviews.llvm.org/D84394
2020-07-23 14:20:49 +01:00
Vy Nguyen f5e49bd9de Disable trivial weak_ptr test on ARM because it is not expected to work.
Summary:
weak_ptr has two pointers (more than the 4 bytes limit), so it will not be returned in registers on ARM, even if it is trivial.
The test, therefore, will fail on ARM.

Reviewers: #libc!

Subscribers: kristof.beyls, danielkiss, libcxx-commits

Tags: #libc

Differential Revision: https://reviews.llvm.org/D84200
2020-07-20 17:02:49 -04:00
Vy Nguyen be2267ba34 [libcxx] Skip tests on GCC
Summary: These don't work with GCC

Reviewers: jyknight, #libc!

Subscribers: libcxx-commits

Tags: #libc

Differential Revision: https://reviews.llvm.org/D84183
2020-07-20 12:53:51 -04:00
Vy Nguyen 76887bc4c1 Reland [libcxx]Put clang::trivial_abi on smart pointers
Reviewed By: ldionne,EricWF

    Tags: #libcxx

    Differential Revision: https://reviews.llvm.org/D82490
2020-07-20 11:54:34 -04:00
Louis Dionne 2659663ee3 [libc++] Remove shortcut Lit features for Apple backdeployment
Some time ago, I introduced shortcut features like dylib-has-no-shared_mutex
to encode whether the deployment target supported shared_mutex (say). This
made the test suite annotations cleaner.

However, the problem with building Lit features on top of other Lit
features is that it's easier for them to become stale, especially when
they are generated programmatically. Furthermore, it makes the bar for
defining configurations from scratch higher, since more features have
to be defined. Instead, I think it's better to put the XFAILs in the
tests directly, which allows cleaning them up with a simple grep.
2020-07-16 15:39:08 -04:00
Louis Dionne 9785f7b196 [libc++] Improve how we report the testing configuration 2020-07-16 15:10:17 -04:00
Louis Dionne 0f03626fbf [runtimes][NFC] Remove unused or unnecessary CMake variables 2020-07-16 10:47:08 -04:00
Sterling Augustine 77ee4b4c9b Desugar class type for iterator lookup.
Summary:
Without this, printing sets and maps hidden behind
using declarations fail.

Reviewers: #libc!

Subscribers: libcxx-commits

Tags: #libc

Differential Revision: https://reviews.llvm.org/D83732
2020-07-14 11:37:03 -07:00
Louis Dionne 2d3b8cc83f [libc++] Implement P0551
Make sure we satisfy the requirements added by P0551, and add tests to
enforce that.
2020-07-13 13:42:26 -04:00
Louis Dionne 389b67b809 [libc++] Get rid of the %{libcxx_src_root} substitution
This reduces the set of substitutions required to run the test suite.
2020-07-09 15:17:47 -04:00
Louis Dionne 6a8ed4a8ff [libc++] Fix test failure in C++03 mode 2020-07-09 13:05:22 -04:00
Louis Dionne 6f69318c72 [runtimes] Allow passing Lit parameters through CMake
This allows passing parameters to the test suites without using
LLVM_LIT_ARGS. The problem is that we sometimes want to set some
Lit arguments on the CMake command line, but the Lit parameters in
a CMake cache file. If the only knob to do that is LLVM_LIT_ARGS,
the command-line entry overrides the cache one, and the parameters
set by the cache are ignored.

This fixes a current issue with the build bots that they completely
ignore the 'std' param set by Lit, because other Lit arguments are
provided via LLVM_LIT_ARGS on the CMake command-line.
2020-07-09 12:45:00 -04:00
Louis Dionne 305b500eaf [libc++] Fix test failures in C++14 mode 2020-07-09 01:14:30 -04:00
Louis Dionne a42a58c9ce [libc++] Mark some tests as unsupported on GCC 5
There used to be a workaround where we'd pretend that GCC 5 didn't support
C++14 because it doesn't implement it properly. Since that workaround has
been removed (in 1eb211ada1), we need to mark a few individual tests as
failing with GCC 5.
2020-07-08 12:02:36 -04:00
Stephan Herhut 3341d470fc Revert "Revert "Revert "[libcxx] Put clang::trivial_abi on std::unique_ptr, std::shared_ptr, and std::weak_ptr"""
This reverts commit f706b01a00.
2020-07-06 12:18:17 +02:00
Vy Nguyen f706b01a00 Revert "Revert "[libcxx] Put clang::trivial_abi on std::unique_ptr, std::shared_ptr, and std::weak_ptr""
This reverts commit dc13ac0280.

Rolling forward + fix typos and unused variables in tests

    Differential Revision: https://reviews.llvm.org/D82490
2020-07-05 13:44:42 -04:00
Vy Nguyen dc13ac0280 Revert "[libcxx] Put clang::trivial_abi on std::unique_ptr, std::shared_ptr, and std::weak_ptr"
This reverts commit 5cde3c9633.

The tests were reported failing on clang10
2020-07-04 11:29:08 -04:00
David Zarzycki e56e96a264 [libcxx testing] Remove ALLOW_RETRIES from another test 2020-07-04 10:15:21 -04:00
Vy Nguyen 5cde3c9633 [libcxx] Put clang::trivial_abi on std::unique_ptr, std::shared_ptr, and std::weak_ptr
Reviewers: jyknight, EricWF, #libc!

Subscribers: arphaman, libcxx-commits

Tags: #libc

Differential Revision: https://reviews.llvm.org/D82490
2020-07-03 17:23:13 -04:00
Louis Dionne 71d88cebfb [libc++/libc++abi] Automatically detect whether exceptions are enabled
Instead of detecting it automatically (in libc++) and relying on
_LIBCXXABI_NO_EXCEPTIONS being set explicitly (in libc++abi), always
detect whether exceptions are enabled automatically.

This commit also removes support for specifying -D_LIBCPP_NO_EXCEPTIONS
and -D_LIBCXXABI_NO_EXCEPTIONS explicitly -- those should just be inferred
from using -fno-exceptions (or an equivalent flag).

Allowing both -D_FOO_NO_EXCEPTIONS to be provided explicitly and trying
to detect it automatically is just confusing, especially since we did
specify it explicitly when building libc++abi. We should have only one
way to detect whether exceptions are enabled, but it should be robust.
2020-07-03 14:58:09 -04:00
David Zarzycki 8aff689164 [libcxx testing] Remove ALLOW_RETRIES from another test 2020-07-03 07:00:34 -04:00
Louis Dionne 99f213e07c [libc++] Fix the Lit DSL test in case a substitution is empty 2020-06-30 14:52:51 -04:00
Louis Dionne 73370b2c0c [libc++] Add missing include in test 2020-06-30 14:16:47 -04:00
Louis Dionne 70f6389257 [runtimes] Rename newformat to just format, now that the old format has been removed 2020-06-30 10:10:30 -04:00
Louis Dionne b58b61c4b7 [libc++] Remove dead code since the removal of the old testing format 2020-06-30 10:07:59 -04:00
Louis Dionne 5d83880885 [runtimes] Remove the ability to select the old libc++ testing format
As announced on libcxx-dev at [1], the old libc++ testing format is being
removed in favour of the new one. Follow-up commits will clean up the
code that is dead after the removal of this option.

[1]: http://lists.llvm.org/pipermail/libcxx-dev/2020-June/000885.html
2020-06-29 14:07:41 -04:00
Xun Li f2dd08844c [Coroutines] Fix a few failing tests
Summary:
https://reviews.llvm.org/D82029 introduced the non-throw check for final_suspend(). There are a few tests I missed in that patch.
Fixing them here.

Reviewers: #libc, lewissbaker, modocache, ldionne

Reviewed By: #libc, ldionne

Subscribers: dexonsmith, modocache, libcxx-commits

Tags: #libc

Differential Revision: https://reviews.llvm.org/D82338
2020-06-23 10:48:17 -07:00
David Zarzycki f3f016dbaa [libcxx tests] Clang is more strict now about coroutines
As of 516803dc86, clang is now more
strictly enforcing the coroutine specification.

See: https://reviews.llvm.org/D82029
2020-06-23 06:51:35 -04:00
Raul Tambre 98eb1457ff [libc++] Require concepts support for <numbers>
Similar to <concepts>, we need to protect the header and test against
inclusion and being run if concepts aren't supported by the compiler.

Differential Revision: https://reviews.llvm.org/D82171
2020-06-19 10:49:44 -04:00
Raul Tambre 4f6c4b473c [libc++] Implement <numbers>
Summary: Constants have 33 significant decimal digits for IEEE 754 128-bit floating-point numbers.

Reviewers: ldionne, #libc, EricWF, zoecarver, curdeius

Reviewed By: ldionne, #libc, curdeius

Differential Revision: https://reviews.llvm.org/D77505
2020-06-19 14:25:02 +05:30
Christopher Di Bella ec789a41e2 [libc++] Add equality for spaceship types for themselves
- Adds operator==(partial_ordering, partial_ordering)
- Adds operator==(weak_ordering, weak_ordering)
- Adds operator==(strong_ordering, strong_ordering)

Differential Revision: https://reviews.llvm.org/D81823
2020-06-18 10:22:50 -04:00
Louis Dionne 0c66af970c [libc++] Allow specifying custom Lit config files
Before this patch, the libc++ test suite first loads lit.site.cfg
(generated by CMake), and then lit.cfg. It's also possible to load
lit.cfg before lit.site.cfg and to point to a custom lit.site.cfg
file using '--param=libcxx_site_config'. However, in that case, lit.cfg
still relies on the site configuration filling up the 'config' object
like the default lit.site.cfg file does, which isn't flexible enough.

This commit simplifies the setup by having just a single Lit site config
file per CMake configuration, and always loading exactly that config file.
However, the config file to use can be selected when setting up CMake via
the LIBCXX_TEST_CONFIG setting. Furthermore, the site configs are entirely
standalone, which means that a new site config can be added that doesn't
need to conform what's expected by config.py.

Differential Revision: https://reviews.llvm.org/D81846
2020-06-18 10:06:04 -04:00
Louis Dionne 12b01ab7fa [libc++] Don't trigger unsigned conversion warnings in std::advance
The Standard documents the signature of std::advance as

    template <class Iter, class Distance>
    constexpr void advance(Iter& i, Distance n);

Furthermore, it does not appear to put any restriction on what the type
of Distance should be. While it is understood that it should usually
be std::iterator_traits::difference_type, I couldn't find any wording
that mandates that. Similarly, I couldn't find wording that forces the
distance to be a signed type.

This patch changes std::advance to accept any type in the second argument,
which appears to be what the Standard mandates. We then coerce it to the
iterator's difference type, but that's an implementation detail.

Differential Revision: https://reviews.llvm.org/D81425
2020-06-16 13:47:47 -04:00
Louis Dionne 96e48e9a61 [libc++] Add the ability to run arbitrary programs using the DSL
This is useful for checking runtime properties of the target system.
This is a partial re-application of 3ea9450bda. This part was tested
to work on a Windows host with a SSH executor.
2020-06-15 14:59:53 -04:00
Louis Dionne 58610eb368 [libc++] Raise an exception if a Lit feature resolves to an invalid name
This allows reporting issues early when creating feature names.
2020-06-15 12:20:50 -04:00
Vladimir Vereschaka 43c4afb56f Revert "[libc++] Migrate Lit platform detection to the DSL"
This reverts commit 3ea9450bda.

The commit fails the remote library tests on the toolchain builders:

http://lab.llvm.org:8011/builders/llvm-clang-win-x-armv7l
http://lab.llvm.org:8011/builders/llvm-clang-win-x-aarch64
2020-06-13 12:50:43 -07:00
Casey Carter 8b828e9838 [libcxx][test] Silence MSVC signed-to-unsigned implicit conversion warnings 2020-06-12 14:54:51 -07:00
Louis Dionne 9c2c698fd4 [libc++] Add missing sitedir to local Lit config
It relied on the site dir being added by a previous config file.
2020-06-12 14:58:54 -04:00
Casey Carter 6ffa6a300d [libcxx][test] include <algorithm> for is_permutation 2020-06-12 11:54:03 -07:00
Louis Dionne a9b9f797e2 [libc++] Remove obsolete 'newlib' Lit Feature
The feature isn't defined anywhere, so it's effectively dead.
2020-06-12 14:08:18 -04:00
Louis Dionne 3ea9450bda [libc++] Migrate Lit platform detection to the DSL
As an important fly-by fix, also make sure we set those features to their
value on the target we run on, not on the host compiling the test suite.
2020-06-12 13:59:45 -04:00
Louis Dionne c8c7bb31f2 [libc++] Remove redundant UNSUPPORTED annotation for the GDB pretty-printer tests
That test is already only enabled if LIBCXX_TEST_GDB_PRETTY_PRINTERS is
enabled, which isn't the default. If someone turns on that option on
Windows, they should be able to run the test and see whatever failure
happens.
2020-06-12 10:57:11 -04:00
Louis Dionne 96e6cbbf94 [libc++] Allow specifying arbitrary custom executors with the new format
The integration between CMake and executor selection in the new format
wasn't very flexible -- only the default executor and SSH executors were
supported.

This patch makes it possible to specify arbitrary executors with the new
format. With the new testing format, a custom executor is just a script
that gets called with a command-line to execute, and some arguments like
--env, --codesign_identity and --execdir. As such, the default executor
is just run.py.

Remote execution with the SSH executor can be achived by specifying
LIBCXX_EXECUTOR="<path-to-ssh.py> --host <host>". Similarly, arbitrary
scripts can be provided.
2020-06-11 16:24:29 -04:00
Louis Dionne 1fc5010d6b [libc++] Consider everything inside %T to be a dependency of each test
Instead of passing file dependencies individually, assume that the
whole content of the unique test directory is a dependency. This
simplifies the test harness significantly, by making %T the directory
that contains everything required to run a test. This also removes the
need for the %{file_dependencies} substitution, which is removed by this
patch.

Furthermore, this patch also changes the harness to execute tests locally
inside %T, so as to avoid creating a separate directory for no purpose.
2020-06-10 22:38:05 -04:00
Casey Carter 24836f8cd0 [libcxx][test] MSVC's __is_trivially_copyable is fixed in VS 16.7
... so we can disable `TEST_WORKAROUND_C1XX_BROKEN_IS_TRIVIALLY_COPYABLE`.
2020-06-10 13:55:33 -07:00
Louis Dionne 4e813bbdf3 [libc++] Make sure tests are run in a unique directory
This will allow simplifying executors by always just copying the whole
%T, and assuming that all file dependencies are contained in it.

Superseeds https://reviews.llvm.org/D78245, which tried to make %T unique
in Lit, but which encountered push back.
2020-06-10 16:19:10 -04:00
Mikhail Maltsev 4e94bdceb0 [libcxx] Fix std::vector construct_iter_iter.pass.cpp test (C++98/03)
The test is failing on 32-bit targets in C++03 mode. Clang produces
the following warning: 'integer literal is too large to be represented
in type 'long' and is subject to undefined behavior under C++98,
interpreting as 'unsigned long'; this literal will have type 'long
long' in C++11 onwards [-Wc++11-compat]' which is promoted to an error
and causes the test to fail.

There have been no changes in the test itself since 2019, so it looks
like the diagnostic has been updated.

Differential Revision: https://reviews.llvm.org/D81559
2020-06-10 14:27:33 +01:00
Louis Dionne 78e266efab [libc++] Allow picking Lit parameters from the config
Unlike parameters in litConfig.params, the config isn't shared across
all test suites. For example, if we want to enable exceptions in the
tests for libcxxabi, but not in the tests for libcxx, we can't set the
enable_exceptions parameter in the litConfig object, cause it will be
used by both. Instead, setting it inside the config object solves that
problem.
2020-06-10 08:02:07 -04:00
Louis Dionne cb347a1106 [libc++] Remove assertion in year_month_day_last::day()
This reverts commit 0c148430cf, which added an assertion in day().
The Standard doesn't allow day() to crash -- instead it says that the
result is unspecified.

Differential Revision: https://reviews.llvm.org/D70346
2020-06-09 10:46:13 -04:00
Louis Dionne 60cde7bbb7 [libc++] Improve tests for iterators.operations
Reduce duplication between the constexpr and the non-constexpr test cases,
and add tests for the return type of the various operations.
2020-06-08 14:59:35 -04:00