Commit Graph

50 Commits

Author SHA1 Message Date
Louis Dionne
d88714db16 [libc++] Add proper XFAILs for shared_mutex tests
Dylib support for shared_mutex was added in macOS 10.12, so the tests
should be XFAILed accordingly instead of being completely disabled
whenever availability is enabled.

rdar://problem/48769104

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@357079 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-27 15:50:34 +00:00
Kamil Rytarowski
e4dbc70699 Mark another test as flaky
Reported on the NetBSD buildbot.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@353622 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-09 18:39:07 +00:00
JF Bastien
e15dd4e32e Support tests in freestanding
Summary:
Freestanding is *weird*. The standard allows it to differ in a bunch of odd
manners from regular C++, and the committee would like to improve that
situation. I'd like to make libc++ behave better with what freestanding should
be, so that it can be a tool we use in improving the standard. To do that we
need to try stuff out, both with "freestanding the language mode" and
"freestanding the library subset".

Let's start with the super basic: run the libc++ tests in freestanding, using
clang as the compiler, and see what works. The easiest hack to do this:

In utils/libcxx/test/config.py add:

  self.cxx.compile_flags += ['-ffreestanding']

Run the tests and they all fail.

Why? Because in freestanding `main` isn't special. This "not special" property
has two effects: main doesn't get mangled, and main isn't allowed to omit its
`return` statement. The first means main gets mangled and the linker can't
create a valid executable for us to test. The second means we spew out warnings
(ew) and the compiler doesn't insert the `return` we omitted, and main just
falls of the end and does whatever undefined behavior (if you're luck, ud2
leading to non-zero return code).

Let's start my work with the basics. This patch changes all libc++ tests to
declare `main` as `int main(int, char**` so it mangles consistently (enabling us
to declare another `extern "C"` main for freestanding which calls the mangled
one), and adds `return 0;` to all places where it was missing. This touches 6124
files, and I apologize.

The former was done with The Magic Of Sed.

The later was done with a (not quite correct but decent) clang tool:

  https://gist.github.com/jfbastien/793819ff360baa845483dde81170feed

This works for most tests, though I did have to adjust a few places when e.g.
the test runs with `-x c`, macros are used for main (such as for the filesystem
tests), etc.

Once this is in we can create a freestanding bot which will prevent further
regressions. After that, we can start the real work of supporting C++
freestanding fairly well in libc++.

<rdar://problem/47754795>

Reviewers: ldionne, mclow.lists, EricWF

Subscribers: christof, jkorous, dexonsmith, arphaman, miyuki, libcxx-commits

Differential Revision: https://reviews.llvm.org/D57624

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@353086 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-04 20:31:13 +00:00
Kamil Rytarowski
2a895e8087 Mark another test as flaky
Reported on the NetBSD 8 buildbot.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@352064 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-24 17:17:55 +00:00
Kamil Rytarowski
dd8f4539c4 Mark another test as flaky
Reported on the NetBSD 8 buildbot.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@351995 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-23 23:24:43 +00:00
Kamil Rytarowski
5091808728 Correct mark for flaky tests
Add missing trailing dot.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@351983 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-23 21:45:02 +00:00
Kamil Rytarowski
3f9884bec1 Mark more tests flaky
Reported on the NetBSD 8 buildbot


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@351944 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-23 11:36:19 +00:00
Chandler Carruth
7c3769df62 Update more file headers across all of the LLVM projects in the monorepo
to reflect the new license. These used slightly different spellings that
defeated my regular expressions.

We understand that people may be surprised that we're moving the header
entirely to discuss the new license. We checked this carefully with the
Foundation's lawyer and we believe this is the correct approach.

