Commit Graph

3423 Commits

Author SHA1 Message Date
zoecarver ce195fb22b [libcxx] Re-commit: shared_ptr changes from library fundamentals (P0414R2).
Implements P0414R2:
  * Adds support for array types in std::shared_ptr.
  * Adds reinterpret_pointer_cast for shared_ptr.

Re-committing now that the leaking tests are fixed.

Differential Revision: https://reviews.llvm.org/D62259
2020-05-12 11:23:18 -07:00
David Zarzycki 9e32bf550d [libcxx testing] Remove ALLOW_RETRIES from sleep_for.pass.cpp
Operating systems are best effort by default, so we cannot assume that
sleep-like APIs return as soon as we'd like.

Even if a sleep-like API returns when we want it to, the potential for
preemption means that attempts to measure time are subject to delays.
2020-05-12 06:55:11 -04:00
zoecarver 5eb55483eb Revert "[libcxx] shared_ptr changes from library fundamentals (P0414R2)."
This reverts commit e8c13c182a.
2020-05-11 22:43:17 -07:00
zoecarver e8c13c182a [libcxx] shared_ptr changes from library fundamentals (P0414R2).
Implements P0414R2:
  * Adds support for array types in std::shared_ptr.
  * Adds reinterpret_pointer_cast for shared_ptr.

Differential Revision: https://reviews.llvm.org/D62259
2020-05-11 18:46:29 -07:00
David Zarzycki 4f4d6c81f8 [libcxx testing] Remove ALLOW_RETRIES from sleep_until.pass.cpp
Operating systems are best effort by default, so we cannot assume that
sleep-like APIs return as soon as we'd like.

Even if a sleep-like API returns when we want it to, the potential for
preemption means that attempts to measure time are subject to delays.
2020-05-10 05:59:09 -04:00
David Zarzycki 4f4ce13944 [libcxx testing] Make three locking tests more reliable
The challenge with measuring time in tests is that slow and/or busy
machines can cause tests to fail in unexpected ways. After this change,
three tests should be much more robust. The only remaining and tiny race
that I can think of is preemption after `--countDown`. That being said,
the race isn't fixable because the standard library doesn't provide a
way to count threads that are waiting to acquire a lock.

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

Reviewed By: ldionne, #libc

Subscribers: dexonsmith, jfb, broadwaylamb, libcxx-commits

Tags: #libc

Differential Revision: https://reviews.llvm.org/D79406
2020-05-09 11:11:26 -04:00
zoecarver afc8b49782 [libcxx] Delete pointer in shared_ptr deduction test.
Updates the dummy deleter in deduction.pass.cpp to delete the pointer argument. This will fix the asan bots.
2020-05-08 12:19:38 -07:00
zoecarver 26466efe08 Revert "[libc++] ECMAScript IdentityEscape is ambiguous (2584)"
This reverts commit 6d2a66b10d.

