summaryrefslogtreecommitdiffstats
path: root/libcxx/test
Commit message (Collapse)AuthorAgeFilesLines
* [libc++] Fix ABI break in __bit_reference.Eric Fiselier2020-02-201-0/+57
| | | | | | | | | | | | | | | | | | | The libc++ __bit_iterator type has weird ABI calling conventions as a quirk of the implementation. The const bit iterator is trivial, but the non-const bit iterator is not because it declares a user-defined copy constructor. Changing this now is an ABI break, so this test ensures that each type is trivial/non-trivial as expected. The definition of 'non-trivial for the purposes of calls': A type is considered non-trivial for the purposes of calls if: * it has a non-trivial copy constructor, move constructor, or destructor, or * all of its copy and move constructors are deleted. (cherry picked from commit a829443cc7359ecf0f2de8f82519f511795675ec)
* Revert "[libcxx] Force-cache LIBCXX_CXX_ABI_LIBRARY_PATH"Sergej Jaskiewicz2020-01-311-1/+1
| | | | | | This reverts commit 41f4dfd63ea0fe995ddfba1838aa5ed972cc1377. It broke standalone libc++ builds, which now try to use libc++abi from the wrong directory, instead of system instance.
* [libcxx] [test] Add casts to avoid signed/unsigned mismatch warnings on MSVC++Billy Robert O'Neal III2020-01-143-3/+3
| | | | A bug was filed that these warnings should not be emitted as DevCom-883961. ( https://developercommunity.visualstudio.com/content/problem/883961/c4389-signedunsigned-mismatch-should-not-be-emitte.html )
* [libcxx] Force-cache LIBCXX_CXX_ABI_LIBRARY_PATHSergej Jaskiewicz2020-01-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: The `LIBCXX_CXX_ABI_LIBRARY_PATH` CMake variable is cached once in libcxx/cmake/Modules/HandleLibCXXABI.cmake in the `setup_abi_lib` macro, and then cached again in libcxx/test/CMakeLists.txt. There, if it is not set to a value, it is by default set to `LIBCXX_LIBRARY_DIR`. However, this new value is not actually cached, because the old (empty) value has been already cached. Use the `FORCE` CMake flag so that it is saved to the cache. This should not break anything, because the code changed here previously had no effect, when it should have. Reviewers: jroelofs, bcraig, ldionne, EricWF, mclow.lists, vvereschaka, eastig Reviewed By: vvereschaka Subscribers: mgorny, christof, dexonsmith, libcxx-commits Tags: #libc Differential Revision: https://reviews.llvm.org/D69169
* [libcxx] [test] Disable refwrap/weak_result.pass.cpp in C++20 mode (broken ↵Billy Robert O'Neal III2020-01-081-0/+2
| | | | by P0357R3)
* [libcxx][test] Fix span tests.Stephan T. Lavavej2020-01-086-38/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | span.cons/container.pass.cpp N4842 22.7.3.2 [span.cons]/13 constrains span's range constructor for ranges::contiguous_range (among other criteria). 24.4.5 [range.refinements]/2 says that contiguous_range requires data(), and (via contiguous_range, random_access_range, bidirectional_range, forward_range, input_range, range) it also requires begin() and end() (see 24.4.2 [range.range]/1). Therefore, IsAContainer needs to provide begin() and end(). (Detected by MSVC's concept-constrained implementation.) span.cons/stdarray.pass.cpp This test uses std::array, so it must include <array>. <span> isn't guaranteed to drag in <array>. (Detected by MSVC's implementation which uses a forward declaration to avoid dragging in <array>, for increased compiler throughput.) span.objectrep/as_bytes.pass.cpp span.objectrep/as_writable_bytes.pass.cpp Testing `sp.extent == std::dynamic_extent` triggers MSVC warning C4127 "conditional expression is constant". Using `if constexpr` is a simple way to avoid this without disrupting anyone else (as span requires C++20 mode). span.tuple/get.pass.cpp 22.7.3.2 [span.cons]/4.3: "Preconditions: If extent is not equal to dynamic_extent, then count is equal to extent." These lines were triggering undefined behavior (detected by assertions in MSVC's implementation). I changed the count arguments in the first two chunks, followed by changing the span extents, in order to preserve the test's coverage and follow the existing pattern. span.cons/span.pass.cpp 22.7.3.2 [span.cons]/18.1 constrains span's converting constructor with "Extent == dynamic_extent || Extent == OtherExtent is true". This means that converting from dynamic extent to static extent is not allowed. (Other constructors tested elsewhere, like span(It first, size_type count), can be used to write such code.) As this is the test for the converting constructor, I have: * Removed the "dynamic -> static" case from checkCV(), which is comprehensive. * Changed the initialization of std::span<T, 0> s1{}; in testConstexprSpan() and testRuntimeSpan(), because s1 is used below. * Removed ASSERT_NOEXCEPT(std::span<T, 0>{s0}); from those functions, as they are otherwise comprehensive. * Deleted testConversionSpan() entirely. Note that this could never compile (it had a bool return type, but forgot to say `return`). And it couldn't have provided useful coverage, as the /18.2 constraint "OtherElementType(*)[] is convertible to ElementType(*)[]" permits only cv-qualifications, which are already tested by checkCV().
* [libc++] Update feature list for NetBSDMichał Górny2019-12-201-1/+1
| | | | | | | | | Add NetBSD to the same feature list as Fuchsia since it matches in available features, effectively enabling aligned_alloc(), timespec_get() and C11 features. Remove now-duplicate declaration of quick_exit() support. Differential Revision: https://reviews.llvm.org/D71511
* [libcxx] Fix include paths in fuzzing/partial_sort.pass.cppMikhail Maltsev2019-12-171-2/+2
| | | | | | | | | | | | | | | | | | | | | | | Summary: When testing an installed (out-of-tree) version of libc++, the "libcxx/fuzzing/partial_sort.pass.cpp" test fails because of missing include files "../fuzzing/fuzzing.{h,cpp}". This happens because in the source tree "../fuzzing" can be accessed as "libcxx/include/../fuzzing", but with the installed library this does not work. This patch fixes the issue by changing the path to be relative from the `libcxx/test/fuzzing" directory. Reviewers: mclow.lists, EricWF, christof, michaelplatings Reviewed By: michaelplatings Subscribers: merge_guards_bot, ldionne, libcxx-commits Tags: #libc Differential Revision: https://reviews.llvm.org/D71459
* [libc++] Rework compressed pair constructors.Eric Fiselier2019-12-161-1/+1
| | | | | | | | | | | | This patch de-duplicates most compressed pair constructors to use the same code in C++11 and C++03. Part of doing that is deleting the "__second_tag()" and replacing it with a "__value_init_tag()" which has the same effect, but allows for the removal of the special "one-arg" first element constructor. This patch is intended to have no semantic change.
* Add default initialization to compressed_pair.Eric Fiselier2019-12-161-0/+51
| | | | | | | | | | This change introduces the __default_init_tag to memory, and a corresponding element constructor to allow for default initialization of either of the pair values. This is useful for classes such as std::string where most (all) constructors explicitly initialize the values in the constructor. Patch by Martijn Vels (mvels@google.com) Reviewed as https://reviews.llvm.org/D70617
* [libcxx] [test] Include missing headers. (NFC)Stephan T. Lavavej2019-12-1310-0/+13
| | | | | | | | libcxx/test/std/containers/sequences/array/at.pass.cpp Need to include <stdexcept> for std::out_of_range. libcxx/test/std/localization/locale.categories/category.time/* Need to include <ios> for std::ios.
* [libcxx] [test] Fix valarray UB and MSVC warnings.Stephan T. Lavavej2019-12-1210-15/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | [libcxx] [test] Calling min and max on an empty valarray is UB. libcxx/test/std/numerics/numarray/template.valarray/valarray.members/min.pass.cpp libcxx/test/std/numerics/numarray/template.valarray/valarray.members/max.pass.cpp The calls `v1.min();` and `v1.max();` were emitting nodiscard warnings with MSVC's STL. Upon closer inspection, these calls were triggering undefined behavior. N4842 [valarray.members] says: "T min() const; 8 Preconditions: size() > 0 is true. T max() const; 10 Preconditions: size() > 0 is true." As these tests already provide coverage for non-empty valarrays (immediately above), I've simply deleted the code for empty valarrays. [libcxx] [test] Add macros to msvc_stdlib_force_include.h (NFC). libcxx/test/support/msvc_stdlib_force_include.h These macros are being used by: libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/result_of11.pass.cpp Defining them to nothing allows that test to pass. [libcxx] [test] Silence MSVC warning C5063 for is_constant_evaluated (NFC). libcxx/test/std/utilities/meta/meta.const.eval/is_constant_evaluated.pass.cpp This test is intentionally writing code that MSVC intentionally warns about, so the warning should be silenced. Additionally, comment an endif for clarity. [libcxx] [test] Silence MSVC warning C4127 (NFC). libcxx/test/support/charconv_test_helpers.h MSVC avoids emitting this warning when it sees a single constexpr value being tested, but this condition is a mix of compile-time and run-time. Using push-disable-pop is the least intrusive way to silence this. [libcxx] [test] Silence MSVC truncation warning (NFC). libcxx/test/std/containers/sequences/vector/vector.cons/construct_iter_iter.pass.cpp This test is intentionally truncating float to int, which MSVC intentionally warns about, so push-disable-pop is necessary. [libcxx] [test] Avoid truncation warnings in erase_if tests (NFC). libcxx/test/std/containers/associative/map/map.erasure/erase_if.pass.cpp libcxx/test/std/containers/associative/multimap/multimap.erasure/erase_if.pass.cpp libcxx/test/std/containers/unord/unord.map/erase_if.pass.cpp libcxx/test/std/containers/unord/unord.multimap/erase_if.pass.cpp These tests use maps with `short` keys and values, emitting MSVC truncation warnings from `int`. Adding `static_cast` to `key_type` and `mapped_type` avoids these warnings. As these tests require C++20 mode (or newer), for brevity I've changed the multimap tests to use emplace to initialize the test data. This has no effect on the erase_if testing.
* [libc++] Mark all fuzzing tests as unsupported in C++03Eric Fiselier2019-12-1217-0/+33
|
* [libc++] Cleanup and enable multiple warnings.Eric Fiselier2019-12-125-0/+15
| | | | | | | | | | Too many warnings are being disabled too quickly. Warnings are important to keeping libc++ correct. This patch re-enables two warnings: -Wconstant-evaluated and -Wdeprecated-copy. In future, all warnings disabled for the test suite should require an attached bug. The bug should state the plan for re-enabling that warning, or a strong case why it should remain disabled.
* [libc++] Add fuzzing tests for parts of <random>.Eric Fiselier2019-12-1134-586/+279
| | | | | This patch also re-names the existing fuzzing unit tests so they actually run.
* Fix _LIBCPP_HAS_ definitions for Android.Dan Albert2019-11-185-9/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Android added quick_exit()/at_quick_exit() in API level 21, aligned_alloc() in API level 28, and timespec_get() in API level 29, but has the other C11 features at all API levels (since they're basically just coming from clang directly). _LIBCPP_HAS_QUICK_EXIT and _LIBCPP_HAS_TIMESPEC_GET already existed, so we can reuse them. (And use _LIBCPP_HAS_TIMESPEC_GET in a few more places where _LIBCPP_HAS_C11_FEATURES has been used as a proxy. This isn't correct for Android.) _LIBCPP_HAS_ALIGNED_ALLOC is added, to cover aligned_alloc() (obviously). Add a missing std:: before aligned_alloc in a cstdlib test, and remove a couple of !defined(_WIN32)s now that we're explicitly testing TEST_HAS_ALIGNED_ALLOC rather than TEST_HAS_C11_FEATURES. Reviewers: danalbert, EricWF, mclow.lists Reviewed By: danalbert Subscribers: srhines, christof, libcxx-commits Tags: #libc Differential Revision: https://reviews.llvm.org/D69929
* Rename __is_foo_iterator traits to reflect their Cpp17 nature.Eric Fiselier2019-11-181-35/+35
| | | | | | | | | With the upcoming introduction of iterator concepts in ranges, the meaning of "__is_contiguous_iterator" changes drastically. Currently we intend it to mean "does it have this iterator category", but it could now also mean "does it meet the requirements of this concept", and these can be different.
* [libc++] Add _ITER_CONCEPT and _ITER_TRAITS implementations from C++20Eric Fiselier2019-11-162-0/+120
| | | | | | These traits are currently unused because we don't implement ranges. However, their addition is part of ongoing work to allow libc++ to optimize on user-provided contiguous iterators.
* [libc++] Add C++20 contiguous_iterator_tag.Eric Fiselier2019-11-162-1/+35
| | | | | This work is part of an ongoing effort to allow libc++ to optimize user provided contiguous iterators.
* [libc++] [chrono] Fix year_month_weekday::ok() implementation.Marek Kurdej2019-11-151-3/+23
| | | | | | | | | | | | Reviewers: ldionne, EricWF, mclow.lists Reviewed By: mclow.lists Subscribers: christof, dexonsmith, libcxx-commits Tags: #libc Differential Revision: https://reviews.llvm.org/D70282
* [libc++][P1872] span should have size_type, not index_type.Louis Dionne2019-11-1411-16/+16
| | | | | | Thanks to Marek Kurdej for the patch. Differential Revision: https://reviews.llvm.org/D70206
* [libc++] [P1612] Add missing feature-test macro __cpp_lib_endian.Louis Dionne2019-11-142-0/+40
| | | | | | Thanks to Marek Kurdej for the patch. Differential Revision: https://reviews.llvm.org/D70221
* [libcxx testing] Fix -Wtautological-overlap-compare bugDavid Zarzycki2019-11-131-3/+3
|
* [libc++][P0980] Marked member functions move/copy/assign of char_traits ↵Michael Park2019-11-1115-15/+180
| | | | | | | | | | | | | | constexpr. Reviewers: ldionne, EricWF, mclow.lists Reviewed By: ldionne Subscribers: christof, dexonsmith, libcxx-commits Tags: #libc Differential Revision: https://reviews.llvm.org/D68840
* [libc++] Fix potential OOB in poisson_distributionLouis Dionne2019-11-072-1/+74
| | | | | See details in the original Chromium bug report: https://bugs.chromium.org/p/chromium/issues/detail?id=994957
* [libc++] Fixed copy/copy_n/copy_backward for compilers that do not support ↵Louis Dionne2019-11-073-3/+3
| | | | | | is_constant_evaluated. Differential Revision: https://reviews.llvm.org/D69940
* [libc++] Fix some constexpr tests broken by D68837Louis Dionne2019-11-074-4/+4
| | | | This doesn't fix all the issues with D68837
* [libc++][P0202] Marked algorithms copy/copy_n/copy_if/copy_backward constexprLouis Dionne2019-11-067-191/+182
| | | | | | Thanks to Michael Park for the patch. Differential Revision: https://reviews.llvm.org/D68837
* [libc++] Add test and remove workaround for PR13592Louis Dionne2019-10-301-3/+9
| | | | | | | | PR13592 was caused by a problem in how to compiler implemented the __is_convertible_to intrinsic. That problem, reported as PR13591, was fixed back in 2012. We don't support such old versions of Clang anyway, so we don't need the library workaround that had been added to solve PR13592 (while waiting for the compiler fix).
* PR43764: Qualify a couple of calls to forward_as_tuple to be ADL-resilient.David Blaikie2019-10-281-0/+16
|
* [libcxx][NFC] Strip trailing whitespace, fix typo.Stephan T. Lavavej2019-10-2313-23/+23
|
* [NFC] Strip trailing whitespace from libc++Louis Dionne2019-10-2385-177/+177
|
* [libc++][NFC] Remove excess trailing newlines from most filesCasey Carter2019-10-2334-37/+0
| | | | Testing git commit access.
* [libcxx][test][NFC] Fix comment typos.Stephan T. Lavavej2019-10-2223-29/+29
| | | | (Testing git commit access.)
* [NFC] Strip trailing whitespace in test to test Github committingLouis Dionne2019-10-221-1/+1
|
* P1152R4: Fix deprecation warnings in libc++ testsuite and in uses of ↵Richard Smith2019-10-191-0/+5
| | | | | | | | | | | | | | | | is_invocable that would internally conjure up a deprecated function type. Summary: The implementation of P1152R4 in Clang has resulted in some deprecation warnings appearing in the libc++ and libc++abi test suite. Fix or suppress these warnings. Reviewers: mclow.lists, EricWF Subscribers: christof, ldionne, libcxx-commits Tags: #libc Differential Revision: https://reviews.llvm.org/D68879 llvm-svn: 375307
* [libc++][test] Use <version> to get config on MSVCCasey Carter2019-10-153-6/+6
| | | | | | | | ...instead of `<ciso646>`. Also includes some NFC comment changes. llvm-svn: 374854
* [libc++][test] Portability fix for std::any testsCasey Carter2019-10-141-2/+2
| | | | | | Ensure that `large_tracked_t` defined in `any_helpers.h` is in fact too large to fit in `std::any`'s small object buffer. llvm-svn: 374806
* [libc++][test] Add license headers to test/support/archetypes.*Casey Carter2019-10-142-0/+15
| | | | | | Differential Revision: https://reviews.llvm.org/D68947 llvm-svn: 374797
* [libc++][test] Silence more warnings in variant testsCasey Carter2019-10-144-4/+4
| | | | | | More cases of signed-to-unsigned conversion warnings that missed the train for d2623522. llvm-svn: 374778
* [libc++][test] std::variant test cleanupCasey Carter2019-10-136-5/+7
| | | | | | | | * Add the conventional `return 0` to `main` in `variant.assign/conv.pass.cpp` and `variant.ctor/conv.pass.cpp` * Fix some MSVC signed-to-unsigned conversion warnings by replacing `int` literarls with `unsigned int` literals llvm-svn: 374723
* [libc++][test] <=> now has a feature-test macroCasey Carter2019-10-131-3/+2
| | | | | | ...which `test/support/test_macros.h` can use to detect compiler support. llvm-svn: 374722
* [libc++][test] Silence MSVC warning in std::optional testCasey Carter2019-10-121-1/+1
| | | | | | `make_optional<string>(4, 'X')` passes `4` (an `int`) as the first argument to `string`'s `(size_t, charT)` constructor, triggering a signed/unsigned mismatch warning when compiling with MSVC at `/W4`. The incredibly simple fix is to instead use an unsigned literal (`4u`). llvm-svn: 374684
* [libc++][test] Change IsSmallObject's calculation for std::any's small ↵Casey Carter2019-10-101-1/+1
| | | | | | | | | | object buffer `sizeof(std::any) - sizeof(void*)` is correct for both libc++ and the MSVC standard library. Differential Revision: https://reviews.llvm.org/D68756 llvm-svn: 374407
* [libc++][test] Miscellaneous MSVC cleanupsCasey Carter2019-10-098-71/+71
| | | | | | | | | | | | * Silence unused-local-typedef warnings: `map.cons/assign_initializer_list.pass.cpp` (and the `set.cons` variant) uses a local typedef only within `LIBCPP_ASSERT`s, so clang diagnoses it as unused when testing non-libc++. * Add missing include: `c.math/abs.pass.cpp` uses `std::numeric_limits` but failed to `#include <limits>`. * Don't test non-type: A "recent" change to `meta.trans.other/underlying_type.pass.cpp` unconditionally tests the type `F` which is conditionally defined. * Use `hash<long long>` instead of `hash<short>` with `int` in `unordered_meow` deduction guide tests to avoid truncation warnings. * Convert `3.14` explicitly in `midpoint.float.pass` since MSVC incorrectly diagnoses `float meow = 3.14;` as truncating. Differential Revision: https://reviews.llvm.org/D68681 llvm-svn: 374248
* Add an off-by-default option to enable testing for gdb pretty printers.Sterling Augustine2019-10-041-6/+10
| | | | | | | | | | | | | | | | Summary: The current version of the pretty printers are not python3 compatible, so turn them off by default until sufficiently improved. Reviewers: MaskRay, tamur Subscribers: mgorny, christof, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D68477 llvm-svn: 373796
* Make libc++ gdb pretty printer Python 3 compatibleFangrui Song2019-10-041-7/+12
| | | | llvm-svn: 373691
* Fix libc++ pretty printer test for Python 3 after D67238 (take 2)Fangrui Song2019-10-031-3/+1
| | | | | | | | In both Python 2 and Python 3, gdb.Value.string returns a 'str'. We just need to delete a `encode("utf-8")` which would return a 'bytes' in Python 3. llvm-svn: 373570
* Fix libc++ pretty printer test for Python 3 after D67238Fangrui Song2019-10-021-1/+1
| | | | llvm-svn: 373452
* [libc++] Take 2: Implement LWG 3158Louis Dionne2019-09-272-1/+34
| | | | | | | | | | | | | | | | | | | | | Summary: LWG 3158 marks the allocator_arg_t constructor of std::tuple as conditionnally explicit based on whether the default constructors of the tuple's members are explicitly default constructible. This was previously committed as r372778 and reverted in r372832 due to the commit breaking LLVM's build in C++14 mode. This issue has now been addressed. Reviewers: mclow.lists Subscribers: christof, jkorous, dexonsmith, libcxx-commits Tags: #libc Differential Revision: https://reviews.llvm.org/D65232 llvm-svn: 373092
OpenPOWER on IntegriCloud