Essentially, all code in the project is now made available by the LLVM
project under our new license, so you will see that the license headers
include that license only. Some of our contributors have contributed
code under our old license, and accordingly, we have retained a copy of
our old license notice in the top-level files in each project and
repository.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@351648 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-19 10:56:40 +00:00
Eric Fiselier
cd72c52980 Mark two more tests as FLAKY
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@350692 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-09 05:48:54 +00:00
Eric Fiselier
4626eac620 Mark more tests as flaky
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@350550 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-07 18:21:18 +00:00
Billy Robert O'Neal III
7e250fcdc1 Change (void) casts to TEST_IGNORE_NODISCARD, as requested by Eric. Reviewed as https://reviews.llvm.org/D40065
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@318804 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-21 21:37:26 +00:00
Billy Robert O'Neal III
b981667776 Tolerate even more [[nodiscard]] in the STL. Reviewed as https://reviews.llvm.org/D39080
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@318277 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-15 07:45:07 +00:00
Benjamin Kramer
5384fd8538 Placate unused variable warnings uncovered by improvements to clang's -Wunused-variable
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@315809 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-14 15:52:38 +00:00
Stephan T. Lavavej
a5acfb93d4 [libcxx] [test] Consistently list "c++98, c++03" in chronological order. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@310155 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-05 00:44:19 +00:00
Stephan T. Lavavej
a686caad20 [libcxx] [test] Untabify, NFC.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@309464 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-29 00:55:10 +00:00
Marshall Clow
f226a28d61 Implement P0739R0: 'Some improvements to class template argument deduction integration into the standard library' This is an API change (not ABI change) due to a late change in the c++17 standard
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@309296 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-27 17:44:03 +00:00
Eric Fiselier
276a69c18b Fix compile error with Bionic's PTHREAD_MUTEX_INITIALIZER
On Bionic PTHREAD_MUTEX_INITIALIZER contains the expression "<enum-type> & <integer-type>",
which causes ADL to perform name lookup for operator&. During this lookup Clang decides
that it requires the default member initializer for std::mutex while defining the DMI
for std::mutex::__m_.

If I'm not mistaken this is caused by the explicit noexcept declaration on the defaulted
constructor.

This patch removes the explicit noexcept and instead allows the compiler to declare
the default constructor implicitly noexcept. It also adds a static_assert to ensure
that happens.

Unfortunatly because it's not easy to change the value of _LIBCPP_MUTEX_INITIALIZER
for a single test there is no good way to test this patch.

The Clang behavior causing the trouble here was introduced in r287713, which first
appears in the 4.0 release.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@304942 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-07 20:47:42 +00:00
Mehdi Amini
907c1196a7 Add markup for libc++ dylib availability
Libc++ is used as a system library on macOS and iOS (amongst others). In order
for users to be able to compile a binary that is intended to be deployed to an
older version of the platform, clang provides the
availability attribute <https://clang.llvm.org/docs/AttributeReference.html#availability>_
that can be placed on declarations to describe the lifecycle of a symbol in the
library.

See docs/DesignDocs/AvailabilityMarkup.rst for more information.

Differential Revision: https://reviews.llvm.org/D31739

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@302172 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-04 17:08:54 +00:00
Stephan T. Lavavej
559442652c [libcxx] [test] Strip trailing whitespace. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@302105 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-04 01:43:58 +00:00
Eric Fiselier
690d999934 Cleanup _LIBCPP_HAS_NO_<c++11-feature> macros in thread.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@300622 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-18 23:05:08 +00:00
Marshall Clow
59bcc879ab Implement Pp0156r2: 'Variadic Lock Guard, version 5' Reviewed as https://reviews.llvm.org/D31163.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@298681 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-24 03:40:36 +00:00
Eric Fiselier
f4dfb45247 Clean up more usages of _LIBCPP_HAS_NO_RVALUE_REFERENCES
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@296854 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-03 03:43:25 +00:00
Eric Fiselier
6fbac40a30 Add support for running our test suite against MSVC's STL
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@292326 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-18 01:48:54 +00:00
Eric Fiselier
0e5ebbc77c Fix unused parameters and variables
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@290459 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-23 23:37:52 +00:00
Eric Fiselier
bca6de0e4e Adjust libc++ test infastructure to fully support modules
This patch overhalls the libc++ test format/configuration in order to fully support modules. By "fully support" I mean get almost all of the tests passing. The main hurdle for doing this is handling tests that `#define _LIBCPP_FOO` macros to test a different configuration. This patch deals with these tests in the following ways:

