summaryrefslogtreecommitdiffstats
path: root/libcxx/test/std/thread/futures
Commit message (Collapse)AuthorAgeFilesLines
* Add include for 'test_macros.h' to all the tests that were missing them. ↵Marshall Clow2019-05-3147-0/+87
| | | | | | Thanks to Zoe for the (big, but simple) patch. NFC intended. llvm-svn: 362252
* Support tests in freestandingJF Bastien2019-02-0477-77/+230
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 llvm-svn: 353086
* Update more file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-1977-308/+231
| | | | | | | | | | | | | | | | | | 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. llvm-svn: 351648
* [libcxx] Make UNSUPPORTED for std::async test more fine grainedLouis Dionne2018-11-291-1/+8
| | | | | | | | The test was previously marked as unsupported on all Apple platforms, when we really just want to mark it as unsupported for previously shipped dylibs on macosx. llvm-svn: 347920
* [libcxx] Mark std::async race condition test as unsupported on DarwinLouis Dionne2018-10-091-0/+4
| | | | | | | | | | PR38682 added a test to check for a race condition in std::future. Part of the fix is part of the dylib, but there is no released version of mac OS X that ships a dylib containing the fix. Hence, this test can (and sometimes does) when testing on OS X. This commit marks the test as unsupported to avoid spurious failures. llvm-svn: 344053
* Mork more tests as FLAKYEric Fiselier2018-10-011-1/+1
| | | | llvm-svn: 343435
* Mark test as flakyEric Fiselier2018-09-221-0/+2
| | | | llvm-svn: 342818
* [libc++] Remove race condition in std::asyncLouis Dionne2018-08-241-0/+58
| | | | | | | | | | | | | | | | | Summary: The state associated to the future was set in one thread (with synchronization) but read in another thread without synchronization, which led to a data race. https://bugs.llvm.org/show_bug.cgi?id=38181 rdar://problem/42548261 Reviewers: mclow.lists, EricWF Subscribers: christof, dexonsmith, cfe-commits Differential Revision: https://reviews.llvm.org/D51170 llvm-svn: 340608
* [libcxx] [test] Fix whitespace, NFC.Stephan T. Lavavej2018-04-121-3/+3
| | | | | | test/std almost always uses spaces; now it is entirely tab-free. llvm-svn: 329978
* Revert commit removing allocator support from packaged_task. Will ↵Marshall Clow2017-11-272-0/+37
| | | | | | investigate further llvm-svn: 319091
* Implement LWG#2921 and LWG#2976 - removing allocator support from packaged_task.Marshall Clow2017-11-272-37/+0
| | | | llvm-svn: 319080
* Add additional 'UNSUPPORTED' to the test case.Marshall Clow2017-11-231-1/+2
| | | | llvm-svn: 318897
* Add [[nodiscard]] to std::async as part of P0600.Marshall Clow2017-11-231-0/+37
| | | | llvm-svn: 318889
* [libcxx] [test] Update for C++17 feature removals.Stephan T. Lavavej2017-08-242-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | test/std/containers/Emplaceable.h test/std/containers/NotConstructible.h test/support/counting_predicates.hpp Replace unary_function/binary_function inheritance with typedefs. test/std/depr/depr.function.objects/depr.base/binary_function.pass.cpp test/std/depr/depr.function.objects/depr.base/unary_function.pass.cpp test/std/utilities/function.objects/func.require/binary_function.pass.cpp test/std/utilities/function.objects/func.require/unary_function.pass.cpp Mark these tests as requiring 98/03/11/14 because 17 removed unary_function/binary_function. test/std/thread/futures/futures.task/futures.task.members/ctor_func_alloc.pass.cpp test/std/thread/futures/futures.task/futures.task.nonmembers/uses_allocator.pass.cpp Mark these tests as requiring 11/14 because 17 removed packaged_task allocator support. test/std/utilities/function.objects/func.wrap/func.wrap.func/derive_from.pass.cpp This test doesn't need to be skipped in C++17 mode. Only the construction of std::function from an allocator needs to be skipped in C++17 mode. test/std/utilities/function.objects/refwrap/refwrap.access/conversion.pass.cpp test/std/utilities/function.objects/refwrap/refwrap.assign/copy_assign.pass.cpp test/std/utilities/function.objects/refwrap/refwrap.const/copy_ctor.pass.cpp test/std/utilities/function.objects/refwrap/refwrap.const/type_ctor.pass.cpp When testing these reference_wrapper features, unary_function inheritance is totally irrelevant. test/std/utilities/function.objects/refwrap/weak_result.pass.cpp Define and use my_unary_function/my_binary_function to test the weak result type machinery (which is still present in C++17, although deprecated). test/support/msvc_stdlib_force_include.hpp Now we can test C++17 strictly, without enabling removed features. Fixes D36503. llvm-svn: 311705
* [libcxx] [test] Fix URLs in comments and make them HTTPS. NFC.Stephan T. Lavavej2017-08-051-1/+1
| | | | llvm-svn: 310156
* [libcxx] [test] The entire file futures.shared_future/wait_until.pass.cpp ↵Stephan T. Lavavej2017-07-291-130/+130
| | | | | | was indented by 1 space. NFC. llvm-svn: 309467
* Fix diagnostic in verify test to match new Clang outputEric Fiselier2017-07-071-1/+1
| | | | llvm-svn: 307450
* Add markup for libc++ dylib availabilityMehdi Amini2017-05-041-3/+5
| | | | | | | | | | | | | | | 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 llvm-svn: 302172
* Fix most failures caused by r300140Eric Fiselier2017-04-131-1/+1
| | | | | | | | | | | | | | | | | | | | | r300140 introduced a bunch of failures by changing the internal interface provided by __compressed_pair. This patch fixes all of the failures caused by the new interface by changing the existing code to use it. In addition to those changes this patch also fixes two separate issues causing test failures: 1) Fix the member swap definition for __map_value_compare. Previously the swap was incorrectly configured to swap the comparator as const. 2) Fix an assertion failure in futures.task.members/ctor_func_alloc.pass.cpp that incorrectly expected a move to take place when a single copy is sufficient. There is one remaining failure regarding make_shared. I'll commit a fix for that shortly. llvm-svn: 300148
* Add deployment knobs to tests (for Apple platforms)Mehdi Amini2017-03-151-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The tests for libc++ specify -target on the command-line to the compiler, but this is problematic for a few reasons. Firstly, the -target option isn't supported on Apple platforms. Parts of the triple get dropped and ignored. Instead, software should be compiled with a combination of the -arch and -m<name>-version-min options. Secondly, the generic "darwin" target references a kernel version instead of a platform version. Each platform has its own independent versions (with different versions of libc++.1.dylib), independent of the version of the Darwin kernel. This commit adds support to the LIT infrastructure for testing against Apple platforms using -arch and -platform options. If the host is not on OS X, or the compiler type is not clang or apple-clang, then this commit has NFC. If the host is on OS X and --param=target_triple=... is specified, then a warning is emitted to use arch and platform instead. Besides the warning, there's NFC. If the host is on OS X and *no* target-triple is specified, then use the new deployment target logic. This uses two new lit parameters, --param=arch=<arch> and --param=platform=<platform>. <platform> has the form <name>[<version>]. By default, arch is auto-detected from clang -dumpmachine, and platform is "macosx". If the platform doesn't have a version: For "macosx", the version is auto-detected from the host system using sw_vers. This may give a different version than the SDK, since new SDKs can be installed on older hosts. Otherwise, the version is auto-detected from the SDK version using xcrun --show-sdk-path. -arch <arch> -m<name>-version-min=<version> is added to the compiler flags. The target triple is computed as <arch>-apple-<platform>. It is *not* passed to clang, but it is available for XFAIL and UNSUPPORTED (as is with_system_cxx_lib=<target>). For convenience, apple-darwin and <arch>-apple-darwin are added to the set of available features. There were a number of tests marked to XFAIL on x86_64-apple-darwin11 and x86_64-apple-darwin12. I updated these to x86_64-apple-macosx10.7 and x86_64-apple-macosx10.8. llvm-svn: 297798
* Clean up more usages of _LIBCPP_HAS_NO_RVALUE_REFERENCESEric Fiselier2017-03-034-20/+5
| | | | llvm-svn: 296854
* [libcxx] [test] Fix Clang -Wpessimizing-move "moving a temporary object ↵Stephan T. Lavavej2017-02-051-6/+6
| | | | | | | | | | prevents copy elision". N4618 30.6.6 [futures.unique_future]/12 declares "shared_future<R> share() noexcept;". Fixes D29139. llvm-svn: 294158
* Implement LWG2556: Wide contract for future::share()Marshall Clow2017-01-241-0/+6
| | | | llvm-svn: 292992
* Mark tests as unsupported under libcpp-no-exceptionsRoger Ferrer Ibanez2017-01-102-2/+2
| | | | | | | | | | The destructor of std::promise needs to construct a std::future_error exception so it calls std::make_exception_ptr. But under libcpp-no-exceptions this will trigger an abort. Differential Revision: https://reviews.llvm.org/D27614 llvm-svn: 291550
* Enable -Wunreachable-code and fix duplicate warning flagsEric Fiselier2016-12-241-1/+2
| | | | llvm-svn: 290486
* Fix unused parameters and variablesEric Fiselier2016-12-235-3/+10
| | | | llvm-svn: 290459
* Add more test cases to packaged_task copyability testEric Fiselier2016-12-081-2/+4
| | | | llvm-svn: 289034
* Avoid C++17 guaranteed copy elision when testing for non-copyabilityEric Fiselier2016-12-081-1/+2
| | | | llvm-svn: 289033
* Protect futures test under libcpp-no-exceptionsRoger Ferrer Ibanez2016-12-011-1/+7
| | | | | | | | Skip tests that expect an exception be thrown. Differential Revision: https://reviews.llvm.org/D27253 llvm-svn: 288382
* [libcxx] [test] D26625: future_error::what() is implementation-defined.Stephan T. Lavavej2016-11-151-4/+6
| | | | llvm-svn: 286983
* Implement P0516: 'Clarify That shared_future’s Copy Operations have Wide ↵Marshall Clow2016-11-142-0/+12
| | | | | | Contracts' which was adopted last week in Issaquah llvm-svn: 286877
* Implement P0510 'Make future_error Constructible' adopted in IssaquahMarshall Clow2016-11-141-0/+14
| | | | llvm-svn: 286864
* [libcxx] [test] D26314: Fix MSVC warning C4189 "local variable is ↵Stephan T. Lavavej2016-11-142-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | initialized but not referenced". test/std/depr/depr.c.headers/inttypes_h.pass.cpp test/std/input.output/file.streams/c.files/cinttypes.pass.cpp test/std/input.output/iostream.forward/iosfwd.pass.cpp Add test() to avoid a bunch of void-casts, although we still need a few. test/std/input.output/iostream.format/quoted.manip/quoted.pass.cpp skippingws was unused (it's unclear to me whether this was mistakenly copy-pasted from round_trip() below). test/std/localization/locale.categories/category.collate/locale.collate/types.pass.cpp test/std/localization/locale.categories/category.ctype/facet.ctype.special/types.pass.cpp test/std/localization/locale.categories/category.ctype/locale.codecvt/types_char.pass.cpp test/std/localization/locale.categories/category.ctype/locale.codecvt/types_wchar_t.pass.cpp test/std/localization/locale.categories/category.ctype/locale.ctype/types.pass.cpp test/std/localization/locale.categories/facet.numpunct/locale.numpunct/types.pass.cpp test/std/localization/locales/locale.global.templates/use_facet.pass.cpp When retrieving facets, the references are unused. test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_long.pass.cpp test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_unsigned_long.pass.cpp "std::ios_base::iostate err = ios.goodbit;" was completely unused here. test/std/localization/locale.categories/category.time/locale.time.get/time_base.pass.cpp test/std/numerics/c.math/ctgmath.pass.cpp test/std/numerics/rand/rand.device/entropy.pass.cpp test/std/numerics/rand/rand.device/eval.pass.cpp test/std/strings/basic.string/string.modifiers/string_copy/copy.pass.cpp test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/eof.pass.cpp test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/eof.pass.cpp test/std/thread/futures/futures.promise/dtor.pass.cpp test/std/thread/futures/futures.task/futures.task.members/dtor.pass.cpp test/std/thread/thread.condition/thread.condition.condvar/wait_for_pred.pass.cpp These variables are verifying types but are otherwise unused. test/std/strings/basic.string/string.capacity/reserve.pass.cpp old_cap was unused (it's unclear to me whether it was intended to be used). test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char/eq.pass.cpp test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/eq.pass.cpp test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/lt.pass.cpp test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/eq.pass.cpp test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/lt.pass.cpp test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.wchar.t/eq.pass.cpp test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.wchar.t/lt.pass.cpp These tests contained unused characters. llvm-svn: 286847
* [libcxx] Recover no-exceptions XFAILs - IAsiri Rathnayake2016-10-0616-22/+84
| | | | | | | | | | | | | | | | First batch of changes to get some of these XFAILs working in the no-exceptions libc++ variant. Changed some XFAILs to UNSUPPORTED where the test is all about exception handling. In other cases, used the test macros TEST_THROW and TEST_HAS_NO_EXCEPTIONS to conditionally exclude those parts of the test that concerns exception handling behaviour. Reviewers: EricWF, mclow.lists Differential revision: https://reviews.llvm.org/D24562 llvm-svn: 283441
* Implement is_error_code_v and is_error_condition_v for c++17. Rework the ↵Marshall Clow2016-09-241-1/+5
| | | | | | tests for is_error_code and is_error_condition, since they were really lacking. Thanks to Alisdair for the heads-up that we were missing these. llvm-svn: 282331
* Fix C++03 build.Eric Fiselier2016-06-301-0/+3
| | | | llvm-svn: 274274
* Make futures.overview enum tests more portable. Patch from STL@microsoft.comEric Fiselier2016-06-302-9/+16
| | | | llvm-svn: 274211
* Cleanup non-standard tests as reported by STL@microsoft.com. NFC.Eric Fiselier2016-06-0118-31/+2
| | | | | | | | | | | | | | | This patch addresses the following issues in the test suite: 1. Move "std::bad_array_length" test from std/ to libcxx/ test directory since the feature is not a part of the standard. 2. Rename "futures.tas" test directory to "futures.task" since that is the correct stable name. 3. Move tests for "packaged_task<T>::result_type" from std/ to libcxx/ test directory since the typedef is a libc++ extension. llvm-svn: 271430
* [libcxx] Improve tests to use the UNSUPPORTED lit directiveAsiri Rathnayake2016-05-281-2/+1
| | | | | | | | | | | | | | | | | | | 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 llvm-svn: 271108
* Replace one more occurrence of non-standard std:launch::any. Patch from ↵Eric Fiselier2016-04-301-3/+3
| | | | | | STL@microsoft.com llvm-svn: 268153
* Fix or move various non-standard tests.Eric Fiselier2016-04-292-115/+70
| | | | | | | | | | | | This patch does the following: * Remove <__config> includes from some container tests. * Guards uses of std::launch::any in async tests because it's an extension. * Move "test/std/extensions" to "test/libcxx/extensions" * Moves various non-standard tests including those in "sequences/vector", "std/localization" and "utilities/meta". llvm-svn: 267981
* Rename function parameters to avoid shadowing. Patch from STL@microsoft.comEric Fiselier2016-04-281-4/+4
| | | | llvm-svn: 267838
* Guard a number of tests relying on threads support when built inRichard Barton2016-03-238-4/+16
| | | | | | | | single-threaded mode. Differential Revision: http://reviews.llvm.org/D14731 llvm-svn: 264191
* Make it possible to build a no-exceptions variant of libcxx.Asiri Rathnayake2015-11-1020-0/+20
| | | | | | | | | | | | 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 llvm-svn: 252598
* Remove empty file that arcanist createdEric Fiselier2015-08-281-0/+0
| | | | llvm-svn: 246273
* [libcxx] Mark most test/std/future tests as UNSUPPORTED in C++03Eric Fiselier2015-08-2838-603/+334
| | | | | | | | | | | | | | | | | | | | Summary: This patch marks *most* tests for `std::promise`, `std::future` and `std::shared_future` as unsupported in C++03. These tests fail in C++03 mode because they attempt to copy a `std::future` even though it is a `MoveOnly` type. AFAIK the missing move-semantics in `std::future` is the only reason these tests fail but without move semantics these classes are useless. For example even though `std::promise::set_value` and `std::promise::set_exception(...)` work in C++03 `std::promise` is still useless because we cannot call `std::promise::get_future(...)`. It might be possible to hack `std::move(...)` like we do for `std::unique_ptr` to make the move semantics work but I don't think it is worth the effort. Instead I think we should leave the `<future>` header as-is and mark the failing tests as `UNSUPPORTED`. I don't believe there are any users of `std::future` or `std::promise` in C++03 because they are so unusable. Therefore I am not concerned about losing test coverage and possibly breaking users. However because there are still parts of `<future>` that work in C++03 it would be wrong to `#ifdef` out the entire header. @mclow.lists Should we take further steps to prevent the use of `std::promise`, `std::future` and `std::shared_future` in C++03? Note: This patch also cleans up the tests and converts them to use `support/test_allocator.h` instead of a duplicate class in `test/std/futures/test_allocator.h`. Reviewers: mclow.lists Subscribers: vsk, mclow.lists, cfe-commits Differential Revision: http://reviews.llvm.org/D12135 llvm-svn: 246271
* Mark std::packaged_task tests as unsupported in C++03.Eric Fiselier2015-08-1918-61/+45
| | | | | | | std::packaged_task requires variadic templates and is #ifdef out in C++03. This patch silences the tests in C++03. This patch also rewrites the .fail.cpp tests so that they use clang verify. llvm-svn: 245413
* Mark async tests as UNSUPPORTED in C++03 because it requires variadicsEric Fiselier2015-07-282-0/+2
| | | | llvm-svn: 243393
* Implement LWG#2407: 'packaged_task(allocator_arg_t, const Allocator&, F&&) ↵Marshall Clow2015-06-301-1/+1
| | | | | | should neither be constrained nor explicit' llvm-svn: 241068
* Fix PR23293 - Do not unlock shared state before notifying consumers.Eric Fiselier2015-06-121-0/+67
| | | | | | | | Within the shared state methods do not unlock the lock guards manually. This could cause a race condition where the shared state is destroyed before the method is complete. llvm-svn: 239577
OpenPOWER on IntegriCloud