summaryrefslogtreecommitdiffstats
path: root/libcxx/test/support
Commit message (Collapse)AuthorAgeFilesLines
* Implement filesystem NB comments, relative paths, and related issues.Eric Fiselier2018-04-022-1/+226
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a fairly large patch that implements all of the filesystem NB comments and the relative paths changes (ex. adding weakly_canonical). These issues and papers are all interrelated so their implementation couldn't be split up nicely. This patch upgrades <experimental/filesystem> to match the C++17 spec and not the published experimental TS spec. Some of the changes in this patch are both API and ABI breaking, however libc++ makes no guarantee about stability for experimental implementations. The major changes in this patch are: * Implement NB comments for filesystem (P0492R2), including: * Implement `perm_options` enum as part of NB comments, and update the `permissions` function to match. * Implement changes to `remove_filename` and `replace_filename` * Implement changes to `path::stem()` and `path::extension()` which support splitting examples like `.profile`. * Change path iteration to return an empty path instead of '.' for trailing separators. * Change `operator/=` to handle absolute paths on the RHS. * Change `absolute` to no longer accept a current path argument. * Implement relative paths according to NB comments (P0219r1) * Combine `path.cpp` and `operations.cpp` since some path functions require access to the operations internals, and some fs operations require access to the path parser. llvm-svn: 329028
* Make filesystem tests generic between experimental and std versions.Eric Fiselier2018-03-262-2/+19
| | | | | | | | | | | | | | | As I move towards implementing std::filesystem, there is a need to make the existing tests run against both the std and experimental versions. Additionally, it's helpful to allow running the tests against other implementations of filesystem. This patch converts the test to easily target either. First, it adds a filesystem_include.hpp header which is soley responsible for selecting and including the correct implementation. Second, it converts existing tests to use this header instead of including filesystem directly. llvm-svn: 328475
* Use DoNotOptimize to prevent new/delete elision.Eric Fiselier2018-03-221-2/+12
| | | | | | | | | | | The new/delete tests, in particular those which test replacement functions, often fail when the optimizer is enabled because the calls to new/delete may be optimized away, regardless of their side-effects. This patch converts the tests to use DoNotOptimize in order to prevent the elision. llvm-svn: 328245
* Correct TEST_HAS_NO_ALIGNED_ALLOCATION macro definitionEric Fiselier2018-03-221-2/+3
| | | | llvm-svn: 328185
* Fix PR22634 - std::allocator doesn't respect over-aligned types.Eric Fiselier2018-03-222-5/+170
| | | | | | | | | | | | | | | | | | | | This patch fixes std::allocator, and more specifically, all users of __libcpp_allocate and __libcpp_deallocate, to support over-aligned types. __libcpp_allocate/deallocate now take an alignment parameter, and when the specified alignment is greater than that supported by malloc/new, the aligned version of operator new is called (assuming it's available). When aligned new isn't available, the old behavior has been kept, and the alignment parameter is ignored. This patch depends on recent changes to __builtin_operator_new/delete which allow them to be used to call any regular new/delete operator. By using __builtin_operator_new/delete when possible, the new/delete erasure optimization is maintained. llvm-svn: 328180
* libcxx: Provide overloads for basic_filebuf::open() et al that take wchar_t* ↵Peter Collingbourne2018-01-231-0/+12
| | | | | | | | | | | | filenames on Windows. This is an MSVC standard library extension. It seems like a reasonable enough extension to me because wchar_t* is the native format for filenames on that platform. Differential Revision: https://reviews.llvm.org/D42225 llvm-svn: 323170
* [libcxx] [test] Improve MSVC portability.Stephan T. Lavavej2018-01-101-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | test/support/msvc_stdlib_force_include.hpp When testing MSVC's STL with C1XX, simulate a couple more compiler feature-test macros. When testing MSVC's STL, simulate a few library feature-test macros. test/std/atomics/atomics.lockfree/isalwayslockfree.pass.cpp The vector_size attribute is a non-Standard extension that's supported by Clang and GCC, but not C1XX. Therefore, guard this with `__has_attribute(vector_size)`. Additionally, while these tests pass when MSVC's STL is compiled with Clang, I don't consider this to be a supported scenario for our library, so also guard this with defined(_LIBCPP_VERSION). test/std/utilities/function.objects/func.not_fn/not_fn.pass.cpp N4713 23.14.10 [func.not_fn]/1 depicts only `call_wrapper(call_wrapper&&) = default;` and `call_wrapper(const call_wrapper&) = default;`. According to 15.8.2 [class.copy.assign]/2 and /4, this makes call_wrapper non-assignable. Therefore, guard the assignability tests as libc++ specific. Add a (void) cast to tolerate not_fn() being marked as nodiscard. Fixes D41213. llvm-svn: 322144
* Move + and * operators of MoveOnly into MoveOnly.h.Billy Robert O'Neal III2018-01-051-1/+2
| | | | llvm-svn: 321852
* [libcxx] [test] Fix MSVC warnings, null pointer deref.Stephan T. Lavavej2017-12-131-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | test/std/algorithms/alg.modifying.operations/alg.generate/generate_n.pass.cpp Silence MSVC warning C4244. This is expected when passing floating-point values for size. test/std/utilities/template.bitset/bitset.members/to_ullong.pass.cpp test/std/utilities/template.bitset/bitset.members/to_ulong.pass.cpp Avoid MSVC "warning C4293: '<<': shift count negative or too big, undefined behavior". MSVC sees (1ULL << N) and warns - being guarded by const bool canFit is insufficient. A small change to the code avoids the warning without the need for a pragma. Remove a spurious printf() declaration from to_ullong.pass.cpp. Change ULL to UL in to_ulong.pass.cpp. The ULL suffix was probably copy-pasted. test/std/utilities/tuple/tuple.general/ignore.pass.cpp Use LIBCPP_STATIC_ASSERT for consistency with other files. test/support/container_test_types.h Fix a null pointer dereference, found by MSVC /analyze warning C6011 "Dereferencing NULL pointer 'm_expected_args'." Fixes D41030. llvm-svn: 320535
* Change (void) casts to TEST_IGNORE_NODISCARD, as requested by Eric. Reviewed ↵Billy Robert O'Neal III2017-11-211-0/+2
| | | | | | as https://reviews.llvm.org/D40065 llvm-svn: 318804
* Rename identifiers named `__output`Alexander Richardson2017-11-141-0/+3
| | | | | | | | | | | | | | | | Summary: In the CHERI clang compiler __output and __input are keywords and therefore we can't compile libc++ with our compiler. Reviewers: mclow.lists, EricWF, theraven Reviewed By: EricWF Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D39537 llvm-svn: 318144
* fix shadowing warnings in new tests, try 2Eric Fiselier2017-10-171-2/+2
| | | | llvm-svn: 316009
* fix shadowing warnings in new testsEric Fiselier2017-10-171-3/+3
| | | | llvm-svn: 315997
* [libc++] Fix PR34898 - vector iterator constructors and assign method ↵Eric Fiselier2017-10-172-2/+100
| | | | | | | | | | | | | | | | | | | | | | | perform push_back instead of emplace_back. Summary: The constructors `vector(Iter, Iter, Alloc = Alloc{})` and `assign(Iter, Iter)` don't correctly perform EmplaceConstruction from the result of dereferencing the iterator. This results in them performing an additional and unneeded copy. This patch addresses the issue by correctly using `emplace_back` in C++11 and newer. There are also some bugs in our `insert` implementation, but those will be handled separately. @mclow.lists We should probably merge this into 5.1, agreed? Reviewers: mclow.lists, dlj, EricWF Reviewed By: mclow.lists, EricWF Subscribers: cfe-commits, mclow.lists Differential Revision: https://reviews.llvm.org/D38757 llvm-svn: 315994
* [libcxx] [test] Silence warning C4324 for MSVC.Stephan T. Lavavej2017-09-261-0/+1
| | | | | | | | This warning "structure was padded due to alignment specifier" says that the compiler is going to do exactly what you asked it to do. It's triggered by the tests for over-aligned dynamic memory allocation. llvm-svn: 314257
* [libcxx] [test] Update for C++17 feature removals.Stephan T. Lavavej2017-08-242-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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] Rename _Tp to T. NFCI.Stephan T. Lavavej2017-08-112-8/+8
| | | | | | | This improves readability and (theoretically) improves portability, as _Ugly names are reserved. llvm-svn: 310758
* [libcxx] [test] Fix URLs in comments and make them HTTPS. NFC.Stephan T. Lavavej2017-08-051-1/+1
| | | | llvm-svn: 310156
* [libcxx] [test] Make files consistently end with newlines, NFC.Stephan T. Lavavej2017-07-291-1/+1
| | | | llvm-svn: 309465
* [libcxx] [test] Untabify, NFC.Stephan T. Lavavej2017-07-291-3/+3
| | | | llvm-svn: 309464
* [libcxx] [test] Update msvc_stdlib_force_include.hpp.Stephan T. Lavavej2017-07-191-3/+4
| | | | | | | MSVC's STL is replacing _HAS_FUNCTION_ASSIGN with _HAS_FUNCTION_ALLOCATOR_SUPPORT, and is adding _HAS_UNEXPECTED. llvm-svn: 308535
* Add case for c++2a to libc++ and test macrosMarshall Clow2017-07-171-1/+4
| | | | llvm-svn: 308159
* Attempt to avoid static init ordering issues with globalMemCounterEric Fiselier2017-06-211-5/+10
| | | | llvm-svn: 305955
* any: Add availability for experimental::bad_any_castDuncan P. N. Exon Smith2017-06-181-0/+2
| | | | | | | | As a follow up to r302172, add missing availability for bad_any_cast. rdar://problem/32161524 llvm-svn: 305647
* Add some const_casts in places where we were implicitly casting away ↵Marshall Clow2017-06-141-1/+1
| | | | | | constness. No functional change, but now they're explicit llvm-svn: 305410
* Fix bug 33389 - __is_transparent check requires too muchMarshall Clow2017-06-131-3/+13
| | | | llvm-svn: 305292
* [libcxx] [test] Update locale names for Windows.Stephan T. Lavavej2017-06-082-11/+9
| | | | | | | | | | | | | | | | | locale.codecvt.byname/ctor_char.pass.cpp: This test used to use "en_US" as a plain string instead of using platform_support. Need to fix this because MS STL expects "en-US" instead. platform_support.h: These are the legacy Windows locale names. Should use IETF tags instead. I've also added en_US, since a test was using that as a locale string as well. msvc_stdlib_force_include.hpp: Remove _MSVC_STL_VER. The libraries will directly define _MSVC_STL_VERSION in the future. Fixes D29351. llvm-svn: 305000
* [test] Test changes to accommodate LWG 2904 "Make variant move-assignment ↵Casey Carter2017-06-071-2/+2
| | | | | | | | | | more exception safe" Also: Move constexpr / triviality extension tests into the std tree and make them conditional on _LIBCPP_VERSION / _MSVC_STL_VERSION. https://reviews.llvm.org/D32671 llvm-svn: 304847
* [libcxx] [test] Add _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to ↵Stephan T. Lavavej2017-06-061-0/+3
| | | | | | | | | msvc_stdlib_force_include.hpp. This macro will instruct MSVC's STL to not warn about features that are deprecated in C++17, as libcxx tests those features and uses them elsewhere. llvm-svn: 304765
* [test] Remove workaround for C1XX empty parameter pack bugCasey Carter2017-06-053-57/+0
| | | | | | Was VSO#109062. This bug was filed *4 years ago*. I submitted a workaround to enable the scoped_allocator_adaptor tests to pass. Bug fixed a week and a half later. This was either a waste of my time, or I've discovered that libc++ has magical bugfix-inducing powers. My money's on the latter. llvm-svn: 304730
* Guard against more macros in tchar.hEric Fiselier2017-05-311-1/+7
| | | | llvm-svn: 304352
* Remove uses of _UI because Windows is evil and tchar.h #define's itEric Fiselier2017-05-311-0/+2
| | | | llvm-svn: 304348
* [test] s/uexpectedly/unexpectedly/Casey Carter2017-05-301-1/+1
| | | | llvm-svn: 304236
* [coroutines] Add end-to-end tests within libc++Eric Fiselier2017-05-281-0/+75
| | | | | | | | | | | | | This patch adds end-to-end/breathing tests for coroutines into libc++. The tests aren't specifically to test libc++ requirements but instead are intented to ensure coroutines are working fine in general. Although libc++ isn't exactly the most correct place for these tests to live, there is one major advantage. The libc++ test suite is also used by MSVC and by adding the tests here it ensures they will be run against all currently available coroutine implementations. llvm-svn: 304101
* [test] Remove workaround for C1XX conversion-to-nullptr bugCasey Carter2017-05-253-36/+4
| | | | | | | | | | VSO#391542 "Types can't be convertible to nullptr_t" Also put internal bug numbers on the workarounds in test_workarounds.h for correlation. Differential Revision: https://reviews.llvm.org/D33290 llvm-svn: 303889
* [test] Workaround C1XX bug in uses_allocator_types.hppCasey Carter2017-05-253-0/+58
| | | | | | | | VSO#109062 "Explicit template argument specification with empty template parameter pack expansion does not imply further empty pack expansion" Differential Revision: https://reviews.llvm.org/D33214 llvm-svn: 303888
* Add <experimental/coroutine>Eric Fiselier2017-05-251-0/+6
| | | | | | | This patch adds the library portions of the coroutines PDTS, which should now be supported by Clang. llvm-svn: 303836
* Make next/prev/advance/distance operations on iterators be constexpr. I ↵Marshall Clow2017-05-171-64/+64
| | | | | | missed this when I implemented the rest of P0031R0 llvm-svn: 303281
* Fix bad #endif in msvc_stdlib_force_include.hpp.Billy Robert O'Neal III2017-05-101-6/+7
| | | | llvm-svn: 302728
* [test] support machinery changes for EDG & C1XX /ZaCasey Carter2017-05-106-9/+77
| | | | | | | | | | | | | | | | | | | | | This change works around a couple of bugs: 1. EDG doesn't like explicit constexpr in a derived class. This program: struct Base {}; struct Derived : Base { constexpr Derived() = default; }; triggers "error: defaulted default constructor cannot be constexpr." 2. C1XX with /Za has no idea which constructor needs to be valid for copy elision. The change also conditionally disables parts of the msvc_stdlib_force_include.hpp header that conflict with external configuration when _LIBCXX_IN_DEVCRT is defined. Differential Revision: https://reviews.llvm.org/D32778 llvm-svn: 302707
* Fix misspelling of environment throughout libc++Eric Fiselier2017-05-092-3/+3
| | | | llvm-svn: 302600
* [libcxx] [test] Suppress MSVC's /analyze warning C6294 in a more ↵Stephan T. Lavavej2017-05-051-1/+0
| | | | | | | | fine-grained manner. Fixes D32926. llvm-svn: 302325
* Fix test failure with GCC 4.9Eric Fiselier2017-05-041-0/+4
| | | | llvm-svn: 302182
* [test] Name the local variable in the C1XX implementation of DoNotOptmizeCasey Carter2017-05-041-1/+2
| | | | | | Differential Revision: https://reviews.llvm.org/D32510 llvm-svn: 302162
* [test] variant: enable constexpr construction tests on MSVC STLCasey Carter2017-05-043-0/+37
| | | | | | | * Add a new macro _MSVC_STL_VER to detect when the MSVC STL is being tested * Workaround C1XX __is_trivially_copyable bug llvm-svn: 302158
* [libcxx] [test] In msvc_stdlib_force_include.hpp, use _HAS_CXX17 to set ↵Stephan T. Lavavej2017-05-041-2/+8
| | | | | | | | | | | | | | | | | | | | | | | TEST_STD_VER. _HAS_CXX17 indicates whether MSVC's STL is in C++17 mode. In MSVC there's a distinction between CRT headers like stdlib.h and STL headers like cstdlib. Only the STL headers drag in yvals.h, our internal STL-wide header that defines internal macros like _HAS_CXX17. _HAS_CXX17 is an MSVC STL library macro, unconditionally defined. We centralize everything on this, because we have to ask different questions to determine whether C1XX, EDG, or Clang is in 14 or 17 mode, and we additionally permit users to override the detection in one way (it's okay to ask for 17 from the compiler, but only 14 from the libs, at least for the moment; only noexcept in the type system will give us a headache). As this header is for testing MSVC's STL, we can assume _HAS_CXX17 is defined. Fixes D32726. llvm-svn: 302104
* Cleanup _LIBCPP_HAS_NO_<c++11-feature> in support headers and final testsEric Fiselier2017-04-195-28/+24
| | | | llvm-svn: 300637
* Overhaul unique_ptr - Implement LWG 2801, 2905, 2520.Eric Fiselier2017-04-162-8/+4
| | | | | | | | | | | | | | | | | | | | | This patch overhauls both specializations of unique_ptr while implementing the following LWG issues: * LWG 2801 - This issue constrains unique_ptr's constructors when the deleter type is not default constructible. Additionally it adds SFINAE conditions to unique_ptr<T[]>::unique_ptr(Up). * LWG 2905 - This issue reworks the unique_ptr(pointer, /* see below */ deleter) constructors so that they correctly SFINAE when the deleter argument cannot be used to construct the stored deleter. * LWG 2520 - This issue fixes initializing unique_ptr<T[]> from nullptr. Libc++ had previously implemented this issue, but the suggested resolution still broke initialization from NULL. This patch re-works the unique_ptr<T[]>(Up, deleter) overloads so that they accept NULL as well as nullptr. llvm-svn: 300406
* Simplify test helperEric Fiselier2017-04-151-7/+1
| | | | llvm-svn: 300399
* Rewrite and cleanup unique_ptr tests.Eric Fiselier2017-04-152-0/+172
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch almost entirely rewrites the unique_ptr tests. There are a couple of reasons for this: A) Most of the *.fail.cpp tests were either incorrect or could be better written as a *.pass.cpp test that uses <type_traits> to check if certain operations are valid (Ex. Using static_assert(!std::is_copy_constructible_v<T>) instead of writing a failure test). B) [unique.ptr.runtime] has very poor test coverage. Many of the constructors and assignment operators have to tests at all. The special members that have tests have very few test cases and are typically way out of date. C) The tests for [unique.ptr.single] and [unique.ptr.runtime] are largely duplicates of each other. This means common requirements have two different sets of tests in two different test files. This makes the tests harder to maintain than if there was a single copy. To address (A) this patch changes almost all of the *.fail.cpp tests into .pass.cpp tests using type traits; Allowing the *.fail.cpp tests to be removed. The address (B) and (C) the tests for [unique.ptr.single] and [unique.ptr.runtime] have been combined into a single directory, allowing both specializations to share common tests. Tests specific to the single/runtime specializations are given the suffix "*.single.pass.cpp" or "*.runtime.pass.cpp". Finally the unique.ptr test have been moved into the correct directory according to the standard. Specifically they have been removed from "utilities/memory" into "utilities/smartptr". PS. This patch also adds newly written tests for upcoming unique_ptr changes/fixes. However since these tests don't currently pass they are guarded by the macro TEST_WORKAROUND_UPCOMING_UNIQUE_PTR_CHANGES. This allows other STL's to validate the tests before libc++ implements the changes. The relevant libc++ changes should land in the next week. llvm-svn: 300388
OpenPOWER on IntegriCloud