1. For tests that define single `_LIBCPP_ABI_FOO` macros have been annotated with `// MODULES_DEFINES: _LIBCPP_ABI_FOO`. This allows the test suite to define the macro on the command line so it uses a different set of modules.
2. Tests for libc++'s debug mode (which define custom `_LIBCPP_ASSERT`) are automatically detected by the test suite and are compiled and run with modules disabled.

This patch also cleans up how the `CXXCompiler` helper class handles enabling/disabling language features.

NOTE: This patch uses `LIT` features which were only committed to LLVM today. If this patch breaks running the libc++ tests you probably need to update LLVM.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@288728 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-05 23:16:07 +00:00
Eric Fiselier
487bc7e0c8 Mark variadic lock guard tests as XFAIL with modules, since they have to define macros to expose the new ABI
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@287513 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-21 01:10:52 +00:00
Roger Ferrer Ibanez
8883740456 Protect lock tests under libcpp-no-exceptions
Skip tests that expect an exception to be thrown.

Differential Revision: https://reviews.llvm.org/D26184




git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@285695 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-01 15:00:16 +00:00
Eric Fiselier
4432d3f204 Prevent the test suite from hanging when run against libstdc++
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@283975 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-12 04:29:50 +00:00
Kuba Brecka
2f3771acf0 [libcxx] Add a TSan regression test for a data race in call_once
Differential Revision: https://reviews.llvm.org/D24297



git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@281477 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-14 14:15:42 +00:00
Eric Fiselier
76c3a05cd1 Add "FLAKY_TEST" test directive to support re-running flaky tests.
Some of the mutex tests fail on machines with high load. This patch implements
the test directive "// FLAKY_TEST" which allows a test to be run 3 times
before it's considered a failure.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@280050 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-30 01:46:43 +00:00
Eric Fiselier
67ec8a281b Move more _LIBCPP_VERSION tests to test/libcxx.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@273365 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-22 02:07:26 +00:00
Eric Fiselier
c6fcb58914 Avoid assignment in return. Patch from STL@microsoft.com
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@273349 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-22 01:00:32 +00:00
Eric Fiselier
c382dd0cd1 Move native_handle thread tests to test/libcxx
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@273341 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-22 00:21:50 +00:00
Eric Fiselier
d24c465bea Replace __cplusplus comparisons and dialect __has_feature checks with TEST_STD_VER.
This is a huge cleanup that helps make the libc++ test suite more portable.
Patch from STL@microsoft.com. Thanks STL!


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@272716 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-14 21:31:42 +00:00
Eric Fiselier
10d7856f8f Add missing include
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@272638 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-14 04:58:19 +00:00
Eric Fiselier
10b52a0e56 Implement variadic lock_guard.
Summary:
This patch implements the variadic `lock_guard` paper. 

Making `lock_guard` variadic is a ABI breaking change because the specialization `lock_guard<_Mutex>` mangles differently then when it was the primary template. This change only provides variadic `lock_guard` in ABI V2 or when `_LIBCPP_ABI_VARIADIC_LOCK_GUARD` is defined.

Note that in ABI V2 `lock_guard` must always be declared as a variadic template, even in C++03, in order to keep the ABI consistent. For this reason `lock_guard` is forward declared as a variadic template in all standard dialects and therefore depends on variadic templates being provided as an extension in C++03. All supported versions of Clang and GCC provide this extension.




Reviewers: mclow.lists

Subscribers: K-ballo, mclow.lists, cfe-commits

Differential Revision: http://reviews.llvm.org/D21260

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@272634 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-14 03:48:09 +00:00
Asiri Rathnayake
a3eac518e6 [libcxx] Improve tests to use the UNSUPPORTED lit directive
Quite a few libcxx tests seem to follow the format:
 #if _LIBCPP_STD_VER > X
   // Do test.
 #else
   // Empty test.
 #endif
We should instead use the UNSUPPORTED lit directive to exclude the test on
earlier C++ standards. This gives us a more accurate number of test passes
for those standards and avoids unnecessary conflicts with other lit
directives on the same tests.