The regex expressions in some lld tests need to be fixed. Reverting
until those are fixed.
2020-05-08 10:37:04 -07:00
Casey Carter 197f185274 [libc++][test] Add test coverage for codecvt<char(16|32)_t, char8_t, mbstate_t>
This change adds test coverage for the `codecvt<char16_t, char8_t, mbstate_t>` and `codecvt<char32_t, char8_t, mbstate_t>` ctype facets added to the C++20 WD by [P0482R6](https://wg21.link/P0428R6). Note that libc++ does not implement these facets despite implementing the remainder of P0482, presumably for ABI reasons, so these tests are marked `UNSUPPORTED: libc++`.
2020-05-08 06:14:25 -07:00
zoecarver 6d2a66b10d [libc++] ECMAScript IdentityEscape is ambiguous (2584)
This patch fixes [[ https://cplusplus.github.io/LWG/issue2584 | 2584 ]]. Now the following works:
    const std::regex r1("\\z");
    assert(std::regex_match("z", r1));

Differential Revision: https://reviews.llvm.org/D66610
2020-05-07 14:26:25 -07:00
zoecarver df73e36dc6 [libcxx] [NFC] fpos Requirements (p0759r1).
Implements p0759r1. Test-only change. Adds explicit test for table 106 and type checking.

Differential Review: https://reviews.llvm.org/D60491
2020-05-07 14:02:42 -07:00
Antonio Sanchez aa0b991dcf [libc++] Fix ostream for complex numbers with fixed field width
The ostream operator<< is currently broken for std::complex with
specified field widths.

This patch a partial revert of c3478eff7a (reviewed as D71214),
restoring the correct behavior.

Differential Revision: https://reviews.llvm.org/D78816
2020-05-07 13:51:07 -04:00
Louis Dionne eb252b328c [libc++] NFC: Port type_info tests to C++03 2020-05-07 13:41:51 -04:00
Casey Carter 8615ce246d [libc++][test] Adjust move_iterator tests to allow C++20
These tests fail due to a couple of changes to `move_iterator` for C++20:

* `move_iterator<I>::operator++(int)` returns `void` in C++20 if `I` doesn't model `forward_iterator`.

* `move_iterator<I>::reference` is calculated in C++20, so `I` must actually have an `operator*() const`.

Differential Revision: https://reviews.llvm.org/D79343
2020-05-07 09:58:13 -07:00
Louis Dionne 31d41e3879 [libc++] Add tests for _LIBCPP_HAS_MERGED_TYPEINFO_NAMES_DEFAULT
The issue on Apple platforms was fixed in 2464d8135e, but this commit
adds some tests to make sure we don't regress.

See https://llvm.org/PR45549.

Differential Revision: https://reviews.llvm.org/D78963
2020-05-07 12:40:02 -04:00
Logan Smith 83564056d4 [libcxx] Add deduction guides for shared_ptr and weak_ptr
This patch adds deduction guides to <memory> to allow deducing
construction of shared_ptrs from unique_ptrs, and from weak_ptrs
and vice versa, as specified by C++17.

Differential Revision: https://reviews.llvm.org/D69603
2020-05-07 12:07:48 -04:00
Logan Smith 5b4a98eb58 [libcxx] Qualify make_pair in searcher implementations to prevent ADL
This patch adds `_VSTD::` to some calls to `make_pair` inside the
implementations of searchers, to prevent things exploding if there is
a make_pair in an associated namespace of a user-defined type.
https://godbolt.org/z/xAFG98

Differential Revision: https://reviews.llvm.org/D72640
2020-05-07 11:57:10 -04:00
Sergej Jaskiewicz 5e3ab8f229 Revert "[libc++] [test] Generate static_test_env on the fly"
This reverts commit 52cc8bac77.

As the discussion in https://reviews.llvm.org/D78200 continues, I will
revert this until we figure out what to do.
2020-05-06 23:13:24 +03:00
Louis Dionne 89bb9f8d78 [libc++] Make sure the cin/wcin tests run on remote hosts
When running on remote hosts, we need the whole `echo 123 | %t.exe` command
to run on the remote host. Thus, we need to escape the pipe to make sure
the command is treated as `{ echo 123 | %t.exe } > %t.out` instead of
`{ echo 123 } | %t.exe > %t.out`m where only `echo 123` is run on the
remote host.
2020-05-06 11:33:13 -04:00
Louis Dionne c82f9eba4a [libc++] Fix broken modules tests on single-threaded systems
Since c0cd106fcc, we add __config_site macro defines to the compiler
command line whether we are building with modules or not. This means
that the modules tests are expected to fail on single-threaded systems
whether we build with modules or not.
2020-05-06 09:59:50 -04:00
Sergej Jaskiewicz 52cc8bac77 [libc++] [test] Generate static_test_env on the fly
Summary:
Instead of storing `static_test_env` (with all the symlinks) in the repo, we create it on the fly to be cross-toolchain-friendly. The primary use case for this are Windows-hosted cross-toolchains. Windows doesn't really have a concept of symlinks. So, when the monorepo is cloned, those symlinks turn to ordinary text files. Previously, if we cross-compiled libc++ for some symlink-friendly system (e. g. Linux) and ran tests on the target system, some tests would fail. This patch makes them pass.

Reviewers: ldionne, #libc

Reviewed By: ldionne, #libc

Subscribers: EricWF, dexonsmith, libcxx-commits

Tags: #libc

Differential Revision: https://reviews.llvm.org/D78200
2020-05-06 01:23:50 +03:00
Sergej Jaskiewicz 718a2927ad Revert "[libc++] Generate symlinks in static_test_env on the fly"
This reverts commit 645ad5badb.

This commit did not incorporate all the changes intended.
2020-05-06 01:21:53 +03:00
Sergej Jaskiewicz 645ad5badb [libc++] Generate symlinks in static_test_env on the fly
Instead of storing static_test_env (with all the symlinks) in the repo,
we create it on the fly to be cross-toolchain-friendly. The primary
use case for this are Windows-hosted cross-toolchains. Windows doesn't
really have a concept of symlinks. So, when the monorepo is cloned,
those symlinks turn to ordinary text files. Previously, if we
cross-compiled libc++ for some symlink-friendly system (e. g. Linux) and
ran tests on the target system, some tests would fail. This patch makes
them pass.

Differential Revision: https://reviews.llvm.org/D78200
2020-05-06 01:13:18 +03:00
Louis Dionne 50cd964e61 [libc++] Rewrite the tests for cin, cout, clog, cerr and friends
The tests were disabled with `#if 0`, most likely because there was no
way of writing shell tests when they were first written.
2020-05-05 13:27:17 -04:00
Louis Dionne c0cd106fcc [libc++] Move parsing of <__config_site> macros to the DSL 2020-05-05 09:31:42 -04:00
Casey Carter 7e3ef299cb [libc++][test] Use a non-narrowing conversion in assign_pair.pass.cpp
...to avoid warnings, e.g., from MSVC.
2020-05-03 10:59:10 -07:00
Marek Kurdej 3e895085de [libc++][P1115][C++20] Improving the Return Value of Erase-Like Algorithms II: Free erase/erase if.
Summary:
This patch adds return type to std::erase and std::erase_if functions.

Also:
* Update __cpp_lib_erase_if to 202002L.
* Fix synopsis in unordered_map.
* Fix generate_feature_test_macro_components.py script.

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

Reviewed By: ldionne, #libc

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

Tags: #libc

Differential Revision: https://reviews.llvm.org/D75905
2020-05-02 14:04:50 +02:00
Louis Dionne cd05707d08 [libc++] Try re-enabling DSL test on Windows
The issues we were seeing before should have been fixed, but it's hard
to say for sure without running through the bots again.
2020-05-01 14:29:37 -04:00
Louis Dionne b420a09959 [libc++] Re-enable some tests under ASAN and MSAN
The tests were disabled under ASAN/MSAN because old Clangs were very
slow to build the test cases. However, I checked with the Clang used
on our build bots and the tests are not slow to build anymore, so the
tests can be re-enabled.
2020-05-01 14:03:51 -04:00
Louis Dionne 68fb8051d0 [libc++] Turn on warnings in the test suite in C++03 for Clang-based compilers 2020-05-01 13:34:11 -04:00
Louis Dionne 566b52da8b [libc++] Disable test that we use -Werror in C++03 2020-05-01 13:12:07 -04:00
Louis Dionne 9ff51bf92e [libc++] NFC: fix typos 2020-05-01 13:10:30 -04:00
Diogo Sampaio 081dbd61db [NFC] Try to fix test due asan failure 2020-05-01 17:18:25 +01:00
Louis Dionne 9295f356bb [libc++] Avoid using GNU extension in test, which triggers a warning 2020-05-01 11:10:06 -04:00
Louis Dionne 0c91e134e6 [libc++] Make sure -Werror is enabled all the time, except in verify tests 2020-05-01 10:45:39 -04:00
Diogo Sampaio c14ac8043e [FIX][libc++][Regex] Using regex_constants match_prev_avail | match_not_bol | match_not_bow
Summary:
pr42199
When using regex_constants::match_prev_avail, it is defined that
--first is valid, and match_not_bol and match_not_bow should be
ignored. At the moment these flags are not ignored. This fixis that.

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

Reviewed By: ldionne, miyuki, #libc

Subscribers: broadwaylamb, dexonsmith, libcxx-commits

Tags: #libc

Differential Revision: https://reviews.llvm.org/D75622
2020-04-30 23:36:25 +01:00
Louis Dionne 75a815a28c [libc++] Use Lit utilities instead of old libcxx utilities for str/bytes conversions
The libcxx.util utilities don't work properly, and we should remove them
when we get rid of compiler.py. In particular, libcxx.util.to_string
appears to be completely broken.
2020-04-30 15:49:40 -04:00
Louis Dionne 5d46e4b0da [libc++] Don't over-quote arguments to DSL tests
On Windows, quoting with single-quotes is both unnecessary and incorrect.
If the arguments are properly handled by Lit (which they are), quoting
should not be necessary.
2020-04-30 14:23:24 -04:00
Louis Dionne cfedd7d5e3 [libc++] Use the internal Lit shell parser to run config tests
This makes the config tests portable across platforms.
2020-04-30 13:26:57 -04:00
Louis Dionne 2fd7d364cd [libc++] Make the verify-support feature implicit
Tests that require support for Clang-verify are already marked as such
explicitly by their extension, which is .verify.cpp. Requiring the use
of an explicit Lit feature is, after thought, not really helpful.

This is a change in design: we have been bitten in the past by tests not
being enabled when we thought they were. However, the issue was mostly
with file extensions being ignored. The fix for that is not to blindly
require explicit features all the time, but instead to report all files
that are in the suite but that don't match any known test format. This
can be implemented in a follow-up patch.
2020-04-30 11:47:12 -04:00
Dan Albert 2e090e4884 Reset another globalMemCounter. 2020-04-29 17:15:04 -07:00
Louis Dionne ae3e58517e [libc++] Re-disable DSL test on Windows
This reverts commit 51a60ed14c, since the test still doesn't pass on
Windows. Marking the test as UNSUPORTED	on Windows again until I've
figured out the problem.
2020-04-29 14:21:04 -04:00
Louis Dionne 43a1d0d963 [libc++] NFC: Properly indent nested #ifs in platform_support.h 2020-04-29 12:53:16 -04:00
Louis Dionne 5b97aa14f4 [libc++] Re-disable parts of the failing RU locale tests on Apple
Instead of completely disabling the tests on Apple, which makes them
disabled on all platforms we test (and hence useless), this commit
disables only the assertions that actually fail. I also created a
bug report to track re-enabling them (https://llvm.org/PR45739).
2020-04-29 12:50:58 -04:00
Louis Dionne 5e37cf0adc [libc++] Try re-enabling long-disabled locale tests on Apple platforms
These two locale tests are disabled because they were said to "pass in
an uncontrolled manner on Apple platforms". This commit re-enables them
to see what that means, and whether that is still relevant on the
platforms we test.

Before this commit, the tests were either XFAILed or UNSUPPORTED on
Apple and Linux, which is pretty much all the systems we support. If
the tests truly don't work anywhere, they should be removed instead.
2020-04-29 12:03:05 -04:00
Louis Dionne d7da36c6e0 [libc++] Mark two timed_mutex tests as flaky 2020-04-29 11:52:17 -04:00
Louis Dionne 51a60ed14c [libc++] Try re-enabling DSL test on Windows
The issue we were seeing before should have been fixed by 178a0c80ba.
2020-04-29 11:32:27 -04:00
Casey Carter 68b30bc02b [NFC] Correct spelling of "ambiguous" 2020-04-28 14:51:37 -07:00
Louis Dionne 707df4acdc [libc++] Temporarily disable test that fails on Windows 2020-04-28 13:10:12 -04:00
Louis Dionne e82f0a598f [libc++][Take 2] Create a small DSL for defining Lit features and parameters
This allows defining Lit features that can be enabled or disabled based
on compiler support, and parameters that are passed on the command line.

The main benefits are:
- Feature detection is entirely based on the substitutions provided in
  the TestingConfig object, which is simpler and decouples it from the
  complicated compiler emulation infrastructure.
- The syntax is declarative, which makes it easy to see what features
  and parameters are accepted by the test suite. This is significantly
  less entangled than the current config.py logic.
- Since feature detection is based on substitutions, it works really
  well on top of the new format, and custom Lit configurations can be
  created easily without being based on `config.py`.

This commit is a reapplication of 6d58030c8c, which was reverted in
8f24c4b72f because it broke Python 3 support. This re-application
supports Python 3.

Differential Revision: https://reviews.llvm.org/D78381
2020-04-28 10:02:40 -04:00