Reviewers: bcraig, ericwf, mclow.lists

Differential revision: http://reviews.llvm.org/D20730

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@271108 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-28 08:57:35 +00:00
Richard Barton
037efda0ac Guard a number of tests relying on threads support when built in
single-threaded mode.

Differential Revision: http://reviews.llvm.org/D14731



git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@264191 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-23 21:04:11 +00:00
Marshall Clow
e22d9e58d3 Implement LWG2577: {shared,unique}_lock</tt> should use std::addressof
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@263506 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-14 23:07:32 +00:00
Asiri Rathnayake
cc2e93cff0 Make it possible to build a no-exceptions variant of libcxx.
Fixes a small omission in libcxx that prevents libcxx being built when
-DLIBCXX_ENABLE_EXCEPTIONS=0 is specified.

This patch adds XFAILS to all those tests that are currently failing
on the new -fno-exceptions library variant. Follow-up patches will
update the tests (progressively) to cope with the new library variant.

Change-Id: I4b801bd8d8e4fe7193df9e55f39f1f393a8ba81a

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@252598 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-10 11:41:22 +00:00
Eric Fiselier
d95ca09be4 Attempt to prevent flaky thread.mutex tests by once again increasing timing tolerances
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@248993 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-01 08:34:37 +00:00
Eric Fiselier
db8a5fd864 Refactor flaky shared_mutex tests
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@246055 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-26 19:04:40 +00:00
Eric Fiselier
7bcd5704d9 Refactor and fix more flaky shared_mutex tests
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@245918 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-25 01:28:52 +00:00
Eric Fiselier
a73d0926fc Refactor shared_timed_mutex tests.
First I removed all of the uses of _LIBCPP_STD_VER and added LIT UNSUPPORTED tags to prevent the tests from being run in older standard dialects.
Second I increased the time tolerances used in some tests when testing with Thread Sanitizer because thread sanitizer make these tests take longer.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@245793 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-22 21:24:01 +00:00
Marshall Clow
abadb458d0 Implement N4508: shared_mutex. Reviewed as http://reviews.llvm.org/D10480
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@241067 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-30 14:04:14 +00:00
Eric Fiselier
bc1e44d14e LWG2442: call_once() shouldn't DECAY_COPY(). Patch from K-Ballo.
This patch fixes LWG issue 2422 by removing the DECAY_COPY from call once.
The review can be found here: http://reviews.llvm.org/D10191


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@239654 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-13 02:23:00 +00:00
Marshall Clow
f54ca46a7b Change #ifdefs in test to UNSUPPORTED. No functionality change in the tests
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@239562 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-11 21:47:39 +00:00
Eric Fiselier
1d55ecf513 [libcxx] Fix bug in shared_timed_mutex that could cause a program to hang.
Summary:
The summary of the bug, provided by Stephan T. Lavavej:

In shared_timed_mutex::try_lock_until() (line 195 in 3.6.0), you need to deliver a notification.  The scenario is:
 
* There are N threads holding the shared lock.
* One thread calls try_lock_until() to attempt to acquire the exclusive lock.  It sets the "I want to write" bool/bit, then waits for the N readers to drain away.
* K more threads attempt to acquire the shared lock, but they notice that someone said "I want to write", so they block on a condition_variable.
* At least one of the N readers is stubborn and doesn't release the shared lock.
* The wannabe-writer times out, gives up, and unsets the "I want to write" bool/bit.
 
At this point, a notification (it needs to be notify_all) must be delivered to the condition_variable that the K wannabe-readers are waiting on.  Otherwise, they can block forever without waking up.



Reviewers: mclow.lists, jyasskin

Reviewed By: jyasskin

Subscribers: jyasskin, cfe-commits

Differential Revision: http://reviews.llvm.org/D8796

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@233944 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-02 21:02:06 +00:00
Eric Fiselier
91220d1043 Fix PR23041. Use lock_shared() as opposed to lock() in shared_lock test.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@233367 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-27 07:07:51 +00:00
Eric Fiselier
a90c6dd460 Move test into test/std subdirectory.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@224658 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-20 01:40:03 +00:00